From 5b5de6662f3382a147116aa53b77a0da86b890b0 Mon Sep 17 00:00:00 2001 From: Jacob MacDonald Date: Thu, 23 Jul 2015 15:18:30 -0700 Subject: [PATCH] chore(transformer): Use class for reflection info instead of a map closes https://github.com/angular/angular/issues/906 --- modules/angular2/src/reflection/reflection.ts | 2 +- modules/angular2/src/reflection/reflector.ts | 42 ++++++--- .../src/transform/common/logging.dart | 17 ++-- .../src/transform/common/registered_type.dart | 30 +++---- .../directive_processor/rewriter.dart | 52 +++++------ .../transform/bind_generator/simple.dart | 12 +-- .../transform/directive_linker/simple.dart | 22 ++--- .../transform/template_compiler/inline.dart | 12 +-- .../transform/template_compiler/url.dart | 12 +-- .../test/reflection/reflector_spec.ts | 12 +-- .../basic_bind_files/bar.ng_deps.dart | 12 +-- .../expected/bar.ng_deps.dart | 12 +-- .../expected/soup.ng_deps.dart | 21 ++--- .../soup.ng_deps.dart | 21 ++--- .../events_files/bar.ng_deps.dart | 12 +-- .../events_files/expected/bar.ng_deps.dart | 12 +-- .../hello.ng_deps.dart | 16 ++-- .../hello.ng_deps.dart | 16 ++-- .../transform/directive_linker/all_tests.dart | 2 + .../simple_export_files/bar.ng_deps.dart | 8 +- .../expected/bar.ng_deps.dart | 8 +- .../expected/foo.ng_deps.dart | 8 +- .../simple_export_files/foo.ng_deps.dart | 8 +- .../simple_files/bar.ng_deps.dart | 12 +-- .../simple_files/expected/bar.ng_deps.dart | 12 +-- .../simple_files/expected/foo.ng_deps.dart | 8 +- .../simple_files/foo.ng_deps.dart | 8 +- .../absolute_export_files/bar.ng_deps.dart | 8 +- .../absolute_export_files/foo.ng_deps.dart | 8 +- .../adjacent_strings_files/foo.ng_deps.dart | 8 +- .../all_tests.dart | 87 +++++++------------ .../directive_aliases_files/bar.ng_deps.dart | 8 +- .../directive_aliases_files/foo.ng_deps.dart | 8 +- .../changeDetection.ng_deps.dart | 8 +- .../compile_children.ng_deps.dart | 23 ++--- .../directive_export_as.ng_deps.dart | 8 +- .../events.ng_deps.dart | 8 +- .../host_listeners.ng_deps.dart | 22 ++--- .../lifecycle.ng_deps.dart | 24 +++-- .../properties.ng_deps.dart | 10 +-- .../selector.ng_deps.dart | 8 +- .../too_many_directives.ng_deps.dart | 12 +-- .../export_files/bar.ng_deps.dart | 8 +- .../export_files/foo.ng_deps.dart | 8 +- .../recursive_export_files/bar.ng_deps.dart | 8 +- .../recursive_export_files/baz.ng_deps.dart | 8 +- .../recursive_export_files/foo.ng_deps.dart | 8 +- .../simple_files/foo.ng_deps.dart | 8 +- .../expected/hello.ng_deps.dart | 18 ++-- .../directive_processor/all_tests.dart | 43 ++++----- .../expected/package_soup.ng_deps.dart | 7 +- .../expected/relative_soup.ng_deps.dart | 7 +- .../expected/hello.ng_deps.dart | 18 ++-- .../expected/hello.ng_deps.dart | 24 +++-- .../expected/soup.ng_deps.dart | 9 +- .../expected/soup.ng_deps.dart | 69 +++++---------- .../expected/soup.ng_deps.dart | 9 +- .../expected/hello.ng_deps.dart | 18 ++-- .../expected/soup.ng_deps.dart | 27 +++--- .../expected/hello.ng_deps.dart | 24 +++-- .../expected/hello.ng_deps.dart | 22 ++--- .../expected/soup.ng_deps.dart | 11 ++- .../expected/soup.ng_deps.dart | 14 +-- .../expected/hello.ng_deps.dart | 12 +-- .../expected/hello.ng_deps.dart | 13 +-- .../expected/soup.ng_deps.dart | 8 +- .../expected/soup.ng_deps.dart | 12 +-- .../expected/hello.ng_deps.dart | 12 +-- .../expected/bar.ng_deps.dart | 9 +- .../expected/bar.ng_deps.dart | 8 +- .../expected/bar.ng_deps.dart | 8 +- .../expected/bar.ng_deps.dart | 12 +-- .../two_deps_files/expected/bar.ng_deps.dart | 11 ++- .../reflection_remover/all_tests.dart | 2 + .../hello1.ng_deps.dart | 24 ++--- .../hello2.ng_deps.dart | 24 ++--- .../expected/hello.ng_deps.dart | 12 +-- .../duplicate_files/hello.ng_deps.dart | 12 +-- .../expected/hello.ng_deps.dart | 12 +-- .../hello.ng_deps.dart | 12 +-- .../expected/hello.ng_deps.dart | 12 +-- .../inline_method_files/hello.ng_deps.dart | 12 +-- .../ng_for_files/hello.ng_deps.dart | 16 ++-- .../expected/hello.ng_deps.dart | 24 ++--- .../one_directive_files/hello.ng_deps.dart | 24 ++--- .../expected/hello.ng_deps.dart | 12 +-- .../url_expression_files/hello.ng_deps.dart | 12 +-- .../expected/hello.ng_deps.dart | 12 +-- .../url_method_files/hello.ng_deps.dart | 12 +-- .../expected/goodbye.ng_deps.dart | 12 +-- .../expected/hello.ng_deps.dart | 13 +-- .../expected/ng2_prefix.ng_deps.dart | 12 +-- .../with_prefix_files/goodbye.ng_deps.dart | 12 +-- .../with_prefix_files/hello.ng_deps.dart | 13 +-- .../with_prefix_files/ng2_prefix.ng_deps.dart | 12 +-- 95 files changed, 550 insertions(+), 890 deletions(-) diff --git a/modules/angular2/src/reflection/reflection.ts b/modules/angular2/src/reflection/reflection.ts index 1a6aa03921..b5eb2ff84f 100644 --- a/modules/angular2/src/reflection/reflection.ts +++ b/modules/angular2/src/reflection/reflection.ts @@ -1,7 +1,7 @@ import {Type, isPresent} from 'angular2/src/facade/lang'; import {List, ListWrapper} from 'angular2/src/facade/collection'; import {Reflector} from './reflector'; -export {Reflector} from './reflector'; +export {Reflector, ReflectionInfo} from './reflector'; import {ReflectionCapabilities} from './reflection_capabilities'; export var reflector = new Reflector(new ReflectionCapabilities()); diff --git a/modules/angular2/src/reflection/reflector.ts b/modules/angular2/src/reflection/reflector.ts index 1ebd0ce72f..eb95e9298b 100644 --- a/modules/angular2/src/reflection/reflector.ts +++ b/modules/angular2/src/reflection/reflector.ts @@ -12,8 +12,23 @@ import {PlatformReflectionCapabilities} from './platform_reflection_capabilities export {SetterFn, GetterFn, MethodFn} from './types'; export {PlatformReflectionCapabilities} from './platform_reflection_capabilities'; +export class ReflectionInfo { + _factory: Function; + _annotations: List; + _parameters: List>; + _interfaces: List; + + constructor(annotations?: List, parameters?: List>, factory?: Function, + interfaces?: List) { + this._annotations = annotations; + this._parameters = parameters; + this._factory = factory; + this._interfaces = interfaces; + } +} + export class Reflector { - _injectableInfo: Map>; + _injectableInfo: Map; _getters: Map; _setters: Map; _methods: Map; @@ -29,11 +44,11 @@ export class Reflector { isReflectionEnabled(): boolean { return this.reflectionCapabilities.isReflectionEnabled(); } - registerFunction(func: Function, funcInfo: StringMap): void { + registerFunction(func: Function, funcInfo: ReflectionInfo): void { this._injectableInfo.set(func, funcInfo); } - registerType(type: Type, typeInfo: StringMap): void { + registerType(type: Type, typeInfo: ReflectionInfo): void { this._injectableInfo.set(type, typeInfo); } @@ -50,8 +65,9 @@ export class Reflector { } factory(type: Type): Function { - if (this._containsTypeInfo(type)) { - return this._getTypeInfoField(type, "factory", null); + if (this._containsReflectionInfo(type)) { + var res = this._injectableInfo.get(type)._factory; + return isPresent(res) ? res : null; } else { return this.reflectionCapabilities.factory(type); } @@ -59,7 +75,8 @@ export class Reflector { parameters(typeOrFunc: /*Type*/ any): List { if (this._injectableInfo.has(typeOrFunc)) { - return this._getTypeInfoField(typeOrFunc, "parameters", []); + var res = this._injectableInfo.get(typeOrFunc)._parameters; + return isPresent(res) ? res : []; } else { return this.reflectionCapabilities.parameters(typeOrFunc); } @@ -67,7 +84,8 @@ export class Reflector { annotations(typeOrFunc: /*Type*/ any): List { if (this._injectableInfo.has(typeOrFunc)) { - return this._getTypeInfoField(typeOrFunc, "annotations", []); + var res = this._injectableInfo.get(typeOrFunc)._annotations; + return isPresent(res) ? res : []; } else { return this.reflectionCapabilities.annotations(typeOrFunc); } @@ -75,7 +93,8 @@ export class Reflector { interfaces(type: Type): List { if (this._injectableInfo.has(type)) { - return this._getTypeInfoField(type, "interfaces", []); + var res = this._injectableInfo.get(type)._interfaces; + return isPresent(res) ? res : []; } else { return this.reflectionCapabilities.interfaces(type); } @@ -105,12 +124,7 @@ export class Reflector { } } - _getTypeInfoField(typeOrFunc, key, defaultValue) { - var res = this._injectableInfo.get(typeOrFunc)[key]; - return isPresent(res) ? res : defaultValue; - } - - _containsTypeInfo(typeOrFunc) { return this._injectableInfo.has(typeOrFunc); } + _containsReflectionInfo(typeOrFunc) { return this._injectableInfo.has(typeOrFunc); } } function _mergeMaps(target: Map, config: StringMap): void { diff --git a/modules/angular2/src/transform/common/logging.dart b/modules/angular2/src/transform/common/logging.dart index f6b00b4adf..44e0702163 100644 --- a/modules/angular2/src/transform/common/logging.dart +++ b/modules/angular2/src/transform/common/logging.dart @@ -15,12 +15,17 @@ dynamic initZoned(Transform t, _SimpleCallback fn, {String errorMessage: ''}) => setZoned(new BuildLogger(t), fn, errorMessage: errorMessage); dynamic setZoned(BuildLogger logger, _SimpleCallback fn, - {String errorMessage: ''}) => runZoned(fn, - zoneValues: {_key: logger}, onError: (e, stackTrace) { - logger.error('$errorMessage\n' - 'Exception: $e\n' - 'Stack Trace: $stackTrace'); -}); + {String errorMessage}) { + var onError; + if (errorMessage != null) { + onError = (e, stackTrace) { + logger.error('$errorMessage\n' + 'Exception: $e\n' + 'Stack Trace: $stackTrace'); + }; + } + return runZoned(fn, zoneValues: {_key: logger}, onError: onError); +} /// The logger for the current {@link Zone}. BuildLogger get logger { diff --git a/modules/angular2/src/transform/common/registered_type.dart b/modules/angular2/src/transform/common/registered_type.dart index f401c21495..3fdd5561a6 100644 --- a/modules/angular2/src/transform/common/registered_type.dart +++ b/modules/angular2/src/transform/common/registered_type.dart @@ -63,26 +63,22 @@ class _ParseRegisterTypeVisitor extends Object typeName = node.argumentList.arguments[0] is Identifier ? node.argumentList.arguments[0] : null; - return super.visitMethodInvocation(node); - } - @override - Object visitMapLiteralEntry(MapLiteralEntry node) { - if (node.key is StringLiteral) { - var key = stringLiteralToString(node.key); - switch (key) { - case 'annotations': - annotations = node.value; - break; - case 'factory': - factoryFn = node.value; - break; - case 'parameters': - parameters = node.value; - break; + // The second argument to a `registerType` call is the RegistrationInfo + // object creation. + var info = node.argumentList.arguments[1] as InstanceCreationExpression; + var args = info.argumentList.arguments; + for (int i = 0; i < args.length; i++) { + var arg = args[i]; + if (i == 0) { + annotations = arg; + } else if (i == 1) { + parameters = arg; + } else if (i == 2) { + factoryFn = arg; } } - // Do not need to descend any further. + return null; } } diff --git a/modules/angular2/src/transform/directive_processor/rewriter.dart b/modules/angular2/src/transform/directive_processor/rewriter.dart index aaad2888c0..5ad3a675b2 100644 --- a/modules/angular2/src/transform/directive_processor/rewriter.dart +++ b/modules/angular2/src/transform/directive_processor/rewriter.dart @@ -30,14 +30,9 @@ Future createNgDeps(AssetReader reader, AssetId assetId, // TODO(kegluneq): Shortcut if we can determine that there are no // [Directive]s present, taking into account `export`s. var writer = new AsyncStringWriter(); - var visitor = new CreateNgDepsVisitor( - writer, - assetId, - new XhrImpl(reader, assetId), - annotationMatcher, - _interfaceMatcher, - ngMeta, - inlineViews: inlineViews); + var visitor = new CreateNgDepsVisitor(writer, assetId, + new XhrImpl(reader, assetId), annotationMatcher, _interfaceMatcher, + ngMeta, inlineViews: inlineViews); var code = await reader.readAsString(assetId); parseCompilationUnit(code, name: assetId.path).accept(visitor); @@ -81,14 +76,9 @@ class CreateNgDepsVisitor extends Object with SimpleAstVisitor { /// The assetId for the file which we are parsing. final AssetId assetId; - CreateNgDepsVisitor( - AsyncStringWriter writer, - AssetId assetId, - XHR xhr, - AnnotationMatcher annotationMatcher, - InterfaceMatcher interfaceMatcher, - this.ngMeta, - {bool inlineViews}) + CreateNgDepsVisitor(AsyncStringWriter writer, AssetId assetId, XHR xhr, + AnnotationMatcher annotationMatcher, InterfaceMatcher interfaceMatcher, + this.ngMeta, {bool inlineViews}) : writer = writer, _copyVisitor = new ToSourceVisitor(writer), _factoryVisitor = new FactoryTransformVisitor(writer), @@ -215,31 +205,31 @@ class CreateNgDepsVisitor extends Object with SimpleAstVisitor { _maybeWriteReflector(); writer.print('..registerType('); node.name.accept(this); - writer.print(''', {'factory': '''); - if (ctor == null) { - _generateEmptyFactory(node.name.toString()); - } else { - ctor.accept(_factoryVisitor); - } - writer.print(''', 'parameters': '''); + writer.print(', new ${_REF_PREFIX}.ReflectionInfo('); + node.accept(_metaVisitor); + writer.print(', '); if (ctor == null) { _generateEmptyParams(); } else { ctor.accept(_paramsVisitor); } - writer.print(''', 'annotations': '''); - node.accept(_metaVisitor); + writer.print(', '); + if (ctor == null) { + _generateEmptyFactory(node.name.toString()); + } else { + ctor.accept(_factoryVisitor); + } if (node.implementsClause != null && node.implementsClause.interfaces != null && node.implementsClause.interfaces.isNotEmpty) { writer - ..print(''', 'interfaces': const [''') + ..print(', const [') ..print(node.implementsClause.interfaces .map((interface) => interface.name) .join(', ')) ..print(']'); } - writer.print('})'); + writer.print('))'); return null; } @@ -307,11 +297,11 @@ class CreateNgDepsVisitor extends Object with SimpleAstVisitor { _maybeWriteReflector(); writer.print('..registerFunction('); node.name.accept(this); - writer.print(''', {'parameters': const ['''); - node.functionExpression.parameters.accept(_paramsVisitor); - writer.print('''], 'annotations': '''); + writer.print(', new ${_REF_PREFIX}.ReflectionInfo('); node.metadata.accept(_metaVisitor); - writer.print('})'); + writer.print(', const ['); + node.functionExpression.parameters.accept(_paramsVisitor); + writer.print(']))'); return null; } diff --git a/modules/angular2/test/benchmark/transform/bind_generator/simple.dart b/modules/angular2/test/benchmark/transform/bind_generator/simple.dart index 97777c5846..ce431f3714 100644 --- a/modules/angular2/test/benchmark/transform/bind_generator/simple.dart +++ b/modules/angular2/test/benchmark/transform/bind_generator/simple.dart @@ -31,12 +31,12 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(ToolTip, { - 'factory': () => new ToolTip(), - 'parameters': const [], - 'annotations': const [ + ..registerType(ToolTip, new ReflectionInfo( + const [ const Decorator( selector: '[tool-tip]', bind: const {'text': 'tool-tip'}) - ] - }); + ], + const [], + () => new ToolTip() + )); }'''; diff --git a/modules/angular2/test/benchmark/transform/directive_linker/simple.dart b/modules/angular2/test/benchmark/transform/directive_linker/simple.dart index 46db976e8c..07c1f807ad 100644 --- a/modules/angular2/test/benchmark/transform/directive_linker/simple.dart +++ b/modules/angular2/test/benchmark/transform/directive_linker/simple.dart @@ -46,11 +46,11 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(DependencyComponent, { - 'factory': () => new DependencyComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[salad]')] - }); + ..registerType(DependencyComponent, new ReflectionInfo( + const [const Component(selector: '[salad]')], + const [], + () => new DependencyComponent() + )); } '''; @@ -66,12 +66,12 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(MyComponent, { - 'factory': () => new MyComponent(), - 'parameters': const [], - 'annotations': const [ + ..registerType(MyComponent, new ReflectionInfo( + const [ const Component( selector: '[soup]', services: const [dep.DependencyComponent]) - ] - }); + ], + const [], + () => new MyComponent() + )); }'''; diff --git a/modules/angular2/test/benchmark/transform/template_compiler/inline.dart b/modules/angular2/test/benchmark/transform/template_compiler/inline.dart index da99194513..2be7c8378e 100644 --- a/modules/angular2/test/benchmark/transform/template_compiler/inline.dart +++ b/modules/angular2/test/benchmark/transform/template_compiler/inline.dart @@ -32,14 +32,14 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ + ..registerType(HelloCmp, new ReflectionInfo( + const [ const Component(selector: 'hello-app'), const Template( inline: '{{greeting}}') - ] - }); + ], + const [const []], + () => new HelloCmp() + )); } '''; diff --git a/modules/angular2/test/benchmark/transform/template_compiler/url.dart b/modules/angular2/test/benchmark/transform/template_compiler/url.dart index 681f57ab5a..1ec2ebece6 100644 --- a/modules/angular2/test/benchmark/transform/template_compiler/url.dart +++ b/modules/angular2/test/benchmark/transform/template_compiler/url.dart @@ -35,14 +35,14 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ + ..registerType(HelloCmp, new ReflectionInfo( + const [ const Component(selector: 'hello-app'), const Template(url: 'template.html') - ] - }); + ], + const [const []], + () => new HelloCmp() + )); } '''; diff --git a/modules/angular2/test/reflection/reflector_spec.ts b/modules/angular2/test/reflection/reflector_spec.ts index 227ee4f366..7e6a8d8689 100644 --- a/modules/angular2/test/reflection/reflector_spec.ts +++ b/modules/angular2/test/reflection/reflector_spec.ts @@ -1,5 +1,5 @@ import {describe, it, iit, ddescribe, expect, beforeEach, IS_DARTIUM} from 'angular2/test_lib'; -import {Reflector} from 'angular2/src/reflection/reflection'; +import {Reflector, ReflectionInfo} from 'angular2/src/reflection/reflection'; import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities'; import {ClassDecorator, ParamDecorator, classDecorator, paramDecorator} from './reflector_common'; import {List} from 'angular2/src/facade/collection'; @@ -88,7 +88,7 @@ export function main() { () => { expect(() => reflector.factory(TestObjWith21Args)).toThrowError(); }); it("should return a registered factory if available", () => { - reflector.registerType(TestObj, {"factory": () => "fake"}); + reflector.registerType(TestObj, new ReflectionInfo(null, null, () => "fake")); expect(reflector.factory(TestObj)()).toEqual("fake"); }); }); @@ -105,12 +105,12 @@ export function main() { }); it("should return registered parameters if available", () => { - reflector.registerType(TestObj, {"parameters": [1, 2]}); - expect(reflector.parameters(TestObj)).toEqual([1, 2]); + reflector.registerType(TestObj, new ReflectionInfo(null, [[1], [2]])); + expect(reflector.parameters(TestObj)).toEqual([[1], [2]]); }); it("should return an empty list when no paramters field in the stored type info", () => { - reflector.registerType(TestObj, {}); + reflector.registerType(TestObj, new ReflectionInfo()); expect(reflector.parameters(TestObj)).toEqual([]); }); }); @@ -122,7 +122,7 @@ export function main() { }); it("should return registered annotations if available", () => { - reflector.registerType(TestObj, {"annotations": [1, 2]}); + reflector.registerType(TestObj, new ReflectionInfo([1, 2])); expect(reflector.annotations(TestObj)).toEqual([1, 2]); }); diff --git a/modules/angular2/test/transform/bind_generator/basic_bind_files/bar.ng_deps.dart b/modules/angular2/test/transform/bind_generator/basic_bind_files/bar.ng_deps.dart index 17b1ad3360..8983974817 100644 --- a/modules/angular2/test/transform/bind_generator/basic_bind_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/basic_bind_files/bar.ng_deps.dart @@ -8,12 +8,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(ToolTip, { - 'factory': () => new ToolTip(), - 'parameters': const [], - 'annotations': const [ - const Directive( - selector: '[tool-tip]', properties: const ['text: tool-tip']) - ] - }); + ..registerType(ToolTip, new ReflectionInfo(const [ + const Directive( + selector: '[tool-tip]', properties: const ['text: tool-tip']) + ], const [], () => new ToolTip())); } diff --git a/modules/angular2/test/transform/bind_generator/basic_bind_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/bind_generator/basic_bind_files/expected/bar.ng_deps.dart index cc36760266..b159efdcb1 100644 --- a/modules/angular2/test/transform/bind_generator/basic_bind_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/basic_bind_files/expected/bar.ng_deps.dart @@ -8,13 +8,9 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(ToolTip, { - 'factory': () => new ToolTip(), - 'parameters': const [], - 'annotations': const [ - const Directive( - selector: '[tool-tip]', properties: const ['text: tool-tip']) - ] - }) + ..registerType(ToolTip, new ReflectionInfo(const [ + const Directive( + selector: '[tool-tip]', properties: const ['text: tool-tip']) + ], const [], () => new ToolTip())) ..registerSetters({'text': (o, v) => o.text = v}); } diff --git a/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/expected/soup.ng_deps.dart index ad00f2e2fb..fe2854c336 100644 --- a/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/expected/soup.ng_deps.dart @@ -8,19 +8,12 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(SoupComponent, { - 'factory': () => new SoupComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - componentServices: const [SaladComponent], - properties: const ['menu']) - ] - }) - ..registerType(SaladComponent, { - 'factory': () => new SaladComponent(), - 'parameters': const [], - 'annotations': const [const Component(properties: const ['menu'])] - }) + ..registerType(SoupComponent, new ReflectionInfo(const [ + const Component( + componentServices: const [SaladComponent], properties: const ['menu']) + ], const [], () => new SoupComponent())) + ..registerType(SaladComponent, new ReflectionInfo( + const [const Component(properties: const ['menu'])], const [], + () => new SaladComponent())) ..registerSetters({'menu': (o, v) => o.menu = v}); } diff --git a/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/soup.ng_deps.dart b/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/soup.ng_deps.dart index 76f45bc991..cca9f3b400 100644 --- a/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/soup.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/soup.ng_deps.dart @@ -8,18 +8,11 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(SoupComponent, { - 'factory': () => new SoupComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - componentServices: const [SaladComponent], - properties: const ['menu']) - ] - }) - ..registerType(SaladComponent, { - 'factory': () => new SaladComponent(), - 'parameters': const [], - 'annotations': const [const Component(properties: const ['menu'])] - }); + ..registerType(SoupComponent, new ReflectionInfo(const [ + const Component( + componentServices: const [SaladComponent], properties: const ['menu']) + ], const [], () => new SoupComponent())) + ..registerType(SaladComponent, new ReflectionInfo( + const [const Component(properties: const ['menu'])], const [], + () => new SaladComponent())); } diff --git a/modules/angular2/test/transform/bind_generator/events_files/bar.ng_deps.dart b/modules/angular2/test/transform/bind_generator/events_files/bar.ng_deps.dart index b3fd71ee9e..b3052f2ba2 100644 --- a/modules/angular2/test/transform/bind_generator/events_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/events_files/bar.ng_deps.dart @@ -8,12 +8,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(ToolTip, { - 'factory': () => new ToolTip(), - 'parameters': const [], - 'annotations': const [ - const Directive( - selector: '[tool-tip]', events: const ['onOpen', 'close: onClose']) - ] - }); + ..registerType(ToolTip, new ReflectionInfo(const [ + const Directive( + selector: '[tool-tip]', events: const ['onOpen', 'close: onClose']) + ], const [], () => new ToolTip())); } diff --git a/modules/angular2/test/transform/bind_generator/events_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/bind_generator/events_files/expected/bar.ng_deps.dart index 1c0c88f6c4..7a996a8879 100644 --- a/modules/angular2/test/transform/bind_generator/events_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/events_files/expected/bar.ng_deps.dart @@ -8,13 +8,9 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(ToolTip, { - 'factory': () => new ToolTip(), - 'parameters': const [], - 'annotations': const [ - const Directive( - selector: '[tool-tip]', events: const ['onOpen', 'close: onClose']) - ] - }) + ..registerType(ToolTip, new ReflectionInfo(const [ + const Directive( + selector: '[tool-tip]', events: const ['onOpen', 'close: onClose']) + ], const [], () => new ToolTip())) ..registerGetters({'onOpen': (o) => o.onOpen, 'close': (o) => o.close}); } diff --git a/modules/angular2/test/transform/deferred_rewriter/complex_deferred_example/hello.ng_deps.dart b/modules/angular2/test/transform/deferred_rewriter/complex_deferred_example/hello.ng_deps.dart index 67bb807f33..a13c43568f 100644 --- a/modules/angular2/test/transform/deferred_rewriter/complex_deferred_example/hello.ng_deps.dart +++ b/modules/angular2/test/transform/deferred_rewriter/complex_deferred_example/hello.ng_deps.dart @@ -11,14 +11,10 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - template: r'''{{greeting}}''', - templateUrl: r'package:other_package/template.html') - ] - }); + ..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View( + template: r'''{{greeting}}''', + templateUrl: r'package:other_package/template.html') + ], const [], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/deferred_rewriter/simple_deferred_example/hello.ng_deps.dart b/modules/angular2/test/transform/deferred_rewriter/simple_deferred_example/hello.ng_deps.dart index 67bb807f33..c4c5cb27b9 100644 --- a/modules/angular2/test/transform/deferred_rewriter/simple_deferred_example/hello.ng_deps.dart +++ b/modules/angular2/test/transform/deferred_rewriter/simple_deferred_example/hello.ng_deps.dart @@ -11,14 +11,10 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - template: r'''{{greeting}}''', - templateUrl: r'package:other_package/template.html') - ] - }); + ..registerType(HelloCmp, new _ngRef.RegistrationInfo(const [ + const Component(selector: 'hello-app'), + const View( + template: r'''{{greeting}}''', + templateUrl: r'package:other_package/template.html') + ], const [], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_linker/all_tests.dart b/modules/angular2/test/transform/directive_linker/all_tests.dart index e8c3e60b1e..4a3e122424 100644 --- a/modules/angular2/test/transform/directive_linker/all_tests.dart +++ b/modules/angular2/test/transform/directive_linker/all_tests.dart @@ -9,6 +9,8 @@ import '../common/read_file.dart'; var formatter = new DartFormatter(); +main() => allTests(); + void allTests() { var reader = new TestAssetReader(); diff --git a/modules/angular2/test/transform/directive_linker/simple_export_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_export_files/bar.ng_deps.dart index ebd8d60982..d348312ec7 100644 --- a/modules/angular2/test/transform/directive_linker/simple_export_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_export_files/bar.ng_deps.dart @@ -11,9 +11,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(MyComponent, { - 'factory': () => new MyComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[soup]')] - }); + ..registerType(MyComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[soup]')], const [], + () => new MyComponent())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_export_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_export_files/expected/bar.ng_deps.dart index 016ad50709..ddd1ac1551 100644 --- a/modules/angular2/test/transform/directive_linker/simple_export_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_export_files/expected/bar.ng_deps.dart @@ -12,10 +12,8 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(MyComponent, { - 'factory': () => new MyComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[soup]')] - }); + ..registerType(MyComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[soup]')], const [], + () => new MyComponent())); i0.initReflector(); } diff --git a/modules/angular2/test/transform/directive_linker/simple_export_files/expected/foo.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_export_files/expected/foo.ng_deps.dart index d2c0a6104f..fea254def4 100644 --- a/modules/angular2/test/transform/directive_linker/simple_export_files/expected/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_export_files/expected/foo.ng_deps.dart @@ -10,9 +10,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(DependencyComponent, { - 'factory': () => new DependencyComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[salad]')] - }); + ..registerType(DependencyComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[salad]')], const [], + () => new DependencyComponent())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_export_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_export_files/foo.ng_deps.dart index d2c0a6104f..fea254def4 100644 --- a/modules/angular2/test/transform/directive_linker/simple_export_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_export_files/foo.ng_deps.dart @@ -10,9 +10,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(DependencyComponent, { - 'factory': () => new DependencyComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[salad]')] - }); + ..registerType(DependencyComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[salad]')], const [], + () => new DependencyComponent())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_files/bar.ng_deps.dart index 5c802bbc9a..1eff8b1d88 100644 --- a/modules/angular2/test/transform/directive_linker/simple_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_files/bar.ng_deps.dart @@ -11,12 +11,8 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(MyComponent, { - 'factory': () => new MyComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - selector: '[soup]', viewInjector: const [dep.DependencyComponent]) - ] - }); + ..registerType(MyComponent, new ReflectionInfo(const [ + const Component( + selector: '[soup]', viewInjector: const [dep.DependencyComponent]) + ], const [], () => new MyComponent())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_files/expected/bar.ng_deps.dart index ce97f09c85..51b5bdc5d4 100644 --- a/modules/angular2/test/transform/directive_linker/simple_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_files/expected/bar.ng_deps.dart @@ -12,13 +12,9 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(MyComponent, { - 'factory': () => new MyComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - selector: '[soup]', viewInjector: const [dep.DependencyComponent]) - ] - }); + ..registerType(MyComponent, new ReflectionInfo(const [ + const Component( + selector: '[soup]', viewInjector: const [dep.DependencyComponent]) + ], const [], () => new MyComponent())); i0.initReflector(); } diff --git a/modules/angular2/test/transform/directive_linker/simple_files/expected/foo.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_files/expected/foo.ng_deps.dart index d2c0a6104f..fea254def4 100644 --- a/modules/angular2/test/transform/directive_linker/simple_files/expected/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_files/expected/foo.ng_deps.dart @@ -10,9 +10,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(DependencyComponent, { - 'factory': () => new DependencyComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[salad]')] - }); + ..registerType(DependencyComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[salad]')], const [], + () => new DependencyComponent())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_files/foo.ng_deps.dart index d2c0a6104f..fea254def4 100644 --- a/modules/angular2/test/transform/directive_linker/simple_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_files/foo.ng_deps.dart @@ -10,9 +10,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(DependencyComponent, { - 'factory': () => new DependencyComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[salad]')] - }); + ..registerType(DependencyComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[salad]')], const [], + () => new DependencyComponent())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart index 381592661d..35e9d7e9f1 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart @@ -8,9 +8,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(BarComponent, { - 'factory': () => new BarComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[bar]')] - }); + ..registerType(BarComponent, new ReflectionInfo( + const [const Component(selector: '[bar]')], const [], + () => new BarComponent())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart index 17cba130ac..b3685d751a 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart @@ -11,10 +11,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(FooComponent, { - 'factory': () => new FooComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[foo]')] - }); + ..registerType(FooComponent, new ReflectionInfo( + const [const Component(selector: '[foo]')], const [], + () => new FooComponent())); i0.initReflector(reflector); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/adjacent_strings_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/adjacent_strings_files/foo.ng_deps.dart index 3a1505dc41..54ed526021 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/adjacent_strings_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/adjacent_strings_files/foo.ng_deps.dart @@ -8,9 +8,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(FooComponent, { - 'factory': () => new FooComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[fo' 'o]')] - }); + ..registerType(FooComponent, new ReflectionInfo( + const [const Component(selector: '[fo' 'o]')], const [], + () => new FooComponent())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/all_tests.dart b/modules/angular2/test/transform/directive_metadata_extractor/all_tests.dart index 6fd07d734e..2c403e6030 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/all_tests.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/all_tests.dart @@ -16,6 +16,8 @@ import '../common/read_file.dart'; var formatter = new DartFormatter(); +main() => allTests(); + void allTests() { TestAssetReader reader = null; @@ -37,12 +39,9 @@ void allTests() { }); it('should parse compile children values', () async { - var ngDeps = await NgDeps.parse( - reader, - new AssetId( - 'a', - 'directive_metadata_extractor/' - 'directive_metadata_files/compile_children.ng_deps.dart')); + var ngDeps = await NgDeps.parse(reader, new AssetId('a', + 'directive_metadata_extractor/' + 'directive_metadata_files/compile_children.ng_deps.dart')); var it = ngDeps.registeredTypes.iterator; // Unset value defaults to `true`. @@ -125,40 +124,30 @@ void allTests() { it('should fail when a class is annotated with multiple Directives.', () async { - var ngDeps = await NgDeps.parse( - reader, - new AssetId( - 'a', - 'directive_metadata_extractor/' - 'directive_metadata_files/too_many_directives.ng_deps.dart')); - expect(() => ngDeps.registeredTypes.first.directiveMetadata) - .toThrowWith(anInstanceOf: PrintLoggerError); + var ngDeps = await NgDeps.parse(reader, new AssetId('a', + 'directive_metadata_extractor/' + 'directive_metadata_files/too_many_directives.ng_deps.dart')); + expect(() => ngDeps.registeredTypes.first.directiveMetadata).toThrowWith( + anInstanceOf: PrintLoggerError); }); }); describe('extractMetadata', () { it('should generate `DirectiveMetadata` from .ng_deps.dart files.', () async { - var extracted = await extractDirectiveMetadata( - reader, - new AssetId('a', - 'directive_metadata_extractor/simple_files/foo.ng_deps.dart')); + var extracted = await extractDirectiveMetadata(reader, new AssetId( + 'a', 'directive_metadata_extractor/simple_files/foo.ng_deps.dart')); expect(extracted.types).toContain('FooComponent'); var extractedMeta = extracted.types['FooComponent']; expect(extractedMeta.selector).toEqual('[foo]'); }); - it( - 'should generate `DirectiveMetadata` from .ng_deps.dart files that use ' - 'automatic adjacent string concatenation.', - () async { - var extracted = await extractDirectiveMetadata( - reader, - new AssetId( - 'a', - 'directive_metadata_extractor/adjacent_strings_files/' - 'foo.ng_deps.dart')); + it('should generate `DirectiveMetadata` from .ng_deps.dart files that use ' + 'automatic adjacent string concatenation.', () async { + var extracted = await extractDirectiveMetadata(reader, new AssetId('a', + 'directive_metadata_extractor/adjacent_strings_files/' + 'foo.ng_deps.dart')); expect(extracted.types).toContain('FooComponent'); var extractedMeta = extracted.types['FooComponent']; @@ -166,10 +155,8 @@ void allTests() { }); it('should include `DirectiveMetadata` from exported files.', () async { - var extracted = await extractDirectiveMetadata( - reader, - new AssetId('a', - 'directive_metadata_extractor/export_files/foo.ng_deps.dart')); + var extracted = await extractDirectiveMetadata(reader, new AssetId( + 'a', 'directive_metadata_extractor/export_files/foo.ng_deps.dart')); expect(extracted.types).toContain('FooComponent'); expect(extracted.types).toContain('BarComponent'); @@ -179,10 +166,8 @@ void allTests() { it('should include `DirectiveMetadata` recursively from exported files.', () async { - var extracted = await extractDirectiveMetadata( - reader, - new AssetId('a', - 'directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart')); + var extracted = await extractDirectiveMetadata(reader, new AssetId('a', + 'directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart')); expect(extracted.types).toContain('FooComponent'); expect(extracted.types).toContain('BarComponent'); expect(extracted.types).toContain('BazComponent'); @@ -192,19 +177,13 @@ void allTests() { expect(extracted.types['BazComponent'].selector).toEqual('[baz]'); }); - it( - 'should include `DirectiveMetadata` from exported files ' - 'expressed as absolute uris', - () async { - reader.addAsset( - new AssetId('bar', 'lib/bar.ng_deps.dart'), - readFile( - 'directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart')); + it('should include `DirectiveMetadata` from exported files ' + 'expressed as absolute uris', () async { + reader.addAsset(new AssetId('bar', 'lib/bar.ng_deps.dart'), readFile( + 'directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart')); - var extracted = await extractDirectiveMetadata( - reader, - new AssetId('a', - 'directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart')); + var extracted = await extractDirectiveMetadata(reader, new AssetId('a', + 'directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart')); expect(extracted.types).toContain('FooComponent'); expect(extracted.types).toContain('BarComponent'); @@ -213,15 +192,11 @@ void allTests() { }); it('should include directive aliases', () async { - reader.addAsset( - new AssetId('bar', 'lib/bar.ng_deps.dart'), - readFile( - 'directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart')); + reader.addAsset(new AssetId('bar', 'lib/bar.ng_deps.dart'), readFile( + 'directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart')); - var extracted = await extractDirectiveMetadata( - reader, - new AssetId('a', - 'directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart')); + var extracted = await extractDirectiveMetadata(reader, new AssetId('a', + 'directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart')); expect(extracted.aliases).toContain('alias1'); expect(extracted.aliases).toContain('alias2'); expect(extracted.aliases['alias1']).toContain('BarComponent'); diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart index 381592661d..35e9d7e9f1 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart @@ -8,9 +8,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(BarComponent, { - 'factory': () => new BarComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[bar]')] - }); + ..registerType(BarComponent, new ReflectionInfo( + const [const Component(selector: '[bar]')], const [], + () => new BarComponent())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart index 57e2c54e79..c105c71a86 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart @@ -11,10 +11,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(FooComponent, { - 'factory': () => new FooComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[foo]')] - }); + ..registerType(FooComponent, new ReflectionInfo( + const [const Component(selector: '[foo]')], const [], + () => new FooComponent())); i0.initReflector(reflector); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/changeDetection.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/changeDetection.ng_deps.dart index 694a006e26..054128c750 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/changeDetection.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/changeDetection.ng_deps.dart @@ -9,9 +9,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [const Component(changeDetection: 'CHECK_ONCE')] - }); + ..registerType(HelloCmp, new ReflectionInfo( + const [const Component(changeDetection: 'CHECK_ONCE')], + const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/compile_children.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/compile_children.ng_deps.dart index 91502ba4ad..6c473fea47 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/compile_children.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/compile_children.ng_deps.dart @@ -8,19 +8,12 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(UnsetComp, { - 'factory': () => new UnsetComp(), - 'parameters': const [const []], - 'annotations': const [const Directive()] - }) - ..registerType(FalseComp, { - 'factory': () => new FalseComp(), - 'parameters': const [const []], - 'annotations': const [const Directive(compileChildren: false)] - }) - ..registerType(TrueComp, { - 'factory': () => new TrueComp(), - 'parameters': const [const []], - 'annotations': const [const Directive(compileChildren: true)] - }); + ..registerType(UnsetComp, new ReflectionInfo( + const [const Directive()], const [const []], () => new UnsetComp())) + ..registerType(FalseComp, new ReflectionInfo( + const [const Directive(compileChildren: false)], const [const []], + () => new FalseComp())) + ..registerType(TrueComp, new ReflectionInfo( + const [const Directive(compileChildren: true)], const [const []], + () => new TrueComp())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/directive_export_as.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/directive_export_as.ng_deps.dart index 1fd202dc3e..0b09461be9 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/directive_export_as.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/directive_export_as.ng_deps.dart @@ -9,9 +9,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [const Directive(exportAs: 'exportAsName')] - }); + ..registerType(HelloCmp, new ReflectionInfo( + const [const Directive(exportAs: 'exportAsName')], const [const []], + () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/events.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/events.ng_deps.dart index eb179c27ad..a36061eee7 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/events.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/events.ng_deps.dart @@ -9,9 +9,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [const Component(events: ['onFoo', 'onBar'])] - }); + ..registerType(HelloCmp, new ReflectionInfo( + const [const Component(events: ['onFoo', 'onBar'])], const [const []], + () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/host_listeners.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/host_listeners.ng_deps.dart index bd1aba9ed1..d4368f2a59 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/host_listeners.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/host_listeners.ng_deps.dart @@ -9,17 +9,13 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component( - host: const { - '(change)': 'onChange(\$event)', - '[value]': 'value', - '@actionName': 'actionValue', - 'attName': 'attValue' - }) - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component( + host: const { + '(change)': 'onChange(\$event)', + '[value]': 'value', + '@actionName': 'actionValue', + 'attName': 'attValue' + }) + ], const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/lifecycle.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/lifecycle.ng_deps.dart index 9a94eb971c..cc79bab5af 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/lifecycle.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/lifecycle.ng_deps.dart @@ -9,18 +9,14 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component( - lifecycle: [ - LifecycleEvent.onChange, - LifecycleEvent.onDestroy, - LifecycleEvent.onInit, - LifecycleEvent.onCheck, - LifecycleEvent.onAllChangesDone - ]) - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component( + lifecycle: [ + LifecycleEvent.onChange, + LifecycleEvent.onDestroy, + LifecycleEvent.onInit, + LifecycleEvent.onCheck, + LifecycleEvent.onAllChangesDone + ]) + ], const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/properties.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/properties.ng_deps.dart index 5a0ba314cf..4447a79354 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/properties.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/properties.ng_deps.dart @@ -9,11 +9,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(properties: const ['key1: val1', 'key2: val2']) - ] - }); + ..registerType(HelloCmp, new ReflectionInfo( + const [const Component(properties: const ['key1: val1', 'key2: val2'])], + const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/selector.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/selector.ng_deps.dart index 5717c1333f..861349094f 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/selector.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/selector.ng_deps.dart @@ -9,9 +9,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [const Component(selector: 'hello-app')] - }); + ..registerType(HelloCmp, new ReflectionInfo( + const [const Component(selector: 'hello-app')], const [const []], + () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/too_many_directives.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/too_many_directives.ng_deps.dart index af276618c2..6427189b4d 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/too_many_directives.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/too_many_directives.ng_deps.dart @@ -9,12 +9,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const Component(selector: 'goodbye-app') - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const Component(selector: 'goodbye-app') + ], const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/export_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/export_files/bar.ng_deps.dart index 381592661d..35e9d7e9f1 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/export_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/export_files/bar.ng_deps.dart @@ -8,9 +8,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(BarComponent, { - 'factory': () => new BarComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[bar]')] - }); + ..registerType(BarComponent, new ReflectionInfo( + const [const Component(selector: '[bar]')], const [], + () => new BarComponent())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/export_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/export_files/foo.ng_deps.dart index 57e2c54e79..c105c71a86 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/export_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/export_files/foo.ng_deps.dart @@ -11,10 +11,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(FooComponent, { - 'factory': () => new FooComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[foo]')] - }); + ..registerType(FooComponent, new ReflectionInfo( + const [const Component(selector: '[foo]')], const [], + () => new FooComponent())); i0.initReflector(reflector); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/bar.ng_deps.dart index 6a1aade971..3cd9b210c7 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/bar.ng_deps.dart @@ -11,10 +11,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(BarComponent, { - 'factory': () => new BarComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[bar]')] - }); + ..registerType(BarComponent, new ReflectionInfo( + const [const Component(selector: '[bar]')], const [], + () => new BarComponent())); i0.initReflector(reflector); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/baz.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/baz.ng_deps.dart index 476e668ee5..d64ac31d00 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/baz.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/baz.ng_deps.dart @@ -8,9 +8,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(BazComponent, { - 'factory': () => new BazComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[baz]')] - }); + ..registerType(BazComponent, new ReflectionInfo( + const [const Component(selector: '[baz]')], const [], + () => new BazComponent())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart index 57e2c54e79..c105c71a86 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart @@ -11,10 +11,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(FooComponent, { - 'factory': () => new FooComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[foo]')] - }); + ..registerType(FooComponent, new ReflectionInfo( + const [const Component(selector: '[foo]')], const [], + () => new FooComponent())); i0.initReflector(reflector); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/simple_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/simple_files/foo.ng_deps.dart index a0fcd9b1b2..160e4371bc 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/simple_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/simple_files/foo.ng_deps.dart @@ -8,9 +8,7 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(FooComponent, { - 'factory': () => new FooComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[foo]')] - }); + ..registerType(FooComponent, new ReflectionInfo( + const [const Component(selector: '[foo]')], const [], + () => new FooComponent())); } diff --git a/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart index f5157bcfbc..685696b0a4 100644 --- a/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart @@ -11,15 +11,11 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - template: r'''{{greeting}}''', - templateUrl: r'package:other_package/template.html', - styles: const [r'''.greeting { .color: blue; }''',]) - ] - }); + ..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View( + template: r'''{{greeting}}''', + templateUrl: r'package:other_package/template.html', + styles: const [r'''.greeting { .color: blue; }''',]) + ], const [], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_processor/all_tests.dart b/modules/angular2/test/transform/directive_processor/all_tests.dart index 830e6ea151..0d59d3b05d 100644 --- a/modules/angular2/test/transform/directive_processor/all_tests.dart +++ b/modules/angular2/test/transform/directive_processor/all_tests.dart @@ -35,9 +35,9 @@ void allTests() { 'custom_metadata/relative_soup.dart', assetId: new AssetId('soup', 'lib/relative_soup.dart'), customDescriptors: [ - const ClassDescriptor('Soup', 'package:soup/annotations/soup.dart', - superClass: 'Component'), - ]); + const ClassDescriptor('Soup', 'package:soup/annotations/soup.dart', + superClass: 'Component'), + ]); _testProcessor( 'Requires the specified import.', 'custom_metadata/bad_soup.dart', @@ -50,18 +50,14 @@ void allTests() { 'should inline `templateUrl` values.', 'url_expression_files/hello.dart'); var absoluteReader = new TestAssetReader(); - absoluteReader.addAsset( - new AssetId('other_package', 'lib/template.html'), + absoluteReader.addAsset(new AssetId('other_package', 'lib/template.html'), readFile( 'directive_processor/absolute_url_expression_files/template.html')); - absoluteReader.addAsset( - new AssetId('other_package', 'lib/template.css'), + absoluteReader.addAsset(new AssetId('other_package', 'lib/template.css'), readFile( 'directive_processor/absolute_url_expression_files/template.css')); - _testProcessor( - 'should inline `templateUrl` and `styleUrls` values expressed' - ' as absolute urls.', - 'absolute_url_expression_files/hello.dart', + _testProcessor('should inline `templateUrl` and `styleUrls` values expressed' + ' as absolute urls.', 'absolute_url_expression_files/hello.dart', reader: absoluteReader); _testProcessor( @@ -72,16 +68,12 @@ void allTests() { readFile('directive_processor/multiple_style_urls_files/template.html')); absoluteReader.addAsset(new AssetId('a', 'lib/template.css'), readFile('directive_processor/multiple_style_urls_files/template.css')); - absoluteReader.addAsset( - new AssetId('a', 'lib/template_other.css'), - readFile( - 'directive_processor/multiple_style_urls_files/template_other.css')); + absoluteReader.addAsset(new AssetId('a', 'lib/template_other.css'), readFile( + 'directive_processor/multiple_style_urls_files/template_other.css')); _testProcessor( 'shouldn\'t inline multiple `styleUrls` values expressed as absolute ' - 'urls.', - 'multiple_style_urls_not_inlined_files/hello.dart', - inlineViews: false, - reader: absoluteReader); + 'urls.', 'multiple_style_urls_not_inlined_files/hello.dart', + inlineViews: false, reader: absoluteReader); _testProcessor('should inline `templateUrl`s expressed as adjacent strings.', 'split_url_expression_files/hello.dart'); @@ -126,16 +118,12 @@ void allTests() { 'static_function_files/hello.dart'); _testProcessor('should find direcive aliases patterns.', - 'directive_aliases_files/hello.dart', - reader: absoluteReader); + 'directive_aliases_files/hello.dart', reader: absoluteReader); } void _testProcessor(String name, String inputPath, - {List customDescriptors: const [], - AssetId assetId, - AssetReader reader, - List expectedLogs, - bool inlineViews: true, + {List customDescriptors: const [], AssetId assetId, + AssetReader reader, List expectedLogs, bool inlineViews: true, bool isolate: false}) { var testFn = isolate ? iit : it; testFn(name, () async { @@ -161,8 +149,7 @@ void _testProcessor(String name, String inputPath, ..addAll(customDescriptors); var ngMeta = new NgMeta.empty(); var output = await createNgDeps( - reader, inputId, annotationMatcher, ngMeta, - inlineViews: inlineViews); + reader, inputId, annotationMatcher, ngMeta, inlineViews: inlineViews); if (output == null) { expect(await reader.hasInput(expectedNgDepsId)).toBeFalse(); } else { diff --git a/modules/angular2/test/transform/directive_processor/custom_metadata/expected/package_soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/custom_metadata/expected/package_soup.ng_deps.dart index 3e753e2b7d..003aed347c 100644 --- a/modules/angular2/test/transform/directive_processor/custom_metadata/expected/package_soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/custom_metadata/expected/package_soup.ng_deps.dart @@ -10,9 +10,6 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(PackageSoup, { - 'factory': () => new PackageSoup(), - 'parameters': const [], - 'annotations': const [const Soup()] - }); + ..registerType(PackageSoup, new _ngRef.ReflectionInfo( + const [const Soup()], const [], () => new PackageSoup())); } diff --git a/modules/angular2/test/transform/directive_processor/custom_metadata/expected/relative_soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/custom_metadata/expected/relative_soup.ng_deps.dart index 787ba9e4c1..2a98e3ff41 100644 --- a/modules/angular2/test/transform/directive_processor/custom_metadata/expected/relative_soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/custom_metadata/expected/relative_soup.ng_deps.dart @@ -10,9 +10,6 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(RelativeSoup, { - 'factory': () => new RelativeSoup(), - 'parameters': const [], - 'annotations': const [const Soup()] - }); + ..registerType(RelativeSoup, new _ngRef.ReflectionInfo( + const [const Soup()], const [], () => new RelativeSoup())); } diff --git a/modules/angular2/test/transform/directive_processor/directive_aliases_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/directive_aliases_files/expected/hello.ng_deps.dart index 250990a806..903b37f845 100644 --- a/modules/angular2/test/transform/directive_processor/directive_aliases_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/directive_aliases_files/expected/hello.ng_deps.dart @@ -13,15 +13,11 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - template: r'''{{greeting}}''', - templateUrl: r'template.html', - styles: const [r'''.greeting { .color: blue; }''',]) - ] - }); + ..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View( + template: r'''{{greeting}}''', + templateUrl: r'template.html', + styles: const [r'''.greeting { .color: blue; }''',]) + ], const [], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart index 4a5fd9ebe9..2c40e0bdeb 100644 --- a/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart @@ -11,18 +11,14 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - template: r'''{{greeting}}''', - templateUrl: r'template.html', - styles: const [ - r'''.greeting { .color: blue; }''', - r'''.hello { .color: red; }''', - ]) - ] - }); + ..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View( + template: r'''{{greeting}}''', + templateUrl: r'template.html', + styles: const [ + r'''.greeting { .color: blue; }''', + r'''.hello { .color: red; }''', + ]) + ], const [], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_processor/interface_chain_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/interface_chain_files/expected/soup.ng_deps.dart index 6f50690052..e8188cd44d 100644 --- a/modules/angular2/test/transform/directive_processor/interface_chain_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/interface_chain_files/expected/soup.ng_deps.dart @@ -10,10 +10,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(ChangingSoupComponent, { - 'factory': () => new ChangingSoupComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[soup]')], - 'interfaces': const [PrimaryInterface] - }); + ..registerType(ChangingSoupComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[soup]')], const [], + () => new ChangingSoupComponent(), const [PrimaryInterface])); } diff --git a/modules/angular2/test/transform/directive_processor/interface_lifecycle_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/interface_lifecycle_files/expected/soup.ng_deps.dart index 1597243aed..47f911417a 100644 --- a/modules/angular2/test/transform/directive_processor/interface_lifecycle_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/interface_lifecycle_files/expected/soup.ng_deps.dart @@ -10,50 +10,27 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(OnChangeSoupComponent, { - 'factory': () => new OnChangeSoupComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - selector: '[soup]', lifecycle: const [LifecycleEvent.onChange]) - ], - 'interfaces': const [OnChange] - }) - ..registerType(OnDestroySoupComponent, { - 'factory': () => new OnDestroySoupComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - selector: '[soup]', lifecycle: const [LifecycleEvent.onDestroy]) - ], - 'interfaces': const [OnDestroy] - }) - ..registerType(OnCheckSoupComponent, { - 'factory': () => new OnCheckSoupComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - selector: '[soup]', lifecycle: const [LifecycleEvent.onCheck]) - ], - 'interfaces': const [OnCheck] - }) - ..registerType(OnInitSoupComponent, { - 'factory': () => new OnInitSoupComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - selector: '[soup]', lifecycle: const [LifecycleEvent.onInit]) - ], - 'interfaces': const [OnInit] - }) - ..registerType(OnAllChangesDoneSoupComponent, { - 'factory': () => new OnAllChangesDoneSoupComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - selector: '[soup]', - lifecycle: const [LifecycleEvent.onAllChangesDone]) - ], - 'interfaces': const [OnAllChangesDone] - }); + ..registerType(OnChangeSoupComponent, new _ngRef.ReflectionInfo(const [ + const Component( + selector: '[soup]', lifecycle: const [LifecycleEvent.onChange]) + ], const [], () => new OnChangeSoupComponent(), const [OnChange])) + ..registerType(OnDestroySoupComponent, new _ngRef.ReflectionInfo(const [ + const Component( + selector: '[soup]', lifecycle: const [LifecycleEvent.onDestroy]) + ], const [], () => new OnDestroySoupComponent(), const [OnDestroy])) + ..registerType(OnCheckSoupComponent, new _ngRef.ReflectionInfo(const [ + const Component( + selector: '[soup]', lifecycle: const [LifecycleEvent.onCheck]) + ], const [], () => new OnCheckSoupComponent(), const [OnCheck])) + ..registerType(OnInitSoupComponent, new _ngRef.ReflectionInfo(const [ + const Component( + selector: '[soup]', lifecycle: const [LifecycleEvent.onInit]) + ], const [], () => new OnInitSoupComponent(), const [OnInit])) + ..registerType(OnAllChangesDoneSoupComponent, new _ngRef.ReflectionInfo( + const [ + const Component( + selector: '[soup]', + lifecycle: const [LifecycleEvent.onAllChangesDone]) + ], const [], () => new OnAllChangesDoneSoupComponent(), + const [OnAllChangesDone])); } diff --git a/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart index bd781bacd4..0dc3c02caa 100644 --- a/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart @@ -10,10 +10,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(ChangingSoupComponent, { - 'factory': () => new ChangingSoupComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[soup]')], - 'interfaces': const [OnChange, AnotherInterface] - }); + ..registerType(ChangingSoupComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[soup]')], const [], + () => new ChangingSoupComponent(), const [OnChange, AnotherInterface])); } diff --git a/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart index 94d4bd04ca..a65500b8a6 100644 --- a/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart @@ -11,15 +11,11 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - template: r'''''', - templateUrl: r'/bad/absolute/url.html', - styles: const [r'''''', r'''''',]) - ] - }); + ..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View( + template: r'''''', + templateUrl: r'/bad/absolute/url.html', + styles: const [r'''''', r'''''',]) + ], const [], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_processor/multiple_interface_lifecycle_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/multiple_interface_lifecycle_files/expected/soup.ng_deps.dart index b4560a0dc6..6e0196aab4 100644 --- a/modules/angular2/test/transform/directive_processor/multiple_interface_lifecycle_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/multiple_interface_lifecycle_files/expected/soup.ng_deps.dart @@ -10,18 +10,17 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(MultiSoupComponent, { - 'factory': () => new MultiSoupComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - selector: '[soup]', - lifecycle: const [ - LifecycleEvent.onChange, - LifecycleEvent.onDestroy, - LifecycleEvent.onInit - ]) - ], - 'interfaces': const [OnChange, OnDestroy, OnInit] - }); + ..registerType(MultiSoupComponent, new _ngRef.ReflectionInfo(const [ + const Component( + selector: '[soup]', + lifecycle: const [ + LifecycleEvent.onChange, + LifecycleEvent.onDestroy, + LifecycleEvent.onInit + ]) + ], const [], () => new MultiSoupComponent(), const [ + OnChange, + OnDestroy, + OnInit + ])); } diff --git a/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart index 54b6102f9b..3671dd4d75 100644 --- a/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart @@ -11,18 +11,14 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - template: r'''{{greeting}}''', - templateUrl: r'template.html', - styles: const [ - r'''.greeting { .color: blue; }''', - r'''.hello { .color: red; }''', - ]) - ] - }); + ..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View( + template: r'''{{greeting}}''', + templateUrl: r'template.html', + styles: const [ + r'''.greeting { .color: blue; }''', + r'''.hello { .color: red; }''', + ]) + ], const [], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart index 5b0c4ea86c..a08bd4e2be 100644 --- a/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart @@ -11,17 +11,13 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - templateUrl: 'package:a/template.html', - styleUrls: const [ - 'package:a/template.css', - 'package:a/template_other.css' - ]) - ] - }); + ..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View( + templateUrl: 'package:a/template.html', + styleUrls: const [ + 'package:a/template.css', + 'package:a/template_other.css' + ]) + ], const [], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ng_deps.dart index 6bb7401c91..e9237a2569 100644 --- a/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ng_deps.dart @@ -10,10 +10,9 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(SoupComponent, { - 'factory': - (String description, salt) => new SoupComponent(description, salt), - 'parameters': const [const [String, Tasty], const [const Inject(Salt)]], - 'annotations': const [const Component(selector: '[soup]')] - }); + ..registerType(SoupComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[soup]')], const [ + const [String, Tasty], + const [const Inject(Salt)] + ], (String description, salt) => new SoupComponent(description, salt))); } diff --git a/modules/angular2/test/transform/directive_processor/prefixed_interface_lifecycle_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/prefixed_interface_lifecycle_files/expected/soup.ng_deps.dart index edf39de363..66249985ef 100644 --- a/modules/angular2/test/transform/directive_processor/prefixed_interface_lifecycle_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/prefixed_interface_lifecycle_files/expected/soup.ng_deps.dart @@ -10,14 +10,8 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(OnChangeSoupComponent, { - 'factory': () => new OnChangeSoupComponent(), - 'parameters': const [], - 'annotations': const [ - const prefix.Component( - selector: '[soup]', - lifecycle: const [prefix.LifecycleEvent.onChange]) - ], - 'interfaces': const [prefix.OnChange] - }); + ..registerType(OnChangeSoupComponent, new _ngRef.ReflectionInfo(const [ + const prefix.Component( + selector: '[soup]', lifecycle: const [prefix.LifecycleEvent.onChange]) + ], const [], () => new OnChangeSoupComponent(), const [prefix.OnChange])); } diff --git a/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart index b89a7b60db..4b2f4db32a 100644 --- a/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart @@ -11,12 +11,8 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: r'''{{greeting}}''', templateUrl: r'template.html') - ] - }); + ..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: r'''{{greeting}}''', templateUrl: r'template.html') + ], const [], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/directive_processor/static_function_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/static_function_files/expected/hello.ng_deps.dart index 007d34530d..9064a01952 100644 --- a/modules/angular2/test/transform/directive_processor/static_function_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/static_function_files/expected/hello.ng_deps.dart @@ -10,13 +10,8 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerFunction(getMessage, { - 'parameters': const [const [const Inject(Message)]], - 'annotations': const Injectable() - }) - ..registerType(Message, { - 'factory': () => new Message(), - 'parameters': const [], - 'annotations': const [const Injectable()] - }); + ..registerFunction(getMessage, new _ngRef.ReflectionInfo( + const Injectable(), const [const [const Inject(Message)]])) + ..registerType(Message, new _ngRef.ReflectionInfo( + const [const Injectable()], const [], () => new Message())); } diff --git a/modules/angular2/test/transform/directive_processor/superclass_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/superclass_files/expected/soup.ng_deps.dart index 34125bd509..5a2dec1325 100644 --- a/modules/angular2/test/transform/directive_processor/superclass_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/superclass_files/expected/soup.ng_deps.dart @@ -10,9 +10,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(ChangingSoupComponent, { - 'factory': () => new ChangingSoupComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[soup]')] - }); + ..registerType(ChangingSoupComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[soup]')], const [], + () => new ChangingSoupComponent())); } diff --git a/modules/angular2/test/transform/directive_processor/superclass_lifecycle_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/superclass_lifecycle_files/expected/soup.ng_deps.dart index 945cd1755d..94e4f6e651 100644 --- a/modules/angular2/test/transform/directive_processor/superclass_lifecycle_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/superclass_lifecycle_files/expected/soup.ng_deps.dart @@ -10,12 +10,8 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(OnChangeSoupComponent, { - 'factory': () => new OnChangeSoupComponent(), - 'parameters': const [], - 'annotations': const [ - const Component( - selector: '[soup]', lifecycle: const [LifecycleEvent.onChange]) - ] - }); + ..registerType(OnChangeSoupComponent, new _ngRef.ReflectionInfo(const [ + const Component( + selector: '[soup]', lifecycle: const [LifecycleEvent.onChange]) + ], const [], () => new OnChangeSoupComponent())); } diff --git a/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart index 3bd5020f7a..31e450d880 100644 --- a/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart @@ -11,12 +11,8 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: r'''{{greeting}}''', templateUrl: r'template.html') - ] - }); + ..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: r'''{{greeting}}''', templateUrl: r'template.html') + ], const [], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ng_deps.dart index 59761c112b..870af15e56 100644 --- a/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ng_deps.dart @@ -11,10 +11,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(MyComponent, { - 'factory': (MyContext c) => new MyComponent(c), - 'parameters': const [const [MyContext]], - 'annotations': - const [const Component(componentServices: const [MyContext])] - }); + ..registerType(MyComponent, new _ngRef.ReflectionInfo( + const [const Component(componentServices: const [MyContext])], + const [const [MyContext]], (MyContext c) => new MyComponent(c))); } diff --git a/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ng_deps.dart index 8bdc8cd32d..3eb5bc7433 100644 --- a/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ng_deps.dart @@ -10,9 +10,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(MyComponent, { - 'factory': () => new MyComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[soup]')] - }); + ..registerType(MyComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[soup]')], const [], + () => new MyComponent())); } diff --git a/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ng_deps.dart index 8bdc8cd32d..3eb5bc7433 100644 --- a/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ng_deps.dart @@ -10,9 +10,7 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(MyComponent, { - 'factory': () => new MyComponent(), - 'parameters': const [], - 'annotations': const [const Component(selector: '[soup]')] - }); + ..registerType(MyComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: '[soup]')], const [], + () => new MyComponent())); } diff --git a/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ng_deps.dart index 231a5015ee..fe52a195db 100644 --- a/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ng_deps.dart @@ -14,14 +14,10 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(MyComponent, { - 'factory': () => new MyComponent(), - 'parameters': const [], - 'annotations': const [ - const Component(selector: '[soup]'), - const View(template: 'Salad: {{myNum}} is awesome') - ] - }) + ..registerType(MyComponent, new _ngRef.ReflectionInfo(const [ + const Component(selector: '[soup]'), + const View(template: 'Salad: {{myNum}} is awesome') + ], const [], () => new MyComponent())) ..registerGetters({'myNum': (o) => o.myNum}) ..registerSetters({'myNum': (o, v) => o.myNum = v}); _gen.preGeneratedProtoDetectors['MyComponent_comp_0'] = diff --git a/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ng_deps.dart index fea73fe1d3..7ff2f9b4fc 100644 --- a/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ng_deps.dart @@ -11,10 +11,9 @@ void initReflector() { if (_visited) return; _visited = true; _ngRef.reflector - ..registerType(MyComponent, { - 'factory': - (prefix.MyContext c, String inValue) => new MyComponent(c, inValue), - 'parameters': const [const [prefix.MyContext], const [String]], - 'annotations': const [const Component(selector: 'soup')] - }); + ..registerType(MyComponent, new _ngRef.ReflectionInfo( + const [const Component(selector: 'soup')], const [ + const [prefix.MyContext], + const [String] + ], (prefix.MyContext c, String inValue) => new MyComponent(c, inValue))); } diff --git a/modules/angular2/test/transform/reflection_remover/all_tests.dart b/modules/angular2/test/transform/reflection_remover/all_tests.dart index 8934cd0df8..46b59b535d 100644 --- a/modules/angular2/test/transform/reflection_remover/all_tests.dart +++ b/modules/angular2/test/transform/reflection_remover/all_tests.dart @@ -12,6 +12,8 @@ import 'log_mirrors_files/expected/index.dart' as log_mirrors; import 'verbose_files/expected/index.dart' as verbose_mirrors; import '../common/read_file.dart'; +main() => allTests(); + void allTests() { var codegen = new Codegen('web/index.dart', ['web/index.ng_deps.dart']); var code = readFile('reflection_remover/index.dart').replaceAll('\r\n', '\n'); diff --git a/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello1.ng_deps.dart b/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello1.ng_deps.dart index 3498b23d83..35960e0ab7 100644 --- a/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello1.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello1.ng_deps.dart @@ -9,20 +9,12 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: 'goodbye-app', directives: const [alias1]) - ] - }) - ..registerType(GoodbyeCmp, { - 'factory': () => new GoodbyeCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'goodbye-app'), - const View(template: 'Goodbye') - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: 'goodbye-app', directives: const [alias1]) + ], const [const []], () => new HelloCmp())) + ..registerType(GoodbyeCmp, new ReflectionInfo(const [ + const Component(selector: 'goodbye-app'), + const View(template: 'Goodbye') + ], const [const []], () => new GoodbyeCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello2.ng_deps.dart b/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello2.ng_deps.dart index 4b53eab40b..79f7148de1 100644 --- a/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello2.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello2.ng_deps.dart @@ -9,20 +9,12 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: 'goodbye-app', directives: const [GoodbyeCmp]) - ] - }) - ..registerType(GoodbyeCmp, { - 'factory': () => new GoodbyeCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'goodbye-app'), - const View(template: 'Goodbye') - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: 'goodbye-app', directives: const [GoodbyeCmp]) + ], const [const []], () => new HelloCmp())) + ..registerType(GoodbyeCmp, new ReflectionInfo(const [ + const Component(selector: 'goodbye-app'), + const View(template: 'Goodbye') + ], const [const []], () => new GoodbyeCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/duplicate_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/duplicate_files/expected/hello.ng_deps.dart index d25e1967c8..fbbf90f53d 100644 --- a/modules/angular2/test/transform/template_compiler/duplicate_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/duplicate_files/expected/hello.ng_deps.dart @@ -9,14 +9,10 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: '{{greeting}}, {{greeting}}') - ] - }) + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: '{{greeting}}, {{greeting}}') + ], const [const []], () => new HelloCmp())) ..registerGetters({'greeting': (o) => o.greeting}) ..registerSetters({'greeting': (o, v) => o.greeting = v}); } diff --git a/modules/angular2/test/transform/template_compiler/duplicate_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/duplicate_files/hello.ng_deps.dart index 84c5d26437..6de58b238b 100644 --- a/modules/angular2/test/transform/template_compiler/duplicate_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/duplicate_files/hello.ng_deps.dart @@ -9,12 +9,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: '{{greeting}}, {{greeting}}') - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: '{{greeting}}, {{greeting}}') + ], const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart index b658094f60..98805de3d4 100644 --- a/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart @@ -9,14 +9,10 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: '
{{greeting}}
') - ] - }) + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: '
{{greeting}}
') + ], const [const []], () => new HelloCmp())) ..registerGetters({'b': (o) => o.b, 'greeting': (o) => o.greeting}) ..registerSetters( {'b': (o, v) => o.b = v, 'greeting': (o, v) => o.greeting = v}); diff --git a/modules/angular2/test/transform/template_compiler/inline_expression_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/inline_expression_files/hello.ng_deps.dart index b8bb3009ec..ac62a8fa2b 100644 --- a/modules/angular2/test/transform/template_compiler/inline_expression_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/inline_expression_files/hello.ng_deps.dart @@ -9,12 +9,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: '
{{greeting}}
') - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: '
{{greeting}}
') + ], const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/inline_method_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/inline_method_files/expected/hello.ng_deps.dart index 4198ed1bec..9a1cb0f270 100644 --- a/modules/angular2/test/transform/template_compiler/inline_method_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/inline_method_files/expected/hello.ng_deps.dart @@ -9,14 +9,10 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: '') - ] - }) + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: '') + ], const [const []], () => new HelloCmp())) ..registerMethods( {'action': (o, List args) => Function.apply(o.action, args)}); } diff --git a/modules/angular2/test/transform/template_compiler/inline_method_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/inline_method_files/hello.ng_deps.dart index d01ea1f4bf..0422745a25 100644 --- a/modules/angular2/test/transform/template_compiler/inline_method_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/inline_method_files/hello.ng_deps.dart @@ -9,12 +9,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: '') - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: '') + ], const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/ng_for_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/ng_for_files/hello.ng_deps.dart index 8a2bbe0443..287c714995 100644 --- a/modules/angular2/test/transform/template_compiler/ng_for_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/ng_for_files/hello.ng_deps.dart @@ -9,14 +9,10 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - template: '
  • test
  • ', - directives: const [NgFor]) - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View( + template: '
  • test
  • ', + directives: const [NgFor]) + ], const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/one_directive_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/one_directive_files/expected/hello.ng_deps.dart index 60dff279e1..8932494359 100644 --- a/modules/angular2/test/transform/template_compiler/one_directive_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/one_directive_files/expected/hello.ng_deps.dart @@ -9,20 +9,12 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: 'goodbye-app', directives: const [GoodbyeCmp]) - ] - }) - ..registerType(GoodbyeCmp, { - 'factory': () => new GoodbyeCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'goodbye-app'), - const View(template: 'Goodbye') - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: 'goodbye-app', directives: const [GoodbyeCmp]) + ], const [const []], () => new HelloCmp())) + ..registerType(GoodbyeCmp, new ReflectionInfo(const [ + const Component(selector: 'goodbye-app'), + const View(template: 'Goodbye') + ], const [const []], () => new GoodbyeCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/one_directive_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/one_directive_files/hello.ng_deps.dart index 60dff279e1..8932494359 100644 --- a/modules/angular2/test/transform/template_compiler/one_directive_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/one_directive_files/hello.ng_deps.dart @@ -9,20 +9,12 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(template: 'goodbye-app', directives: const [GoodbyeCmp]) - ] - }) - ..registerType(GoodbyeCmp, { - 'factory': () => new GoodbyeCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'goodbye-app'), - const View(template: 'Goodbye') - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: 'goodbye-app', directives: const [GoodbyeCmp]) + ], const [const []], () => new HelloCmp())) + ..registerType(GoodbyeCmp, new ReflectionInfo(const [ + const Component(selector: 'goodbye-app'), + const View(template: 'Goodbye') + ], const [const []], () => new GoodbyeCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/url_expression_files/expected/hello.ng_deps.dart index 446954cbcf..e788a6e937 100644 --- a/modules/angular2/test/transform/template_compiler/url_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/url_expression_files/expected/hello.ng_deps.dart @@ -9,14 +9,10 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(templateUrl: 'template.html') - ] - }) + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(templateUrl: 'template.html') + ], const [const []], () => new HelloCmp())) ..registerGetters({'greeting': (o) => o.greeting}) ..registerSetters({'greeting': (o, v) => o.greeting = v}); } diff --git a/modules/angular2/test/transform/template_compiler/url_expression_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/url_expression_files/hello.ng_deps.dart index 306f3bc732..4d8fb2df6b 100644 --- a/modules/angular2/test/transform/template_compiler/url_expression_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/url_expression_files/hello.ng_deps.dart @@ -9,12 +9,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(templateUrl: 'template.html') - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(templateUrl: 'template.html') + ], const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/url_method_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/url_method_files/expected/hello.ng_deps.dart index 16fbd53c07..7b0af555b6 100644 --- a/modules/angular2/test/transform/template_compiler/url_method_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/url_method_files/expected/hello.ng_deps.dart @@ -9,14 +9,10 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(templateUrl: 'template.html') - ] - }) + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(templateUrl: 'template.html') + ], const [const []], () => new HelloCmp())) ..registerMethods( {'action': (o, List args) => Function.apply(o.action, args)}); } diff --git a/modules/angular2/test/transform/template_compiler/url_method_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/url_method_files/hello.ng_deps.dart index 306f3bc732..4d8fb2df6b 100644 --- a/modules/angular2/test/transform/template_compiler/url_method_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/url_method_files/hello.ng_deps.dart @@ -9,12 +9,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View(templateUrl: 'template.html') - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(templateUrl: 'template.html') + ], const [const []], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/goodbye.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/goodbye.ng_deps.dart index f8c8fea025..530d6d039e 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/goodbye.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/goodbye.ng_deps.dart @@ -9,14 +9,10 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(GoodbyeCmp, { - 'factory': () => new GoodbyeCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'goodbye-app'), - const View(template: 'Goodbye {{name}}') - ] - }) + ..registerType(GoodbyeCmp, new ReflectionInfo(const [ + const Component(selector: 'goodbye-app'), + const View(template: 'Goodbye {{name}}') + ], const [const []], () => new GoodbyeCmp())) ..registerGetters({'name': (o) => o.name}) ..registerSetters({'name': (o, v) => o.name = v}); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/hello.ng_deps.dart index 836f2a4aa3..8b6a5dfc44 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/hello.ng_deps.dart @@ -11,14 +11,9 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - template: 'goodbye-app', directives: const [prefix.GoodbyeCmp]) - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: 'goodbye-app', directives: const [prefix.GoodbyeCmp]) + ], const [const []], () => new HelloCmp())); i0.initReflector(reflector); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/ng2_prefix.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/ng2_prefix.ng_deps.dart index 67b0c7ad31..f1d4f3c913 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/ng2_prefix.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/ng2_prefix.ng_deps.dart @@ -9,14 +9,10 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(MyApp, { - 'factory': () => new MyApp(), - 'parameters': const [const []], - 'annotations': const [ - const ng2.Component(selector: 'my-app'), - const ng2.View(template: 'MyApp {{name}}') - ] - }) + ..registerType(MyApp, new ReflectionInfo(const [ + const ng2.Component(selector: 'my-app'), + const ng2.View(template: 'MyApp {{name}}') + ], const [const []], () => new MyApp())) ..registerGetters({'name': (o) => o.name}) ..registerSetters({'name': (o, v) => o.name = v}); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/goodbye.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/goodbye.ng_deps.dart index 8818fa072c..c72b2dce9b 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/goodbye.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/goodbye.ng_deps.dart @@ -9,12 +9,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(GoodbyeCmp, { - 'factory': () => new GoodbyeCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'goodbye-app'), - const View(template: 'Goodbye {{name}}') - ] - }); + ..registerType(GoodbyeCmp, new ReflectionInfo(const [ + const Component(selector: 'goodbye-app'), + const View(template: 'Goodbye {{name}}') + ], const [const []], () => new GoodbyeCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/hello.ng_deps.dart index 836f2a4aa3..8b6a5dfc44 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/hello.ng_deps.dart @@ -11,14 +11,9 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(HelloCmp, { - 'factory': () => new HelloCmp(), - 'parameters': const [const []], - 'annotations': const [ - const Component(selector: 'hello-app'), - const View( - template: 'goodbye-app', directives: const [prefix.GoodbyeCmp]) - ] - }); + ..registerType(HelloCmp, new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: 'goodbye-app', directives: const [prefix.GoodbyeCmp]) + ], const [const []], () => new HelloCmp())); i0.initReflector(reflector); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/ng2_prefix.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/ng2_prefix.ng_deps.dart index 25a7bf7e4c..4e1bbe8aa8 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/ng2_prefix.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/ng2_prefix.ng_deps.dart @@ -9,12 +9,8 @@ void initReflector(reflector) { if (_visited) return; _visited = true; reflector - ..registerType(MyApp, { - 'factory': () => new MyApp(), - 'parameters': const [const []], - 'annotations': const [ - const ng2.Component(selector: 'my-app'), - const ng2.View(template: 'MyApp {{name}}') - ] - }); + ..registerType(MyApp, new ReflectionInfo(const [ + const ng2.Component(selector: 'my-app'), + const ng2.View(template: 'MyApp {{name}}') + ], const [const []], () => new MyApp())); }