fix(transformer): Fix generation of `annotations` argument when registering functions.

This commit is contained in:
Jacob MacDonald 2015-07-28 14:37:53 -07:00
parent d84993faf1
commit 2faa89852b
4 changed files with 9 additions and 4 deletions

View File

@ -297,9 +297,9 @@ class CreateNgDepsVisitor extends Object with SimpleAstVisitor<Object> {
_maybeWriteReflector();
writer.print('..registerFunction(');
node.name.accept(this);
writer.print(', new ${_REF_PREFIX}.ReflectionInfo(');
writer.print(', new ${_REF_PREFIX}.ReflectionInfo(const [');
node.metadata.accept(_metaVisitor);
writer.print(', const [');
writer.print('], const [');
node.functionExpression.parameters.accept(_paramsVisitor);
writer.print(']))');
return null;

View File

@ -17,5 +17,7 @@ void initReflector() {
template: r'''{{greeting}}''',
templateUrl: r'package:other_package/template.html',
styles: const [r'''.greeting { .color: blue; }''',])
], const [], () => new HelloCmp()));
], const [], () => new HelloCmp()))
..registerFunction(
hello, new _ngRef.ReflectionInfo(const [const Injectable()], const []));
}

View File

@ -8,3 +8,6 @@ import 'package:angular2/angular2.dart'
templateUrl: 'package:other_package/template.html',
styleUrls: const ['package:other_package/template.css'])
class HelloCmp {}
@Injectable()
hello() {}

View File

@ -11,7 +11,7 @@ void initReflector() {
_visited = true;
_ngRef.reflector
..registerFunction(getMessage, new _ngRef.ReflectionInfo(
const Injectable(), const [const [const Inject(Message)]]))
const [const Injectable()], const [const [const Inject(Message)]]))
..registerType(Message, new _ngRef.ReflectionInfo(
const [const Injectable()], const [], () => new Message()));
}