chore(transformer): Use class for reflection info instead of a map

closes https://github.com/angular/angular/issues/906
This commit is contained in:
Jacob MacDonald
2015-07-23 15:18:30 -07:00
parent a8b75c3d41
commit 5b5de6662f
95 changed files with 550 additions and 890 deletions
@@ -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()));
}
@@ -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});
}
@@ -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});
}
@@ -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()));
}
@@ -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()));
}
@@ -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});
}
@@ -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()));
}
@@ -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()));
}
@@ -9,6 +9,8 @@ import '../common/read_file.dart';
var formatter = new DartFormatter();
main() => allTests();
void allTests() {
var reader = new TestAssetReader();
@@ -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()));
}
@@ -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();
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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();
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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);
}
@@ -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()));
}
@@ -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');
@@ -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()));
}
@@ -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);
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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);
}
@@ -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);
}
@@ -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()));
}
@@ -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);
}
@@ -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()));
}
@@ -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()));
}
@@ -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<AnnotationDescriptor> customDescriptors: const [],
AssetId assetId,
AssetReader reader,
List<String> expectedLogs,
bool inlineViews: true,
{List<AnnotationDescriptor> customDescriptors: const [], AssetId assetId,
AssetReader reader, List<String> 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 {
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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]));
}
@@ -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]));
}
@@ -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]));
}
@@ -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()));
}
@@ -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
]));
}
@@ -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()));
}
@@ -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()));
}
@@ -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)));
}
@@ -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]));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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)));
}
@@ -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()));
}
@@ -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()));
}
@@ -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'] =
@@ -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)));
}
@@ -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');
@@ -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()));
}
@@ -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()));
}
@@ -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});
}
@@ -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()));
}
@@ -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: '<div [a]="b">{{greeting}}</div>')
]
})
..registerType(HelloCmp, new ReflectionInfo(const [
const Component(selector: 'hello-app'),
const View(template: '<div [a]="b">{{greeting}}</div>')
], 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});
@@ -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: '<div [a]="b">{{greeting}}</div>')
]
});
..registerType(HelloCmp, new ReflectionInfo(const [
const Component(selector: 'hello-app'),
const View(template: '<div [a]="b">{{greeting}}</div>')
], const [const []], () => new HelloCmp()));
}
@@ -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: '<button (click)=\"action()\">go</button>')
]
})
..registerType(HelloCmp, new ReflectionInfo(const [
const Component(selector: 'hello-app'),
const View(template: '<button (click)=\"action()\">go</button>')
], const [const []], () => new HelloCmp()))
..registerMethods(
{'action': (o, List args) => Function.apply(o.action, args)});
}
@@ -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: '<button (click)=\"action()\">go</button>')
]
});
..registerType(HelloCmp, new ReflectionInfo(const [
const Component(selector: 'hello-app'),
const View(template: '<button (click)=\"action()\">go</button>')
], const [const []], () => new HelloCmp()));
}
@@ -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: '<li *ng-for="#thing of things"><div>test</div></li>',
directives: const [NgFor])
]
});
..registerType(HelloCmp, new ReflectionInfo(const [
const Component(selector: 'hello-app'),
const View(
template: '<li *ng-for="#thing of things"><div>test</div></li>',
directives: const [NgFor])
], const [const []], () => new HelloCmp()));
}
@@ -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()));
}
@@ -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()));
}
@@ -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});
}
@@ -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()));
}
@@ -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)});
}
@@ -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()));
}
@@ -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});
}
@@ -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);
}
@@ -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});
}
@@ -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()));
}
@@ -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);
}
@@ -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()));
}