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:
Tim Blasi
2015-08-04 12:05:30 -07:00
parent 450d3630cc
commit f11f4e0b45
145 changed files with 1627 additions and 1013 deletions

View File

@ -16,8 +16,9 @@ allTests() {
Future<double> runBenchmark() async {
var options = new TransformerOptions(['this_is_ignored.dart']);
var files = {new AssetId('a', 'a.ng_deps.dart'): aContents};
return new TransformerBenchmark([[new BindGenerator(options)]], files)
.measure();
return new TransformerBenchmark([
[new BindGenerator(options)]
], files).measure();
}
const aContents = '''

View File

@ -19,7 +19,9 @@ Future<double> runBenchmark() async {
new AssetId('a', 'b.ng_deps.dart'): bContents,
new AssetId('a', 'c.ng_deps.dart'): cContents,
};
return new TransformerBenchmark([[new DirectiveLinker()]], files).measure();
return new TransformerBenchmark([
[new DirectiveLinker()]
], files).measure();
}
const aContents = '''

View File

@ -16,8 +16,9 @@ allTests() {
Future runBenchmark() async {
var options = new TransformerOptions(['this_is_ignored.dart']);
var files = {new AssetId('a', 'a.dart'): aContents,};
return new TransformerBenchmark([[new DirectiveProcessor(options)]], files)
.measure();
return new TransformerBenchmark([
[new DirectiveProcessor(options)]
], files).measure();
}
const aContents = '''

View File

@ -16,8 +16,9 @@ allTests() {
Future runBenchmark() async {
var options = new TransformerOptions(['web/index.dart']);
var files = {new AssetId('a', 'web/index.dart'): indexContents,};
return new TransformerBenchmark([[new ReflectionRemover(options)]], files)
.measure();
return new TransformerBenchmark([
[new ReflectionRemover(options)]
], files).measure();
}
const indexContents = '''

View File

@ -16,8 +16,9 @@ allTests() {
Future runBenchmark() async {
var options = new TransformerOptions(['index.dart']);
var files = {new AssetId('a', 'web/a.ng_deps.dart'): aContents,};
return new TransformerBenchmark([[new TemplateCompiler(options)]], files)
.measure();
return new TransformerBenchmark([
[new TemplateCompiler(options)]
], files).measure();
}
const aContents = '''

View File

@ -19,8 +19,9 @@ Future runBenchmark() async {
new AssetId('a', 'web/a.ng_deps.dart'): aContents,
new AssetId('a', 'web/template.html'): templateContents,
};
return new TransformerBenchmark([[new TemplateCompiler(options)]], files)
.measure();
return new TransformerBenchmark([
[new TemplateCompiler(options)]
], files).measure();
}
const aContents = '''

View File

@ -12,14 +12,14 @@ main() {
describe("onChange", () {
it("should be true when the directive implements OnChange", () {
expect(metadata(
DirectiveImplementingOnChange, new Directive()).callOnChange)
.toBe(true);
expect(metadata(DirectiveImplementingOnChange, new Directive())
.callOnChange).toBe(true);
});
it("should be true when the lifecycle includes onChange", () {
expect(metadata(DirectiveNoHooks, new Directive(
lifecycle: [LifecycleEvent.onChange])).callOnChange).toBe(true);
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [LifecycleEvent.onChange]))
.callOnChange).toBe(true);
});
it("should be false otherwise", () {
@ -28,20 +28,22 @@ main() {
});
it("should be false when empty lifecycle", () {
expect(metadata(DirectiveImplementingOnChange,
new Directive(lifecycle: [])).callOnChange).toBe(false);
expect(metadata(
DirectiveImplementingOnChange, new Directive(lifecycle: []))
.callOnChange).toBe(false);
});
});
describe("onDestroy", () {
it("should be true when the directive implements OnDestroy", () {
expect(metadata(DirectiveImplementingOnDestroy,
new Directive()).callOnDestroy).toBe(true);
expect(metadata(DirectiveImplementingOnDestroy, new Directive())
.callOnDestroy).toBe(true);
});
it("should be true when the lifecycle includes onDestroy", () {
expect(metadata(DirectiveNoHooks, new Directive(
lifecycle: [LifecycleEvent.onDestroy])).callOnDestroy).toBe(true);
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [LifecycleEvent.onDestroy]))
.callOnDestroy).toBe(true);
});
it("should be false otherwise", () {
@ -52,14 +54,14 @@ main() {
describe("onCheck", () {
it("should be true when the directive implements OnCheck", () {
expect(metadata(
DirectiveImplementingOnCheck, new Directive()).callOnCheck)
.toBe(true);
expect(metadata(DirectiveImplementingOnCheck, new Directive())
.callOnCheck).toBe(true);
});
it("should be true when the lifecycle includes onCheck", () {
expect(metadata(DirectiveNoHooks, new Directive(
lifecycle: [LifecycleEvent.onCheck])).callOnCheck).toBe(true);
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [LifecycleEvent.onCheck]))
.callOnCheck).toBe(true);
});
it("should be false otherwise", () {
@ -70,9 +72,8 @@ main() {
describe("onInit", () {
it("should be true when the directive implements OnInit", () {
expect(metadata(
DirectiveImplementingOnInit, new Directive()).callOnInit)
.toBe(true);
expect(metadata(DirectiveImplementingOnInit, new Directive())
.callOnInit).toBe(true);
});
it("should be true when the lifecycle includes onInit", () {
@ -89,21 +90,20 @@ main() {
describe("onAllChangesDone", () {
it("should be true when the directive implements OnAllChangesDone", () {
expect(metadata(DirectiveImplementingOnAllChangesDone,
new Directive()).callOnAllChangesDone).toBe(true);
expect(
metadata(DirectiveImplementingOnAllChangesDone, new Directive())
.callOnAllChangesDone).toBe(true);
});
it("should be true when the lifecycle includes onAllChangesDone", () {
expect(metadata(DirectiveNoHooks, new Directive(
lifecycle: [
LifecycleEvent.onAllChangesDone
])).callOnAllChangesDone).toBe(true);
expect(metadata(DirectiveNoHooks,
new Directive(lifecycle: [LifecycleEvent.onAllChangesDone]))
.callOnAllChangesDone).toBe(true);
});
it("should be false otherwise", () {
expect(metadata(
DirectiveNoHooks, new Directive()).callOnAllChangesDone)
.toBe(false);
expect(metadata(DirectiveNoHooks, new Directive())
.callOnAllChangesDone).toBe(false);
});
});
});

View File

@ -12,6 +12,7 @@ class MockException implements Error {
var message;
var stackTrace;
}
class NonError {
var message;
}
@ -41,155 +42,167 @@ void functionThatThrowsNonError() {
main() {
describe('TypeLiteral', () {
it('should publish via viewBindings', inject([
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb
.overrideView(Dummy, new View(
template: '<type-literal-component></type-literal-component>',
directives: [TypeLiteralComponent]))
.createAsync(Dummy)
.then((tc) {
tc.detectChanges();
expect(asNativeElements(tc.componentViewChildren))
.toHaveText('[Hello, World]');
async.done();
});
}));
it(
'should publish via viewBindings',
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
tb
.overrideView(
Dummy,
new View(
template:
'<type-literal-component></type-literal-component>',
directives: [TypeLiteralComponent]))
.createAsync(Dummy)
.then((tc) {
tc.detectChanges();
expect(asNativeElements(tc.componentViewChildren))
.toHaveText('[Hello, World]');
async.done();
});
}));
});
describe('Error handling', () {
it('should preserve Error stack traces thrown from components', inject([
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb
.overrideView(Dummy, new View(
template: '<throwing-component></throwing-component>',
directives: [ThrowingComponent]))
.createAsync(Dummy)
.catchError((e, stack) {
expect(e).toContainError("MockException");
expect(e).toContainError("functionThatThrows");
async.done();
});
}));
it(
'should preserve Error stack traces thrown from components',
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
tb
.overrideView(
Dummy,
new View(
template: '<throwing-component></throwing-component>',
directives: [ThrowingComponent]))
.createAsync(Dummy)
.catchError((e, stack) {
expect(e).toContainError("MockException");
expect(e).toContainError("functionThatThrows");
async.done();
});
}));
it('should preserve non-Error stack traces thrown from components', inject([
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb
.overrideView(Dummy, new View(
template: '<throwing-component2></throwing-component2>',
directives: [ThrowingComponent2]))
.createAsync(Dummy)
.catchError((e, stack) {
expect(e).toContainError("NonError");
expect(e).toContainError("functionThatThrows");
async.done();
});
}));
it(
'should preserve non-Error stack traces thrown from components',
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
tb
.overrideView(
Dummy,
new View(
template: '<throwing-component2></throwing-component2>',
directives: [ThrowingComponent2]))
.createAsync(Dummy)
.catchError((e, stack) {
expect(e).toContainError("NonError");
expect(e).toContainError("functionThatThrows");
async.done();
});
}));
});
describe('Property access', () {
it('should distinguish between map and property access', inject([
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb
.overrideView(Dummy, new View(
template: '<property-access></property-access>',
directives: [PropertyAccess]))
.createAsync(Dummy)
.then((tc) {
tc.detectChanges();
expect(asNativeElements(tc.componentViewChildren))
.toHaveText('prop:foo-prop;map:foo-map');
async.done();
});
}));
it(
'should distinguish between map and property access',
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
tb
.overrideView(
Dummy,
new View(
template: '<property-access></property-access>',
directives: [PropertyAccess]))
.createAsync(Dummy)
.then((tc) {
tc.detectChanges();
expect(asNativeElements(tc.componentViewChildren))
.toHaveText('prop:foo-prop;map:foo-map');
async.done();
});
}));
it('should not fallback on map access if property missing', inject([
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb
.overrideView(Dummy, new View(
template: '<no-property-access></no-property-access>',
directives: [NoPropertyAccess]))
.createAsync(Dummy)
.then((tc) {
expect(() => tc.detectChanges())
.toThrowError(new RegExp('property not found'));
async.done();
});
}));
it(
'should not fallback on map access if property missing',
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
tb
.overrideView(
Dummy,
new View(
template: '<no-property-access></no-property-access>',
directives: [NoPropertyAccess]))
.createAsync(Dummy)
.then((tc) {
expect(() => tc.detectChanges())
.toThrowError(new RegExp('property not found'));
async.done();
});
}));
});
describe('OnChange', () {
it('should be notified of changes', inject([
TestComponentBuilder,
AsyncTestCompleter
], (tb, async) {
tb
.overrideView(Dummy, new View(
template: '''<on-change [prop]="'hello'"></on-change>''',
directives: [OnChangeComponent]))
.createAsync(Dummy)
.then((tc) {
tc.detectChanges();
var cmp = tc.componentViewChildren[0].inject(OnChangeComponent);
expect(cmp.prop).toEqual('hello');
expect(cmp.changes.containsKey('prop')).toEqual(true);
async.done();
});
}));
it(
'should be notified of changes',
inject([TestComponentBuilder, AsyncTestCompleter], (tb, async) {
tb
.overrideView(
Dummy,
new View(
template: '''<on-change [prop]="'hello'"></on-change>''',
directives: [OnChangeComponent]))
.createAsync(Dummy)
.then((tc) {
tc.detectChanges();
var cmp = tc.componentViewChildren[0].inject(OnChangeComponent);
expect(cmp.prop).toEqual('hello');
expect(cmp.changes.containsKey('prop')).toEqual(true);
async.done();
});
}));
});
describe("ObservableListDiff", () {
it('should be notified of changes', inject([
TestComponentBuilder,
Log
], fakeAsync((TestComponentBuilder tcb, Log log) {
tcb
.overrideView(Dummy, new View(
template: '''<component-with-observable-list [list]="value"></component-with-observable-list>''',
directives: [ComponentWithObservableList]))
.createAsync(Dummy)
.then((tc) {
tc.componentInstance.value = new ObservableList.from([1, 2]);
it(
'should be notified of changes',
inject([TestComponentBuilder, Log],
fakeAsync((TestComponentBuilder tcb, Log log) {
tcb
.overrideView(
Dummy,
new View(
template:
'''<component-with-observable-list [list]="value"></component-with-observable-list>''',
directives: [ComponentWithObservableList]))
.createAsync(Dummy)
.then((tc) {
tc.componentInstance.value = new ObservableList.from([1, 2]);
tc.detectChanges();
tc.detectChanges();
expect(log.result()).toEqual("check");
expect(asNativeElements(tc.componentViewChildren)).toHaveText('12');
expect(log.result()).toEqual("check");
expect(asNativeElements(tc.componentViewChildren)).toHaveText('12');
tc.detectChanges();
tc.detectChanges();
// we did not change the list => no checks
expect(log.result()).toEqual("check");
// we did not change the list => no checks
expect(log.result()).toEqual("check");
tc.componentInstance.value.add(3);
tc.componentInstance.value.add(3);
flushMicrotasks();
flushMicrotasks();
tc.detectChanges();
tc.detectChanges();
// we changed the list => a check
expect(log.result()).toEqual("check; check");
expect(asNativeElements(tc.componentViewChildren)).toHaveText('123');
// we changed the list => a check
expect(log.result()).toEqual("check; check");
expect(asNativeElements(tc.componentViewChildren))
.toHaveText('123');
// we replaced the list => a check
tc.componentInstance.value = new ObservableList.from([5, 6, 7]);
// we replaced the list => a check
tc.componentInstance.value = new ObservableList.from([5, 6, 7]);
tc.detectChanges();
tc.detectChanges();
expect(log.result()).toEqual("check; check; check");
expect(asNativeElements(tc.componentViewChildren)).toHaveText('567');
});
})));
expect(log.result()).toEqual("check; check; check");
expect(asNativeElements(tc.componentViewChildren))
.toHaveText('567');
});
})));
});
}
@ -201,9 +214,9 @@ class Dummy {
@Component(
selector: 'type-literal-component',
viewBindings: const [
const Binding(const TypeLiteral<List<String>>(),
toValue: const <String>['Hello', 'World'])
])
const Binding(const TypeLiteral<List<String>>(),
toValue: const <String>['Hello', 'World'])
])
@View(template: '{{list}}')
class TypeLiteralComponent {
final List<String> list;
@ -250,9 +263,11 @@ class NoPropertyAccess {
final model = new PropModel();
}
@Component(selector: 'on-change',
@Component(
selector: 'on-change',
// TODO: needed because of https://github.com/angular/angular/issues/2120
lifecycle: const [LifecycleEvent.onChange], properties: const ['prop'])
lifecycle: const [LifecycleEvent.onChange],
properties: const ['prop'])
@View(template: '')
class OnChangeComponent implements OnChange {
Map changes;
@ -269,15 +284,15 @@ class OnChangeComponent implements OnChange {
changeDetection: ON_PUSH,
properties: const ['list'],
bindings: const [
const Binding(IterableDiffers,
toValue: const IterableDiffers(const [
const ObservableListDiffFactory(),
const DefaultIterableDifferFactory()
]
))
])
const Binding(IterableDiffers,
toValue: const IterableDiffers(const [
const ObservableListDiffFactory(),
const DefaultIterableDifferFactory()
]))
])
@View(
template: '<span *ng-for="#item of list">{{item}}</span><directive-logging-checks></directive-logging-checks>',
template:
'<span *ng-for="#item of list">{{item}}</span><directive-logging-checks></directive-logging-checks>',
directives: const [NgFor, DirectiveLoggingChecks])
class ComponentWithObservableList {
Iterable list;

View File

@ -40,7 +40,9 @@ main() {
}
class Foo {}
class Bar extends Foo {}
fn() => null;
class Annotation {

View File

@ -7,8 +7,10 @@ import 'package:angular2/di.dart';
main() {
describe('Injector', () {
it('should support TypeLiteral', () {
var i = Injector.resolveAndCreate(
[bind(new TypeLiteral<List<int>>()).toValue([1, 2, 3]), Foo,]);
var i = Injector.resolveAndCreate([
bind(new TypeLiteral<List<int>>()).toValue([1, 2, 3]),
Foo,
]);
expect(i.get(Foo).value).toEqual([1, 2, 3]);
});
});

View File

@ -23,8 +23,7 @@ main() {
});
});
it("should return itself when called the first time",
() {
it("should return itself when called the first time", () {
final d = factory.create(changeDetectorRef);
final c = new ObservableList.from([1, 2]);
expect(d.diff(c)).toBe(d);

View File

@ -8,6 +8,7 @@ class MockException implements Error {
var message;
var stackTrace;
}
class NonError {
var message;
}
@ -46,54 +47,58 @@ void expectFunctionThatThrowsWithStackTrace(
main() {
describe('async facade', () {
describe('Completer', () {
it('should preserve Error stack traces', inject([AsyncTestCompleter],
(async) {
var c = PromiseWrapper.completer();
it(
'should preserve Error stack traces',
inject([AsyncTestCompleter], (async) {
var c = PromiseWrapper.completer();
expectFunctionThatThrowsWithStackTrace(c.promise, async);
expectFunctionThatThrowsWithStackTrace(c.promise, async);
try {
functionThatThrows();
} catch (e) {
c.reject(e, null);
}
}));
try {
functionThatThrows();
} catch (e) {
c.reject(e, null);
}
}));
it('should preserve error stack traces for non-Errors', inject(
[AsyncTestCompleter], (async) {
var c = PromiseWrapper.completer();
it(
'should preserve error stack traces for non-Errors',
inject([AsyncTestCompleter], (async) {
var c = PromiseWrapper.completer();
expectFunctionThatThrowsWithStackTrace(c.promise, async);
expectFunctionThatThrowsWithStackTrace(c.promise, async);
try {
functionThatThrowsNonError();
} catch (e, s) {
c.reject(e, s);
}
}));
try {
functionThatThrowsNonError();
} catch (e, s) {
c.reject(e, s);
}
}));
});
describe('PromiseWrapper', () {
describe('reject', () {
it('should preserve Error stack traces', inject([AsyncTestCompleter],
(async) {
try {
functionThatThrows();
} catch (e) {
var rejectedFuture = PromiseWrapper.reject(e, null);
expectFunctionThatThrowsWithStackTrace(rejectedFuture, async);
}
}));
it(
'should preserve Error stack traces',
inject([AsyncTestCompleter], (async) {
try {
functionThatThrows();
} catch (e) {
var rejectedFuture = PromiseWrapper.reject(e, null);
expectFunctionThatThrowsWithStackTrace(rejectedFuture, async);
}
}));
it('should preserve stack traces for non-Errors', inject(
[AsyncTestCompleter], (async) {
try {
functionThatThrowsNonError();
} catch (e, s) {
var rejectedFuture = PromiseWrapper.reject(e, s);
expectFunctionThatThrowsWithStackTrace(rejectedFuture, async);
}
}));
it(
'should preserve stack traces for non-Errors',
inject([AsyncTestCompleter], (async) {
try {
functionThatThrowsNonError();
} catch (e, s) {
var rejectedFuture = PromiseWrapper.reject(e, s);
expectFunctionThatThrowsWithStackTrace(rejectedFuture, async);
}
}));
});
});
});

View File

@ -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';

View File

@ -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()));
}

View File

@ -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});
}

View File

@ -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});
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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});
}

View File

@ -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>();

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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();
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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();
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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);
}

View File

@ -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()));
}

View File

@ -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');

View File

@ -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()));
}

View File

@ -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);
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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()));
}

View File

@ -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);
}

View File

@ -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()));
}

View File

@ -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 []));
}

View File

@ -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 {

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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]));
}

View File

@ -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]));
}

View File

@ -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]));
}

View File

@ -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()));
}

View File

@ -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]));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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)));
}

View File

@ -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]));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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);
}
}

View File

@ -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)));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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;

View File

@ -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)));
}

View File

@ -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));

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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});
}

View File

@ -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()));
}

View File

@ -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});

View File

@ -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()));
}

View File

@ -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)});
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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()));
}

View File

@ -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});
}

View File

@ -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()));
}

View File

@ -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)});
}

View File

@ -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()));
}

View File

@ -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});
}

View File

@ -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);
}

View File

@ -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});
}

View File

@ -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()));
}

View File

@ -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);
}

View File

@ -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()));
}