Skip to content
This repository was archived by the owner on Sep 16, 2022. It is now read-only.
This repository was archived by the owner on Sep 16, 2022. It is now read-only.

Change ReflectableEmitter to use code_builder #782

@matanlurey

Description

@matanlurey

There is a number of reasons we want and need to do this:

  1. Less hand-written code to maintain.
  2. More alignment with the rest of AngularDart and other code generation packages.
  3. Handles tough problems like import resolution.

For example, one current bug in v5 alpha is that this will fail at compile-time:

import 'package:angular/angular.dart';

import 'foo.dart' as foo;

const fooToken = const OpaqueToken<foo.Foo>('fooToken');

@Injectable()
class Example {
  Example(@Inject(fooToken) foo.Foo foo);
}

... because our generated code doesn't know Foo has an import prefix.

If we used code_builder we could automatically generate:

import 'foo.dart' as _i1;

initReflector() {
  // Use _i1.Foo to represent 'Foo'.
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions