style(dart): Format with dartfmt v0.2.0
Format all pure Dart code with package:dart_style v0.2.0 Command: ``` find -type f -name "*.dart" | xargs dartformat -w ```
This commit is contained in:
@@ -25,7 +25,8 @@ void allTests() {
|
||||
expect(output).toEqual(expected);
|
||||
});
|
||||
|
||||
it('should generate a single setter when multiple annotations bind to the '
|
||||
it(
|
||||
'should generate a single setter when multiple annotations bind to the '
|
||||
'same property.', () async {
|
||||
var inputPath =
|
||||
'bind_generator/duplicate_bind_name_files/soup.ng_deps.dart';
|
||||
|
||||
@@ -8,8 +8,10 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(ToolTip, new ReflectionInfo(const [
|
||||
const Directive(
|
||||
selector: '[tool-tip]', properties: const ['text: tool-tip'])
|
||||
], const [], () => new ToolTip()));
|
||||
..registerType(
|
||||
ToolTip,
|
||||
new ReflectionInfo(const [
|
||||
const Directive(
|
||||
selector: '[tool-tip]', properties: const ['text: tool-tip'])
|
||||
], const [], () => new ToolTip()));
|
||||
}
|
||||
|
||||
+6
-4
@@ -8,9 +8,11 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(ToolTip, new ReflectionInfo(const [
|
||||
const Directive(
|
||||
selector: '[tool-tip]', properties: const ['text: tool-tip'])
|
||||
], const [], () => new ToolTip()))
|
||||
..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});
|
||||
}
|
||||
|
||||
+12
-7
@@ -8,12 +8,17 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..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()))
|
||||
..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});
|
||||
}
|
||||
|
||||
+12
-7
@@ -8,11 +8,16 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..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()));
|
||||
..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,8 +8,11 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(ToolTip, new ReflectionInfo(const [
|
||||
const Directive(
|
||||
selector: '[tool-tip]', events: const ['onOpen', 'close: onClose'])
|
||||
], const [], () => new ToolTip()));
|
||||
..registerType(
|
||||
ToolTip,
|
||||
new ReflectionInfo(const [
|
||||
const Directive(
|
||||
selector: '[tool-tip]',
|
||||
events: const ['onOpen', 'close: onClose'])
|
||||
], const [], () => new ToolTip()));
|
||||
}
|
||||
|
||||
+7
-4
@@ -8,9 +8,12 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(ToolTip, new ReflectionInfo(const [
|
||||
const Directive(
|
||||
selector: '[tool-tip]', events: const ['onOpen', 'close: onClose'])
|
||||
], const [], () => new ToolTip()))
|
||||
..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});
|
||||
}
|
||||
|
||||
@@ -79,7 +79,8 @@ void allTests() {
|
||||
return Future.wait([f1, f2]);
|
||||
});
|
||||
|
||||
it('should handle calls to async methods that complete in reverse '
|
||||
it(
|
||||
'should handle calls to async methods that complete in reverse '
|
||||
'order while waiting.', () {
|
||||
var completer1 = new Completer<String>();
|
||||
var completer2 = new Completer<String>();
|
||||
|
||||
+8
-6
@@ -11,10 +11,12 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+8
-6
@@ -11,10 +11,12 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -11,7 +11,8 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(MyComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[soup]')], const [],
|
||||
() => new MyComponent()));
|
||||
..registerType(
|
||||
MyComponent,
|
||||
new _ngRef.ReflectionInfo(const [const Component(selector: '[soup]')],
|
||||
const [], () => new MyComponent()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -12,8 +12,9 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(MyComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[soup]')], const [],
|
||||
() => new MyComponent()));
|
||||
..registerType(
|
||||
MyComponent,
|
||||
new _ngRef.ReflectionInfo(const [const Component(selector: '[soup]')],
|
||||
const [], () => new MyComponent()));
|
||||
i0.initReflector();
|
||||
}
|
||||
|
||||
+4
-3
@@ -10,7 +10,8 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(DependencyComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[salad]')], const [],
|
||||
() => new DependencyComponent()));
|
||||
..registerType(
|
||||
DependencyComponent,
|
||||
new _ngRef.ReflectionInfo(const [const Component(selector: '[salad]')],
|
||||
const [], () => new DependencyComponent()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -10,7 +10,8 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(DependencyComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[salad]')], const [],
|
||||
() => new DependencyComponent()));
|
||||
..registerType(
|
||||
DependencyComponent,
|
||||
new _ngRef.ReflectionInfo(const [const Component(selector: '[salad]')],
|
||||
const [], () => new DependencyComponent()));
|
||||
}
|
||||
|
||||
@@ -11,8 +11,10 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(MyComponent, new ReflectionInfo(const [
|
||||
const Component(
|
||||
selector: '[soup]', viewBindings: const [dep.DependencyComponent])
|
||||
], const [], () => new MyComponent()));
|
||||
..registerType(
|
||||
MyComponent,
|
||||
new ReflectionInfo(const [
|
||||
const Component(
|
||||
selector: '[soup]', viewBindings: const [dep.DependencyComponent])
|
||||
], const [], () => new MyComponent()));
|
||||
}
|
||||
|
||||
+6
-4
@@ -12,9 +12,11 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(MyComponent, new ReflectionInfo(const [
|
||||
const Component(
|
||||
selector: '[soup]', viewBindings: const [dep.DependencyComponent])
|
||||
], const [], () => new MyComponent()));
|
||||
..registerType(
|
||||
MyComponent,
|
||||
new ReflectionInfo(const [
|
||||
const Component(
|
||||
selector: '[soup]', viewBindings: const [dep.DependencyComponent])
|
||||
], const [], () => new MyComponent()));
|
||||
i0.initReflector();
|
||||
}
|
||||
|
||||
+4
-3
@@ -10,7 +10,8 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(DependencyComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[salad]')], const [],
|
||||
() => new DependencyComponent()));
|
||||
..registerType(
|
||||
DependencyComponent,
|
||||
new _ngRef.ReflectionInfo(const [const Component(selector: '[salad]')],
|
||||
const [], () => new DependencyComponent()));
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(DependencyComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[salad]')], const [],
|
||||
() => new DependencyComponent()));
|
||||
..registerType(
|
||||
DependencyComponent,
|
||||
new _ngRef.ReflectionInfo(const [const Component(selector: '[salad]')],
|
||||
const [], () => new DependencyComponent()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(BarComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[bar]')], const [],
|
||||
() => new BarComponent()));
|
||||
..registerType(
|
||||
BarComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[bar]')], const [],
|
||||
() => new BarComponent()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -11,8 +11,9 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(FooComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[foo]')], const [],
|
||||
() => new FooComponent()));
|
||||
..registerType(
|
||||
FooComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[foo]')], const [],
|
||||
() => new FooComponent()));
|
||||
i0.initReflector(reflector);
|
||||
}
|
||||
|
||||
+4
-3
@@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(FooComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[fo' 'o]')], const [],
|
||||
() => new FooComponent()));
|
||||
..registerType(
|
||||
FooComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[fo' 'o]')],
|
||||
const [], () => new FooComponent()));
|
||||
}
|
||||
|
||||
@@ -39,9 +39,12 @@ 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`.
|
||||
@@ -124,30 +127,39 @@ 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 '
|
||||
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'));
|
||||
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'];
|
||||
@@ -155,8 +167,10 @@ 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');
|
||||
|
||||
@@ -166,8 +180,10 @@ 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');
|
||||
@@ -177,13 +193,18 @@ void allTests() {
|
||||
expect(extracted.types['BazComponent'].selector).toEqual('[baz]');
|
||||
});
|
||||
|
||||
it('should include `DirectiveMetadata` from exported files '
|
||||
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'));
|
||||
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');
|
||||
|
||||
@@ -192,11 +213,15 @@ 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');
|
||||
|
||||
+4
-3
@@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(BarComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[bar]')], const [],
|
||||
() => new BarComponent()));
|
||||
..registerType(
|
||||
BarComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[bar]')], const [],
|
||||
() => new BarComponent()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -11,8 +11,9 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(FooComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[foo]')], const [],
|
||||
() => new FooComponent()));
|
||||
..registerType(
|
||||
FooComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[foo]')], const [],
|
||||
() => new FooComponent()));
|
||||
i0.initReflector(reflector);
|
||||
}
|
||||
|
||||
+6
-3
@@ -9,7 +9,10 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(
|
||||
const [const Component(changeDetection: 'CHECK_ONCE')],
|
||||
const [const []], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(
|
||||
const [const Component(changeDetection: 'CHECK_ONCE')],
|
||||
const [const []],
|
||||
() => new HelloCmp()));
|
||||
}
|
||||
|
||||
+12
-8
@@ -8,12 +8,16 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -9,7 +9,8 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(
|
||||
const [const Directive(exportAs: 'exportAsName')], const [const []],
|
||||
() => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [const Directive(exportAs: 'exportAsName')],
|
||||
const [const []], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+7
-3
@@ -9,7 +9,11 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(
|
||||
const [const Component(events: ['onFoo', 'onBar'])], const [const []],
|
||||
() => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(events: ['onFoo', 'onBar'])
|
||||
], const [
|
||||
const []
|
||||
], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+12
-9
@@ -9,13 +9,16 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(
|
||||
host: const {
|
||||
'(change)': 'onChange(\$event)',
|
||||
'[value]': 'value',
|
||||
'@actionName': 'actionValue',
|
||||
'attName': 'attValue'
|
||||
})
|
||||
], const [const []], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(host: const {
|
||||
'(change)': 'onChange(\$event)',
|
||||
'[value]': 'value',
|
||||
'@actionName': 'actionValue',
|
||||
'attName': 'attValue'
|
||||
})
|
||||
], const [
|
||||
const []
|
||||
], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+13
-10
@@ -9,14 +9,17 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(
|
||||
lifecycle: [
|
||||
LifecycleEvent.onChange,
|
||||
LifecycleEvent.onDestroy,
|
||||
LifecycleEvent.onInit,
|
||||
LifecycleEvent.onCheck,
|
||||
LifecycleEvent.onAllChangesDone
|
||||
])
|
||||
], const [const []], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(lifecycle: [
|
||||
LifecycleEvent.onChange,
|
||||
LifecycleEvent.onDestroy,
|
||||
LifecycleEvent.onInit,
|
||||
LifecycleEvent.onCheck,
|
||||
LifecycleEvent.onAllChangesDone
|
||||
])
|
||||
], const [
|
||||
const []
|
||||
], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+7
-3
@@ -9,7 +9,11 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(
|
||||
const [const Component(properties: const ['key1: val1', 'key2: val2'])],
|
||||
const [const []], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(properties: const ['key1: val1', 'key2: val2'])
|
||||
], const [
|
||||
const []
|
||||
], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -9,7 +9,8 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(
|
||||
const [const Component(selector: 'hello-app')], const [const []],
|
||||
() => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [const Component(selector: 'hello-app')],
|
||||
const [const []], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,8 +9,12 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const Component(selector: 'goodbye-app')
|
||||
], const [const []], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const Component(selector: 'goodbye-app')
|
||||
], const [
|
||||
const []
|
||||
], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(BarComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[bar]')], const [],
|
||||
() => new BarComponent()));
|
||||
..registerType(
|
||||
BarComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[bar]')], const [],
|
||||
() => new BarComponent()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -11,8 +11,9 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(FooComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[foo]')], const [],
|
||||
() => new FooComponent()));
|
||||
..registerType(
|
||||
FooComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[foo]')], const [],
|
||||
() => new FooComponent()));
|
||||
i0.initReflector(reflector);
|
||||
}
|
||||
|
||||
+4
-3
@@ -11,8 +11,9 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(BarComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[bar]')], const [],
|
||||
() => new BarComponent()));
|
||||
..registerType(
|
||||
BarComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[bar]')], const [],
|
||||
() => new BarComponent()));
|
||||
i0.initReflector(reflector);
|
||||
}
|
||||
|
||||
+4
-3
@@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(BazComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[baz]')], const [],
|
||||
() => new BazComponent()));
|
||||
..registerType(
|
||||
BazComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[baz]')], const [],
|
||||
() => new BazComponent()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -11,8 +11,9 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(FooComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[foo]')], const [],
|
||||
() => new FooComponent()));
|
||||
..registerType(
|
||||
FooComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[foo]')], const [],
|
||||
() => new FooComponent()));
|
||||
i0.initReflector(reflector);
|
||||
}
|
||||
|
||||
+4
-3
@@ -8,7 +8,8 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(FooComponent, new ReflectionInfo(
|
||||
const [const Component(selector: '[foo]')], const [],
|
||||
() => new FooComponent()));
|
||||
..registerType(
|
||||
FooComponent,
|
||||
new ReflectionInfo(const [const Component(selector: '[foo]')], const [],
|
||||
() => new FooComponent()));
|
||||
}
|
||||
|
||||
+9
-7
@@ -11,13 +11,15 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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()))
|
||||
..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()))
|
||||
..registerFunction(
|
||||
hello, new _ngRef.ReflectionInfo(const [const Injectable()], const []));
|
||||
}
|
||||
|
||||
@@ -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,14 +50,18 @@ 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(
|
||||
@@ -68,12 +72,16 @@ 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');
|
||||
@@ -118,12 +126,16 @@ 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 {
|
||||
@@ -149,7 +161,8 @@ 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 {
|
||||
|
||||
+4
-2
@@ -10,6 +10,8 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(PackageSoup, new _ngRef.ReflectionInfo(
|
||||
const [const Soup()], const [], () => new PackageSoup()));
|
||||
..registerType(
|
||||
PackageSoup,
|
||||
new _ngRef.ReflectionInfo(
|
||||
const [const Soup()], const [], () => new PackageSoup()));
|
||||
}
|
||||
|
||||
+4
-2
@@ -10,6 +10,8 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(RelativeSoup, new _ngRef.ReflectionInfo(
|
||||
const [const Soup()], const [], () => new RelativeSoup()));
|
||||
..registerType(
|
||||
RelativeSoup,
|
||||
new _ngRef.ReflectionInfo(
|
||||
const [const Soup()], const [], () => new RelativeSoup()));
|
||||
}
|
||||
|
||||
+9
-7
@@ -13,11 +13,13 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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()));
|
||||
..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,14 +11,16 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+7
-3
@@ -10,7 +10,11 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(ChangingSoupComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[soup]')], const [],
|
||||
() => new ChangingSoupComponent(), const [PrimaryInterface]));
|
||||
..registerType(
|
||||
ChangingSoupComponent,
|
||||
new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[soup]')],
|
||||
const [],
|
||||
() => new ChangingSoupComponent(),
|
||||
const [PrimaryInterface]));
|
||||
}
|
||||
|
||||
+53
-23
@@ -10,27 +10,57 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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]));
|
||||
..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]));
|
||||
}
|
||||
|
||||
+7
-3
@@ -10,7 +10,11 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(ChangingSoupComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[soup]')], const [],
|
||||
() => new ChangingSoupComponent(), const [OnChange, AnotherInterface]));
|
||||
..registerType(
|
||||
ChangingSoupComponent,
|
||||
new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[soup]')],
|
||||
const [],
|
||||
() => new ChangingSoupComponent(),
|
||||
const [OnChange, AnotherInterface]));
|
||||
}
|
||||
|
||||
+9
-7
@@ -11,11 +11,13 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+40
-22
@@ -10,26 +10,44 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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
|
||||
]))
|
||||
..registerType(MixedSoupComponent, new _ngRef.ReflectionInfo(const [
|
||||
const Component(
|
||||
selector: '[soup]',
|
||||
lifecycle: const [LifecycleEvent.onChange, LifecycleEvent.onCheck])
|
||||
], const [], () => new MixedSoupComponent(), const [OnChange]))
|
||||
..registerType(MatchedSoupComponent, new _ngRef.ReflectionInfo(const [
|
||||
const Component(
|
||||
selector: '[soup]', lifecycle: const [LifecycleEvent.onChange])
|
||||
], const [], () => new MatchedSoupComponent(), const [OnChange]));
|
||||
..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]))
|
||||
..registerType(
|
||||
MixedSoupComponent,
|
||||
new _ngRef.ReflectionInfo(
|
||||
const [
|
||||
const Component(
|
||||
selector: '[soup]',
|
||||
lifecycle: const [
|
||||
LifecycleEvent.onChange,
|
||||
LifecycleEvent.onCheck
|
||||
])
|
||||
],
|
||||
const [],
|
||||
() => new MixedSoupComponent(),
|
||||
const [OnChange]))
|
||||
..registerType(
|
||||
MatchedSoupComponent,
|
||||
new _ngRef.ReflectionInfo(
|
||||
const [
|
||||
const Component(
|
||||
selector: '[soup]',
|
||||
lifecycle: const [LifecycleEvent.onChange])
|
||||
],
|
||||
const [],
|
||||
() => new MatchedSoupComponent(),
|
||||
const [OnChange]));
|
||||
}
|
||||
|
||||
+12
-10
@@ -11,14 +11,16 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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()));
|
||||
..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
-9
@@ -11,13 +11,15 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+8
-5
@@ -10,9 +10,12 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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)));
|
||||
..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)));
|
||||
}
|
||||
|
||||
+11
-4
@@ -10,8 +10,15 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(OnChangeSoupComponent, new _ngRef.ReflectionInfo(const [
|
||||
const prefix.Component(
|
||||
selector: '[soup]', lifecycle: const [prefix.LifecycleEvent.onChange])
|
||||
], const [], () => new OnChangeSoupComponent(), 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]));
|
||||
}
|
||||
|
||||
+7
-4
@@ -11,8 +11,11 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: r'''{{greeting}}''', templateUrl: r'template.html')
|
||||
], const [], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new _ngRef.ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(
|
||||
template: r'''{{greeting}}''', templateUrl: r'template.html')
|
||||
], const [], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+11
-4
@@ -10,8 +10,15 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerFunction(getMessage, new _ngRef.ReflectionInfo(
|
||||
const [const Injectable()], const [const [const Inject(Message)]]))
|
||||
..registerType(Message, new _ngRef.ReflectionInfo(
|
||||
const [const Injectable()], const [], () => new Message()));
|
||||
..registerFunction(
|
||||
getMessage,
|
||||
new _ngRef.ReflectionInfo(const [
|
||||
const Injectable()
|
||||
], const [
|
||||
const [const Inject(Message)]
|
||||
]))
|
||||
..registerType(
|
||||
Message,
|
||||
new _ngRef.ReflectionInfo(
|
||||
const [const Injectable()], const [], () => new Message()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -10,7 +10,8 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(ChangingSoupComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[soup]')], const [],
|
||||
() => new ChangingSoupComponent()));
|
||||
..registerType(
|
||||
ChangingSoupComponent,
|
||||
new _ngRef.ReflectionInfo(const [const Component(selector: '[soup]')],
|
||||
const [], () => new ChangingSoupComponent()));
|
||||
}
|
||||
|
||||
+6
-4
@@ -10,8 +10,10 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(OnChangeSoupComponent, new _ngRef.ReflectionInfo(const [
|
||||
const Component(
|
||||
selector: '[soup]', lifecycle: const [LifecycleEvent.onChange])
|
||||
], const [], () => new OnChangeSoupComponent()));
|
||||
..registerType(
|
||||
OnChangeSoupComponent,
|
||||
new _ngRef.ReflectionInfo(const [
|
||||
const Component(
|
||||
selector: '[soup]', lifecycle: const [LifecycleEvent.onChange])
|
||||
], const [], () => new OnChangeSoupComponent()));
|
||||
}
|
||||
|
||||
+7
-4
@@ -11,8 +11,11 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(HelloCmp, new _ngRef.ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: r'''{{greeting}}''', templateUrl: r'template.html')
|
||||
], const [], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new _ngRef.ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(
|
||||
template: r'''{{greeting}}''', templateUrl: r'template.html')
|
||||
], const [], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ main() {
|
||||
|
||||
var formatter = new DartFormatter();
|
||||
var transform = new AngularTransformerGroup(new TransformerOptions(
|
||||
['web/index.dart'], reflectionEntryPoints: ['web/index.dart']));
|
||||
['web/index.dart'],
|
||||
reflectionEntryPoints: ['web/index.dart']));
|
||||
|
||||
class IntegrationTestConfig {
|
||||
final String name;
|
||||
@@ -92,14 +93,12 @@ void allTests() {
|
||||
outputs: {
|
||||
'a|web/bar.ng_deps.dart': 'synthetic_ctor_files/expected/bar.ng_deps.dart'
|
||||
}),
|
||||
new IntegrationTestConfig('should preserve multiple annotations.',
|
||||
inputs: {
|
||||
new IntegrationTestConfig('should preserve multiple annotations.', inputs: {
|
||||
'a|web/index.dart': 'two_annotations_files/index.dart',
|
||||
'a|web/bar.dart': 'two_annotations_files/bar.dart',
|
||||
'angular2|lib/src/core/annotations_impl/view.dart':
|
||||
'../../../lib/src/core/annotations_impl/view.dart'
|
||||
},
|
||||
outputs: {
|
||||
}, outputs: {
|
||||
'a|web/bar.ng_deps.dart':
|
||||
'two_annotations_files/expected/bar.ng_deps.dart'
|
||||
})
|
||||
@@ -108,7 +107,6 @@ void allTests() {
|
||||
var cache = {};
|
||||
|
||||
for (var config in tests) {
|
||||
|
||||
// Read in input & output files.
|
||||
config.assetPathToInputPath
|
||||
..addAll(commonInputs)
|
||||
@@ -122,8 +120,14 @@ void allTests() {
|
||||
return value.endsWith('dart') ? formatter.format(code) : code;
|
||||
});
|
||||
});
|
||||
testPhases(config.name, [[transform]], config.assetPathToInputPath,
|
||||
config.assetPathToExpectedOutputPath, [],
|
||||
testPhases(
|
||||
config.name,
|
||||
[
|
||||
[transform]
|
||||
],
|
||||
config.assetPathToInputPath,
|
||||
config.assetPathToExpectedOutputPath,
|
||||
[],
|
||||
StringFormatter.noNewlinesOrSurroundingWhitespace);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-3
@@ -11,7 +11,11 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(MyComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(componentServices: const [MyContext])],
|
||||
const [const [MyContext]], (MyContext c) => new MyComponent(c)));
|
||||
..registerType(
|
||||
MyComponent,
|
||||
new _ngRef.ReflectionInfo(const [
|
||||
const Component(componentServices: const [MyContext])
|
||||
], const [
|
||||
const [MyContext]
|
||||
], (MyContext c) => new MyComponent(c)));
|
||||
}
|
||||
|
||||
+4
-3
@@ -10,7 +10,8 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(MyComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[soup]')], const [],
|
||||
() => new MyComponent()));
|
||||
..registerType(
|
||||
MyComponent,
|
||||
new _ngRef.ReflectionInfo(const [const Component(selector: '[soup]')],
|
||||
const [], () => new MyComponent()));
|
||||
}
|
||||
|
||||
+4
-3
@@ -10,7 +10,8 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(MyComponent, new _ngRef.ReflectionInfo(
|
||||
const [const Component(selector: '[soup]')], const [],
|
||||
() => new MyComponent()));
|
||||
..registerType(
|
||||
MyComponent,
|
||||
new _ngRef.ReflectionInfo(const [const Component(selector: '[soup]')],
|
||||
const [], () => new MyComponent()));
|
||||
}
|
||||
|
||||
+11
-11
@@ -14,30 +14,30 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..registerType(MyComponent, new _ngRef.ReflectionInfo(const [
|
||||
const Component(selector: '[soup]'),
|
||||
const View(template: 'Salad: {{myNum}} is awesome')
|
||||
], const [], () => new MyComponent()))
|
||||
..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'] =
|
||||
_MyComponent_ChangeDetector0.newProtoChangeDetector;
|
||||
}
|
||||
|
||||
class _MyComponent_ChangeDetector0
|
||||
extends _gen.AbstractChangeDetector<MyComponent> {
|
||||
var myNum0, interpolate1;
|
||||
|
||||
_MyComponent_ChangeDetector0(dispatcher, protos, directiveRecords) : super(
|
||||
"MyComponent_comp_0", dispatcher, protos, directiveRecords,
|
||||
'ALWAYS_CHECK') {
|
||||
_MyComponent_ChangeDetector0(dispatcher, protos, directiveRecords)
|
||||
: super("MyComponent_comp_0", dispatcher, protos, directiveRecords,
|
||||
'ALWAYS_CHECK') {
|
||||
dehydrateDirectives(false);
|
||||
}
|
||||
|
||||
void detectChangesInRecordsInternal(throwOnChange) {
|
||||
var l_context = this.context,
|
||||
l_myNum0,
|
||||
c_myNum0,
|
||||
l_interpolate1;
|
||||
var l_context = this.context, l_myNum0, c_myNum0, l_interpolate1;
|
||||
c_myNum0 = false;
|
||||
var isChanged = false;
|
||||
var changes = null;
|
||||
|
||||
+12
-5
@@ -11,9 +11,16 @@ void initReflector() {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
_ngRef.reflector
|
||||
..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)));
|
||||
..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)));
|
||||
}
|
||||
|
||||
@@ -18,23 +18,27 @@ 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');
|
||||
var bootstrapCode = readFile('reflection_remover/bootstrap_files/index.dart').replaceAll('\r\n', '\n');
|
||||
var bootstrapCode = readFile('reflection_remover/bootstrap_files/index.dart')
|
||||
.replaceAll('\r\n', '\n');
|
||||
|
||||
it('should remove uses of mirrors & '
|
||||
it(
|
||||
'should remove uses of mirrors & '
|
||||
'insert calls to generated code by default.', () {
|
||||
var output =
|
||||
new Rewriter(code, codegen).rewrite(parseCompilationUnit(code));
|
||||
expect(output).toEqual(expected.code);
|
||||
});
|
||||
|
||||
it('should replace uses of mirrors with the debug implementation & '
|
||||
it(
|
||||
'should replace uses of mirrors with the debug implementation & '
|
||||
'insert calls to generated code in `MirrorMode.debug`.', () {
|
||||
var output = new Rewriter(code, codegen, mirrorMode: MirrorMode.debug)
|
||||
.rewrite(parseCompilationUnit(code));
|
||||
expect(output).toEqual(debug_mirrors.code);
|
||||
});
|
||||
|
||||
it('should replace uses of mirrors with the verbose implementation '
|
||||
it(
|
||||
'should replace uses of mirrors with the verbose implementation '
|
||||
'in `MirrorMode.verbose`.', () {
|
||||
var output = new Rewriter(code, codegen, mirrorMode: MirrorMode.verbose)
|
||||
.rewrite(parseCompilationUnit(code));
|
||||
|
||||
+16
-8
@@ -9,12 +9,20 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+16
-8
@@ -9,12 +9,20 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,10 +9,14 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: '{{greeting}}, {{greeting}}')
|
||||
], const [const []], () => new HelloCmp()))
|
||||
..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});
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,8 +9,12 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: '{{greeting}}, {{greeting}}')
|
||||
], const [const []], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: '{{greeting}}, {{greeting}}')
|
||||
], const [
|
||||
const []
|
||||
], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,10 +9,14 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: '<div [a]="b">{{greeting}}</div>')
|
||||
], const [const []], () => new HelloCmp()))
|
||||
..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});
|
||||
|
||||
+8
-4
@@ -9,8 +9,12 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: '<div [a]="b">{{greeting}}</div>')
|
||||
], const [const []], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: '<div [a]="b">{{greeting}}</div>')
|
||||
], const [
|
||||
const []
|
||||
], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,10 +9,14 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: '<button (click)=\"action()\">go</button>')
|
||||
], const [const []], () => new HelloCmp()))
|
||||
..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)});
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,8 +9,12 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: '<button (click)=\"action()\">go</button>')
|
||||
], const [const []], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: '<button (click)=\"action()\">go</button>')
|
||||
], const [
|
||||
const []
|
||||
], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
@@ -9,10 +9,14 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+16
-8
@@ -9,12 +9,20 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+16
-8
@@ -9,12 +9,20 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..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()));
|
||||
..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()));
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,10 +9,14 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(templateUrl: 'template.html')
|
||||
], const [const []], () => new HelloCmp()))
|
||||
..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});
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,8 +9,12 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(templateUrl: 'template.html')
|
||||
], const [const []], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(templateUrl: 'template.html')
|
||||
], const [
|
||||
const []
|
||||
], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,10 +9,14 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(templateUrl: 'template.html')
|
||||
], const [const []], () => new HelloCmp()))
|
||||
..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)});
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,8 +9,12 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(templateUrl: 'template.html')
|
||||
], const [const []], () => new HelloCmp()));
|
||||
..registerType(
|
||||
HelloCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(templateUrl: 'template.html')
|
||||
], const [
|
||||
const []
|
||||
], () => new HelloCmp()));
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,10 +9,14 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(GoodbyeCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'goodbye-app'),
|
||||
const View(template: 'Goodbye {{name}}')
|
||||
], const [const []], () => new GoodbyeCmp()))
|
||||
..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});
|
||||
}
|
||||
|
||||
+9
-4
@@ -11,9 +11,14 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: 'goodbye-app', directives: const [prefix.GoodbyeCmp])
|
||||
], const [const []], () => new HelloCmp()));
|
||||
..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);
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,10 +9,14 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(MyApp, new ReflectionInfo(const [
|
||||
const ng2.Component(selector: 'my-app'),
|
||||
const ng2.View(template: 'MyApp {{name}}')
|
||||
], const [const []], () => new MyApp()))
|
||||
..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});
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,8 +9,12 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(GoodbyeCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'goodbye-app'),
|
||||
const View(template: 'Goodbye {{name}}')
|
||||
], const [const []], () => new GoodbyeCmp()));
|
||||
..registerType(
|
||||
GoodbyeCmp,
|
||||
new ReflectionInfo(const [
|
||||
const Component(selector: 'goodbye-app'),
|
||||
const View(template: 'Goodbye {{name}}')
|
||||
], const [
|
||||
const []
|
||||
], () => new GoodbyeCmp()));
|
||||
}
|
||||
|
||||
+9
-4
@@ -11,9 +11,14 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(HelloCmp, new ReflectionInfo(const [
|
||||
const Component(selector: 'hello-app'),
|
||||
const View(template: 'goodbye-app', directives: const [prefix.GoodbyeCmp])
|
||||
], const [const []], () => new HelloCmp()));
|
||||
..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);
|
||||
}
|
||||
|
||||
+8
-4
@@ -9,8 +9,12 @@ void initReflector(reflector) {
|
||||
if (_visited) return;
|
||||
_visited = true;
|
||||
reflector
|
||||
..registerType(MyApp, new ReflectionInfo(const [
|
||||
const ng2.Component(selector: 'my-app'),
|
||||
const ng2.View(template: 'MyApp {{name}}')
|
||||
], const [const []], () => new MyApp()));
|
||||
..registerType(
|
||||
MyApp,
|
||||
new ReflectionInfo(const [
|
||||
const ng2.Component(selector: 'my-app'),
|
||||
const ng2.View(template: 'MyApp {{name}}')
|
||||
], const [
|
||||
const []
|
||||
], () => new MyApp()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user