From f11f4e0b4535156902c83e8782395607a8d418cf Mon Sep 17 00:00:00 2001 From: Tim Blasi Date: Tue, 4 Aug 2015 12:05:30 -0700 Subject: [PATCH] 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 ``` --- .../src/core/compiler/query_list.dart | 3 +- .../src/core/testability/get_testability.dart | 17 +- modules/angular2/src/core/zone/ng_zone.dart | 7 +- modules/angular2/src/dom/browser_adapter.dart | 58 +++- modules/angular2/src/dom/html_adapter.dart | 65 ++++ modules/angular2/src/facade/async.dart | 1 + modules/angular2/src/facade/collection.dart | 25 +- modules/angular2/src/facade/intl.dart | 6 +- modules/angular2/src/facade/lang.dart | 18 +- modules/angular2/src/profile/wtf_impl.dart | 34 +- .../reflection/reflection_capabilities.dart | 321 +++++++++--------- .../render/dom/events/hammer_gestures.dart | 8 +- modules/angular2/src/test_lib/fake_async.dart | 31 +- modules/angular2/src/test_lib/spies.dart | 3 +- .../transform/common/annotation_matcher.dart | 3 +- .../transform/common/class_matcher_base.dart | 9 +- .../common/directive_metadata_reader.dart | 21 +- .../src/transform/common/logging.dart | 1 + .../src/transform/common/options.dart | 36 +- .../src/transform/common/registered_type.dart | 4 + .../transform/deferred_rewriter/rewriter.dart | 7 +- .../transform/directive_linker/linker.dart | 3 +- .../directive_processor/rewriter.dart | 22 +- .../directive_processor/visitors.dart | 1 + .../transform/reflection_remover/codegen.dart | 1 + .../reflection_remover/rewriter.dart | 11 +- .../change_detector_codegen.dart | 29 +- .../template_compiler/generator.dart | 15 +- .../reflection_capabilities.dart | 2 + .../src/web-workers/ui/application.dart | 4 +- .../src/web-workers/ui/event_serializer.dart | 15 +- .../worker/event_deserializer.dart | 6 +- .../transform/bind_generator/simple.dart | 5 +- .../transform/directive_linker/simple.dart | 4 +- .../transform/directive_processor/simple.dart | 5 +- .../transform/reflection_remover/simple.dart | 5 +- .../transform/template_compiler/inline.dart | 5 +- .../transform/template_compiler/url.dart | 5 +- .../compiler/directive_lifecycle_spec.dart | 56 +-- .../core/compiler/integration_dart_spec.dart | 289 ++++++++-------- .../angular2/test/di/binding_dart_spec.dart | 2 + .../angular2/test/di/injector_dart_spec.dart | 6 +- .../directives/observable_list_diff_spec.dart | 3 +- .../angular2/test/facade/async_dart_spec.dart | 81 ++--- .../transform/bind_generator/all_tests.dart | 3 +- .../basic_bind_files/bar.ng_deps.dart | 10 +- .../expected/bar.ng_deps.dart | 10 +- .../expected/soup.ng_deps.dart | 19 +- .../soup.ng_deps.dart | 19 +- .../events_files/bar.ng_deps.dart | 11 +- .../events_files/expected/bar.ng_deps.dart | 11 +- .../common/async_string_writer_tests.dart | 3 +- .../hello.ng_deps.dart | 14 +- .../hello.ng_deps.dart | 14 +- .../simple_export_files/bar.ng_deps.dart | 7 +- .../expected/bar.ng_deps.dart | 7 +- .../expected/foo.ng_deps.dart | 7 +- .../simple_export_files/foo.ng_deps.dart | 7 +- .../simple_files/bar.ng_deps.dart | 10 +- .../simple_files/expected/bar.ng_deps.dart | 10 +- .../simple_files/expected/foo.ng_deps.dart | 7 +- .../simple_files/foo.ng_deps.dart | 7 +- .../absolute_export_files/bar.ng_deps.dart | 7 +- .../absolute_export_files/foo.ng_deps.dart | 7 +- .../adjacent_strings_files/foo.ng_deps.dart | 7 +- .../all_tests.dart | 79 +++-- .../directive_aliases_files/bar.ng_deps.dart | 7 +- .../directive_aliases_files/foo.ng_deps.dart | 7 +- .../changeDetection.ng_deps.dart | 9 +- .../compile_children.ng_deps.dart | 20 +- .../directive_export_as.ng_deps.dart | 7 +- .../events.ng_deps.dart | 10 +- .../host_listeners.ng_deps.dart | 21 +- .../lifecycle.ng_deps.dart | 23 +- .../properties.ng_deps.dart | 10 +- .../selector.ng_deps.dart | 7 +- .../too_many_directives.ng_deps.dart | 12 +- .../export_files/bar.ng_deps.dart | 7 +- .../export_files/foo.ng_deps.dart | 7 +- .../recursive_export_files/bar.ng_deps.dart | 7 +- .../recursive_export_files/baz.ng_deps.dart | 7 +- .../recursive_export_files/foo.ng_deps.dart | 7 +- .../simple_files/foo.ng_deps.dart | 7 +- .../expected/hello.ng_deps.dart | 16 +- .../directive_processor/all_tests.dart | 43 ++- .../expected/package_soup.ng_deps.dart | 6 +- .../expected/relative_soup.ng_deps.dart | 6 +- .../expected/hello.ng_deps.dart | 16 +- .../expected/hello.ng_deps.dart | 22 +- .../expected/soup.ng_deps.dart | 10 +- .../expected/soup.ng_deps.dart | 76 +++-- .../expected/soup.ng_deps.dart | 10 +- .../expected/hello.ng_deps.dart | 16 +- .../expected/soup.ng_deps.dart | 62 ++-- .../expected/hello.ng_deps.dart | 22 +- .../expected/hello.ng_deps.dart | 20 +- .../expected/soup.ng_deps.dart | 13 +- .../expected/soup.ng_deps.dart | 15 +- .../expected/hello.ng_deps.dart | 11 +- .../expected/hello.ng_deps.dart | 15 +- .../expected/soup.ng_deps.dart | 7 +- .../expected/soup.ng_deps.dart | 10 +- .../expected/hello.ng_deps.dart | 11 +- .../test/transform/integration/all_tests.dart | 20 +- .../expected/bar.ng_deps.dart | 10 +- .../expected/bar.ng_deps.dart | 7 +- .../expected/bar.ng_deps.dart | 7 +- .../expected/bar.ng_deps.dart | 22 +- .../two_deps_files/expected/bar.ng_deps.dart | 17 +- .../reflection_remover/all_tests.dart | 12 +- .../hello1.ng_deps.dart | 24 +- .../hello2.ng_deps.dart | 24 +- .../expected/hello.ng_deps.dart | 12 +- .../duplicate_files/hello.ng_deps.dart | 12 +- .../expected/hello.ng_deps.dart | 12 +- .../hello.ng_deps.dart | 12 +- .../expected/hello.ng_deps.dart | 12 +- .../inline_method_files/hello.ng_deps.dart | 12 +- .../ng_for_files/hello.ng_deps.dart | 16 +- .../expected/hello.ng_deps.dart | 24 +- .../one_directive_files/hello.ng_deps.dart | 24 +- .../expected/hello.ng_deps.dart | 12 +- .../url_expression_files/hello.ng_deps.dart | 12 +- .../expected/hello.ng_deps.dart | 12 +- .../url_method_files/hello.ng_deps.dart | 12 +- .../expected/goodbye.ng_deps.dart | 12 +- .../expected/hello.ng_deps.dart | 13 +- .../expected/ng2_prefix.ng_deps.dart | 12 +- .../with_prefix_files/goodbye.ng_deps.dart | 12 +- .../with_prefix_files/hello.ng_deps.dart | 13 +- .../with_prefix_files/ng2_prefix.ng_deps.dart | 12 +- .../src/naive_infinite_scroll/app.dart | 4 +- .../src/naive_infinite_scroll/cells.dart | 35 +- .../src/naive_infinite_scroll/common.dart | 5 +- .../naive_infinite_scroll/random_data.dart | 12 +- .../naive_infinite_scroll/scroll_item.dart | 1 + .../src/static_tree/tree_benchmark.dart | 30 +- .../src/tree/tree_benchmark.dart | 9 +- .../e2e_test/routing/routing_spec.dart | 4 +- .../kitchen_sink/kitchen_sink_spec.dart | 4 +- .../e2e_test/web_workers/todo/todo_spec.dart | 4 +- modules/examples/src/jsonp/jsonp_comp.dart | 4 +- .../src/message_broker/background_index.dart | 6 +- .../examples/src/message_broker/index.dart | 3 +- .../webdriver_async.server.spec.dart | 7 +- 145 files changed, 1627 insertions(+), 1013 deletions(-) diff --git a/modules/angular2/src/core/compiler/query_list.dart b/modules/angular2/src/core/compiler/query_list.dart index 82c3f8d337..a924764a0f 100644 --- a/modules/angular2/src/core/compiler/query_list.dart +++ b/modules/angular2/src/core/compiler/query_list.dart @@ -10,7 +10,8 @@ import './interface_query.dart'; * In the future this class will implement an Observable interface. * For now it uses a plain list of observable callbacks. */ -class QueryList extends Object with IterableMixin +class QueryList extends Object + with IterableMixin implements IQueryList { List _results = []; List _callbacks = []; diff --git a/modules/angular2/src/core/testability/get_testability.dart b/modules/angular2/src/core/testability/get_testability.dart index f7097905d6..65eacc71eb 100644 --- a/modules/angular2/src/core/testability/get_testability.dart +++ b/modules/angular2/src/core/testability/get_testability.dart @@ -10,8 +10,17 @@ import 'dart:js' as js; // Proxies a Dart function that accepts up to 10 parameters. js.JsFunction _jsFunction(Function fn) { const Object X = __varargSentinel; - return new js.JsFunction.withThis((thisArg, [o1 = X, o2 = X, o3 = X, o4 = X, - o5 = X, o6 = X, o7 = X, o8 = X, o9 = X, o10 = X]) { + return new js.JsFunction.withThis((thisArg, + [o1 = X, + o2 = X, + o3 = X, + o4 = X, + o5 = X, + o6 = X, + o7 = X, + o8 = X, + o9 = X, + o10 = X]) { return __invokeFn(fn, o1, o2, o3, o4, o5, o6, o7, o8, o9, o10); }); } @@ -88,8 +97,8 @@ class GetTestability { }); js.context['getAllAngularTestabilities'] = _jsify(() { List testabilities = registry.getAllTestabilities(); - List publicTestabilities = - testabilities.map((testability) => new PublicTestability(testability)); + List publicTestabilities = testabilities + .map((testability) => new PublicTestability(testability)); return _jsify(publicTestabilities); }); } diff --git a/modules/angular2/src/core/zone/ng_zone.dart b/modules/angular2/src/core/zone/ng_zone.dart index 2912a09d41..974341fc90 100644 --- a/modules/angular2/src/core/zone/ng_zone.dart +++ b/modules/angular2/src/core/zone/ng_zone.dart @@ -94,8 +94,8 @@ class NgZone { } else { _innerZone = _createInnerZone(Zone.current, handleUncaughtError: (Zone self, ZoneDelegate parent, Zone zone, - error, - StackTrace trace) => _onErrorWithoutLongStackTrace(error, trace)); + error, StackTrace trace) => + _onErrorWithoutLongStackTrace(error, trace)); } } @@ -231,7 +231,8 @@ class NgZone { _run(self, parent, zone, () => fn(arg)); dynamic _runBinary(Zone self, ZoneDelegate parent, Zone zone, fn(arg1, arg2), - arg1, arg2) => _run(self, parent, zone, () => fn(arg1, arg2)); + arg1, arg2) => + _run(self, parent, zone, () => fn(arg1, arg2)); void _scheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, fn) { _pendingMicrotasks++; diff --git a/modules/angular2/src/dom/browser_adapter.dart b/modules/angular2/src/dom/browser_adapter.dart index 8e23678bb7..ed8b432a73 100644 --- a/modules/angular2/src/dom/browser_adapter.dart +++ b/modules/angular2/src/dom/browser_adapter.dart @@ -104,14 +104,15 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { _hasPropertyCache = new Map(); _setProperty = js.context.callMethod( 'eval', ['(function(el, prop, value) { el[prop] = value; })']); - _getProperty = js.context.callMethod( - 'eval', ['(function(el, prop) { return el[prop]; })']); - _hasProperty = js.context.callMethod( - 'eval', ['(function(el, prop) { return prop in el; })']); + _getProperty = js.context + .callMethod('eval', ['(function(el, prop) { return el[prop]; })']); + _hasProperty = js.context + .callMethod('eval', ['(function(el, prop) { return prop in el; })']); } static void makeCurrent() { setRootDomAdapter(new BrowserDomAdapter()); } + bool hasProperty(Element element, String name) { // Always return true as the serverside version html_adapter.dart does so. // TODO: change this once we have schema support. @@ -156,10 +157,10 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { @override Map get attrToPropMap => const { - 'innerHtml': 'innerHTML', - 'readonly': 'readOnly', - 'tabindex': 'tabIndex', - }; + 'innerHtml': 'innerHTML', + 'readonly': 'readOnly', + 'tabindex': 'tabIndex', + }; Element query(String selector) => document.querySelector(selector); @@ -173,29 +174,35 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { // addEventListener misses zones so we use element.on. element.on[event].listen(callback); } + Function onAndCancel(EventTarget element, String event, callback(arg)) { // due to https://code.google.com/p/dart/issues/detail?id=17406 // addEventListener misses zones so we use element.on. var subscription = element.on[event].listen(callback); return subscription.cancel; } + void dispatchEvent(EventTarget el, Event evt) { el.dispatchEvent(evt); } + MouseEvent createMouseEvent(String eventType) => new MouseEvent(eventType, canBubble: true); Event createEvent(String eventType) => new Event(eventType, canBubble: true); void preventDefault(Event evt) { evt.preventDefault(); } + bool isPrevented(Event evt) { return evt.defaultPrevented; } + String getInnerHTML(Element el) => el.innerHtml; String getOuterHTML(Element el) => el.outerHtml; void setInnerHTML(Element el, String value) { el.innerHtml = value; } + String nodeName(Node el) => el.nodeName; String nodeValue(Node el) => el.nodeValue; String type(InputElement el) => el.type; @@ -208,42 +215,54 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { void clearNodes(Node el) { el.nodes = const []; } + void appendChild(Node el, Node node) { el.append(node); } + void removeChild(el, Node node) { node.remove(); } + void replaceChild(Node el, Node newNode, Node oldNode) { oldNode.replaceWith(newNode); } + ChildNode remove(ChildNode el) { return el..remove(); } + void insertBefore(Node el, node) { el.parentNode.insertBefore(node, el); } + void insertAllBefore(Node el, Iterable nodes) { el.parentNode.insertAllBefore(nodes, el); } + void insertAfter(Node el, Node node) { el.parentNode.insertBefore(node, el.nextNode); } + String getText(Node el) => el.text; void setText(Node el, String value) { el.text = value; } + String getValue(el) => el.value; void setValue(el, String value) { el.value = value; } + bool getChecked(InputElement el) => el.checked; void setChecked(InputElement el, bool isChecked) { el.checked = isChecked; } + Comment createComment(String text) { return new Comment(text); } + TemplateElement createTemplate(String html) { var t = new TemplateElement(); // We do not sanitize because templates are part of the application code @@ -251,13 +270,16 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { t.setInnerHtml(html, treeSanitizer: _identitySanitizer); return t; } + Element createElement(String tagName, [HtmlDocument doc = null]) { if (doc == null) doc = document; return doc.createElement(tagName); } + Text createTextNode(String text, [HtmlDocument doc = null]) { return new Text(text); } + createScriptTag(String attrName, String attrValue, [HtmlDocument doc = null]) { if (doc == null) doc = document; @@ -265,12 +287,14 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { el.setAttribute(attrName, attrValue); return el; } + StyleElement createStyleElement(String css, [HtmlDocument doc = null]) { if (doc == null) doc = document; var el = doc.createElement('STYLE'); el.text = css; return el; } + ShadowRoot createShadowRoot(Element el) => el.createShadowRoot(); ShadowRoot getShadowRoot(Element el) => el.shadowRoot; Element getHost(Element el) => (el as ShadowRoot).host; @@ -283,18 +307,22 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { void addClass(Element element, String classname) { element.classes.add(classname); } + void removeClass(Element element, String classname) { element.classes.remove(classname); } + bool hasClass(Element element, String classname) => element.classes.contains(classname); void setStyle(Element element, String stylename, String stylevalue) { element.style.setProperty(stylename, stylevalue); } + void removeStyle(Element element, String stylename) { element.style.removeProperty(stylename); } + String getStyle(Element element, String stylename) { return element.style.getPropertyValue(stylename); } @@ -332,6 +360,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { void setTitle(String newTitle) { document.title = newTitle; } + bool elementMatches(n, String selector) => n is Element && n.matches(selector); bool isTemplateElement(Element el) => el is TemplateElement; @@ -341,15 +370,19 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { bool hasShadowRoot(Node node) { return node is Element && node.shadowRoot != null; } + bool isShadowRoot(Node node) { return node is ShadowRoot; } + Node importIntoDoc(Node node) { return document.importNode(node, true); } + Node adoptNode(Node node) { return document.adoptNode(node); } + bool isPageRule(CssRule rule) => rule is CssPageRule; bool isStyleRule(CssRule rule) => rule is CssStyleRule; bool isMediaRule(CssRule rule) => rule is CssMediaRule; @@ -357,12 +390,14 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { String getHref(AnchorElement element) { return element.href; } + String getEventKey(KeyboardEvent event) { int keyCode = event.keyCode; return _keyCodeToKeyMap.containsKey(keyCode) ? _keyCodeToKeyMap[keyCode] : 'Unidentified'; } + getGlobalEventTarget(String target) { if (target == "window") { return window; @@ -372,12 +407,15 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { return document.body; } } + getHistory() { return window.history; } + getLocation() { return window.location; } + getBaseHref() { var href = getBaseElementHref(); if (href == null) { @@ -386,15 +424,19 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { var baseUri = Uri.parse(href); return baseUri.path; } + String getUserAgent() { return window.navigator.userAgent; } + void setData(Element element, String name, String value) { element.dataset[name] = value; } + String getData(Element element, String name) { return element.dataset[name]; } + // TODO(tbosch): move this into a separate environment class once we have it setGlobalVar(String name, value) { js.context[name] = value; diff --git a/modules/angular2/src/dom/html_adapter.dart b/modules/angular2/src/dom/html_adapter.dart index 646b4a76bd..9854ba0cc9 100644 --- a/modules/angular2/src/dom/html_adapter.dart +++ b/modules/angular2/src/dom/html_adapter.dart @@ -32,9 +32,11 @@ class Html5LibDomAdapter implements DomAdapter { log(error) { stdout.writeln('${error}'); } + logGroup(error) { stdout.writeln('${error}'); } + logGroupEnd() {} @override @@ -78,39 +80,51 @@ class Html5LibDomAdapter implements DomAdapter { query(selector) { throw 'not implemented'; } + querySelector(el, String selector) { return el.querySelector(selector); } + List querySelectorAll(el, String selector) { return el.querySelectorAll(selector); } + on(el, evt, listener) { throw 'not implemented'; } + Function onAndCancel(el, evt, listener) { throw 'not implemented'; } + dispatchEvent(el, evt) { throw 'not implemented'; } + createMouseEvent(eventType) { throw 'not implemented'; } + createEvent(eventType) { throw 'not implemented'; } + preventDefault(evt) { throw 'not implemented'; } + isPrevented(evt) { throw 'not implemented'; } + getInnerHTML(el) { return el.innerHtml; } + getOuterHTML(el) { return el.outerHtml; } + String nodeName(node) { switch (node.nodeType) { case Node.ELEMENT_NODE: @@ -123,10 +137,12 @@ class Html5LibDomAdapter implements DomAdapter { ' for node types definitions.'; } } + String nodeValue(node) => node.data; String type(node) { throw 'not implemented'; } + content(node) { return node; } @@ -147,81 +163,103 @@ class Html5LibDomAdapter implements DomAdapter { parentElement(el) { return el.parent; } + List childNodes(el) => el.nodes; List childNodesAsList(el) => el.nodes; clearNodes(el) { el.nodes.forEach((e) => e.remove()); } + appendChild(el, node) => el.append(node.remove()); removeChild(el, node) { throw 'not implemented'; } + remove(el) => el.remove(); insertBefore(el, node) { if (el.parent == null) throw '$el must have a parent'; el.parent.insertBefore(node, el); } + insertAllBefore(el, nodes) { throw 'not implemented'; } + insertAfter(el, node) { throw 'not implemented'; } + setInnerHTML(el, value) { el.innerHtml = value; } + getText(el) { return el.text; } + setText(el, String value) => el.text = value; getValue(el) { throw 'not implemented'; } + setValue(el, String value) { throw 'not implemented'; } + getChecked(el) { throw 'not implemented'; } + setChecked(el, bool value) { throw 'not implemented'; } + createComment(String text) => new Comment(text); createTemplate(String html) => createElement('template')..innerHtml = html; createElement(tagName, [doc]) { return new Element.tag(tagName); } + createTextNode(String text, [doc]) { throw 'not implemented'; } + createScriptTag(String attrName, String attrValue, [doc]) { throw 'not implemented'; } + createStyleElement(String css, [doc]) { throw 'not implemented'; } + createShadowRoot(el) { throw 'not implemented'; } + getShadowRoot(el) { throw 'not implemented'; } + getHost(el) { throw 'not implemented'; } + clone(node) => node.clone(true); getElementsByClassName(element, String name) { throw 'not implemented'; } + getElementsByTagName(element, String name) { throw 'not implemented'; } + List classList(element) => element.classes.toList(); addClass(element, String classname) { element.classes.add(classname); } + removeClass(element, String classname) { throw 'not implemented'; } @@ -231,9 +269,11 @@ class Html5LibDomAdapter implements DomAdapter { setStyle(element, String stylename, String stylevalue) { throw 'not implemented'; } + removeStyle(element, String stylename) { throw 'not implemented'; } + getStyle(element, String stylename) { throw 'not implemented'; } @@ -248,19 +288,23 @@ class Html5LibDomAdapter implements DomAdapter { }); return map; } + hasAttribute(element, String attribute) { // `attributes` keys can be {@link AttributeName}s. return element.attributes.keys.any((key) => '$key' == attribute); } + getAttribute(element, String attribute) { // `attributes` keys can be {@link AttributeName}s. var key = element.attributes.keys.firstWhere((key) => '$key' == attribute, orElse: () {}); return element.attributes[key]; } + setAttribute(element, String name, String value) { element.attributes[name] = value; } + removeAttribute(element, String attribute) { element.attributes.remove(attribute); } @@ -282,6 +326,7 @@ class Html5LibDomAdapter implements DomAdapter { bool isTemplateElement(Element el) { return el != null && el.localName.toLowerCase() == 'template'; } + bool isTextNode(node) => node.nodeType == Node.TEXT_NODE; bool isCommentNode(node) => node.nodeType == Node.COMMENT_NODE; @@ -290,63 +335,83 @@ class Html5LibDomAdapter implements DomAdapter { bool hasShadowRoot(node) { throw 'not implemented'; } + bool isShadowRoot(node) { throw 'not implemented'; } + importIntoDoc(node) { throw 'not implemented'; } + adoptNode(node) { throw 'not implemented'; } + bool isPageRule(rule) { throw 'not implemented'; } + bool isStyleRule(rule) { throw 'not implemented'; } + bool isMediaRule(rule) { throw 'not implemented'; } + bool isKeyframesRule(rule) { throw 'not implemented'; } + String getHref(element) { throw 'not implemented'; } + void resolveAndSetHref(element, baseUrl, href) { throw 'not implemented'; } + List cssToRules(String css) { throw 'not implemented'; } + List getDistributedNodes(Node) { throw 'not implemented'; } + bool supportsDOMEvents() { return false; } + bool supportsNativeShadowDOM() { return false; } + getHistory() { throw 'not implemented'; } + getLocation() { throw 'not implemented'; } + getBaseHref() { throw 'not implemented'; } + String getUserAgent() { throw 'not implemented'; } + void setData(Element element, String name, String value) { this.setAttribute(element, 'data-${name}', value); } + String getData(Element element, String name) { return this.getAttribute(element, 'data-${name}'); } + // TODO(tbosch): move this into a separate environment class once we have it setGlobalVar(String name, value) { // noop on the server diff --git a/modules/angular2/src/facade/async.dart b/modules/angular2/src/facade/async.dart index a54328a211..c17dfd4362 100644 --- a/modules/angular2/src/facade/async.dart +++ b/modules/angular2/src/facade/async.dart @@ -46,6 +46,7 @@ class TimerWrapper { fn(); }); } + static void clearInterval(Timer timer) { timer.cancel(); } diff --git a/modules/angular2/src/facade/collection.dart b/modules/angular2/src/facade/collection.dart index 259e2a75b8..cdbfdf9d48 100644 --- a/modules/angular2/src/facade/collection.dart +++ b/modules/angular2/src/facade/collection.dart @@ -42,22 +42,25 @@ class MapWrapper { static Map toStringMap(Map m) => m; static Map createFromPairs(List pairs) => pairs.fold({}, (m, p) { - m[p[0]] = p[1]; - return m; - }); + m[p[0]] = p[1]; + return m; + }); static forEach(Map m, fn(v, k)) { m.forEach((k, v) => fn(v, k)); } + static get(Map map, key) => map[key]; static int size(Map m) => m.length; static void delete(Map m, k) { m.remove(k); } + static void clearValues(Map m) { for (var k in m.keys) { m[k] = null; } } + static Iterable iterable(Map m) => new IterableMap(m); static List keys(Map m) => m.keys.toList(); static List values(Map m) => m.values.toList(); @@ -70,12 +73,15 @@ class StringMapWrapper { static void set(Map map, key, value) { map[key] = value; } + static void delete(Map m, k) { m.remove(k); } + static void forEach(Map m, fn(v, k)) { m.forEach((k, v) => fn(v, k)); } + static Map merge(Map a, Map b) { var m = new Map.from(a); if (b != null) { @@ -83,9 +89,11 @@ class StringMapWrapper { } return m; } + static List keys(Map a) { return a.keys.toList(); } + static bool isEmpty(Map m) => m.isEmpty; static bool equals(Map m1, Map m2) { if (m1.length != m2.length) { @@ -111,6 +119,7 @@ class ListWrapper { static void set(List m, int k, v) { m[k] = v; } + static bool contains(List m, k) => m.contains(k); static List map(list, fn(item)) => list.map(fn).toList(); static List filter(List list, bool fn(item)) => list.where(fn).toList(); @@ -124,9 +133,11 @@ class ListWrapper { static void forEach(Iterable list, fn(item)) { list.forEach(fn); } + static reduce(List list, fn(a, b), init) { return list.fold(init, fn); } + static first(List list) => list.isEmpty ? null : list.first; static last(List list) => list.isEmpty ? null : list.last; static List reversed(List list) => list.reversed.toList(); @@ -136,25 +147,30 @@ class ListWrapper { ..setRange(0, a.length, a) ..setRange(a.length, a.length + b.length, b); } + static void insert(List l, int index, value) { l.insert(index, value); } + static removeAt(List l, int index) => l.removeAt(index); static void removeAll(List list, List items) { for (var i = 0; i < items.length; ++i) { list.remove(items[i]); } } + static removeLast(List list) => list.removeLast(); static bool remove(List list, item) => list.remove(item); static void clear(List l) { l.clear(); } + static String join(List l, String s) => l.join(s); static bool isEmpty(Iterable list) => list.isEmpty; static void fill(List l, value, [int start = 0, int end]) { l.fillRange(_startOffset(l, start), _endOffset(l, end), value); } + static bool equals(List a, List b) { if (a.length != b.length) return false; for (var i = 0; i < a.length; ++i) { @@ -162,9 +178,11 @@ class ListWrapper { } return true; } + static List slice(List l, [int from = 0, int to]) { return l.sublist(_startOffset(l, from), _endOffset(l, to)); } + static List splice(List l, int from, int length) { from = _startOffset(l, from); var to = from + length; @@ -172,6 +190,7 @@ class ListWrapper { l.removeRange(from, to); return sub; } + static void sort(List l, [compareFn(a, b) = null]) { if (compareFn == null) { l.sort(); diff --git a/modules/angular2/src/facade/intl.dart b/modules/angular2/src/facade/intl.dart index b3c6ef81db..46fd827b88 100644 --- a/modules/angular2/src/facade/intl.dart +++ b/modules/angular2/src/facade/intl.dart @@ -8,8 +8,10 @@ enum NumberFormatStyle { DECIMAL, PERCENT, CURRENCY } class NumberFormatter { static String format(num number, String locale, NumberFormatStyle style, - {int minimumIntegerDigits: 1, int minimumFractionDigits: 0, - int maximumFractionDigits: 3, String currency, + {int minimumIntegerDigits: 1, + int minimumFractionDigits: 0, + int maximumFractionDigits: 3, + String currency, bool currencyAsSymbol: false}) { locale = _normalizeLocale(locale); NumberFormat formatter; diff --git a/modules/angular2/src/facade/lang.dart b/modules/angular2/src/facade/lang.dart index d7d5570c5c..41be6fbde6 100644 --- a/modules/angular2/src/facade/lang.dart +++ b/modules/angular2/src/facade/lang.dart @@ -20,9 +20,11 @@ int ENUM_INDEX(value) => value.index; class CONST { const CONST(); } + class ABSTRACT { const ABSTRACT(); } + class IMPLEMENTS { final interfaceClass; const IMPLEMENTS(this.interfaceClass); @@ -161,12 +163,15 @@ class RegExpWrapper { return new RegExp(regExpStr, multiLine: multiLine, caseSensitive: caseSensitive); } + static Match firstMatch(RegExp regExp, String input) { return regExp.firstMatch(input); } + static bool test(RegExp regExp, String input) { return regExp.hasMatch(input); } + static Iterator matcher(RegExp regExp, String input) { return regExp.allMatches(input).iterator; } @@ -263,19 +268,28 @@ class Json { } class DateWrapper { - static DateTime create(int year, [int month = 1, int day = 1, int hour = 0, - int minutes = 0, int seconds = 0, int milliseconds = 0]) { + static DateTime create(int year, + [int month = 1, + int day = 1, + int hour = 0, + int minutes = 0, + int seconds = 0, + int milliseconds = 0]) { return new DateTime(year, month, day, hour, minutes, seconds, milliseconds); } + static DateTime fromMillis(int ms) { return new DateTime.fromMillisecondsSinceEpoch(ms, isUtc: true); } + static int toMillis(DateTime date) { return date.millisecondsSinceEpoch; } + static DateTime now() { return new DateTime.now(); } + static String toJson(DateTime date) { return date.toUtc().toIso8601String(); } diff --git a/modules/angular2/src/profile/wtf_impl.dart b/modules/angular2/src/profile/wtf_impl.dart index 21471bf998..19e11a4c53 100644 --- a/modules/angular2/src/profile/wtf_impl.dart +++ b/modules/angular2/src/profile/wtf_impl.dart @@ -12,7 +12,7 @@ var context = null; var _trace; var _events; var _createScope; -var _leaveScope; +var _leaveScope; var _beginTimeRange; var _endTimeRange; final List _arg1 = [null]; @@ -39,14 +39,14 @@ int getArgSize(String signature) { int end = signature.indexOf(')', start); bool found = false; int count = 0; - for(var i = start; i < end; i++) { + for (var i = start; i < end; i++) { var ch = signature[i]; if (identical(ch, ',')) { found = false; } if (!found) { found = true; - count ++; + count++; } } return count; @@ -56,24 +56,24 @@ dynamic createScope(String signature, [flags]) { _arg2[0] = signature; _arg2[1] = flags; var jsScope = _createScope.apply(_arg2, thisArg: _events); - switch(getArgSize(signature)) { + switch (getArgSize(signature)) { case 0: - return ([arg0, arg1]) { - return jsScope.apply(const []); - }; + return ([arg0, arg1]) { + return jsScope.apply(const []); + }; case 1: - return ([arg0, arg1]) { - _arg1[0] = arg0; - return jsScope.apply(_arg1); - }; + return ([arg0, arg1]) { + _arg1[0] = arg0; + return jsScope.apply(_arg1); + }; case 2: - return ([arg0, arg1]) { - _arg2[0] = arg0; - _arg2[1] = arg1; - return jsScope.apply(_arg1); - }; + return ([arg0, arg1]) { + _arg2[0] = arg0; + _arg2[1] = arg1; + return jsScope.apply(_arg1); + }; default: - throw "Max 2 arguments are supported."; + throw "Max 2 arguments are supported."; } } diff --git a/modules/angular2/src/reflection/reflection_capabilities.dart b/modules/angular2/src/reflection/reflection_capabilities.dart index 292eeb6eca..2023b9b427 100644 --- a/modules/angular2/src/reflection/reflection_capabilities.dart +++ b/modules/angular2/src/reflection/reflection_capabilities.dart @@ -49,188 +49,183 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities { return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) => create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10]).reflectee; case 11: - return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) => create( - name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11]).reflectee; + return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) => + create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11]) + .reflectee; case 12: - return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) => create( - name, [ - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12 - ]).reflectee; + return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12) => + create(name, [a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12]) + .reflectee; case 13: return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13) => create(name, [ - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13 - ]).reflectee; + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13 + ]).reflectee; case 14: return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14) => create(name, [ - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13, - a14 - ]).reflectee; + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14 + ]).reflectee; case 15: return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, - a15) => create(name, [ - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13, - a14, - a15 - ]).reflectee; + a15) => + create(name, [ + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15 + ]).reflectee; case 16: return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, - a15, a16) => create(name, [ - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13, - a14, - a15, - a16 - ]).reflectee; + a15, a16) => + create(name, [ + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16 + ]).reflectee; case 17: return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, - a15, a16, a17) => create(name, [ - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13, - a14, - a15, - a16, - a17 - ]).reflectee; + a15, a16, a17) => + create(name, [ + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17 + ]).reflectee; case 18: return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, - a15, a16, a17, a18) => create(name, [ - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13, - a14, - a15, - a16, - a17, - a18 - ]).reflectee; + a15, a16, a17, a18) => + create(name, [ + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18 + ]).reflectee; case 19: return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, - a15, a16, a17, a18, a19) => create(name, [ - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13, - a14, - a15, - a16, - a17, - a18, - a19 - ]).reflectee; + a15, a16, a17, a18, a19) => + create(name, [ + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19 + ]).reflectee; case 20: return (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, - a15, a16, a17, a18, a19, a20) => create(name, [ - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9, - a10, - a11, - a12, - a13, - a14, - a15, - a16, - a17, - a18, - a19, - a20 - ]).reflectee; + a15, a16, a17, a18, a19, a20) => + create(name, [ + a1, + a2, + a3, + a4, + a5, + a6, + a7, + a8, + a9, + a10, + a11, + a12, + a13, + a14, + a15, + a16, + a17, + a18, + a19, + a20 + ]).reflectee; } throw "Cannot create a factory for '${stringify(type)}' because its constructor has more than 20 arguments"; diff --git a/modules/angular2/src/render/dom/events/hammer_gestures.dart b/modules/angular2/src/render/dom/events/hammer_gestures.dart index b66f700606..14efa41aaf 100644 --- a/modules/angular2/src/render/dom/events/hammer_gestures.dart +++ b/modules/angular2/src/render/dom/events/hammer_gestures.dart @@ -30,9 +30,13 @@ class HammerGesturesPlugin extends HammerGesturesPluginCommon { var mc = new js.JsObject(js.context['Hammer'], [element]); var jsObj = mc.callMethod('get', ['pinch']); - jsObj.callMethod('set', [new js.JsObject.jsify({'enable': true})]); + jsObj.callMethod('set', [ + new js.JsObject.jsify({'enable': true}) + ]); jsObj = mc.callMethod('get', ['rotate']); - jsObj.callMethod('set', [new js.JsObject.jsify({'enable': true})]); + jsObj.callMethod('set', [ + new js.JsObject.jsify({'enable': true}) + ]); mc.callMethod('on', [ eventName, diff --git a/modules/angular2/src/test_lib/fake_async.dart b/modules/angular2/src/test_lib/fake_async.dart index 3e3d9ca8ce..d4ca5d042f 100644 --- a/modules/angular2/src/test_lib/fake_async.dart +++ b/modules/angular2/src/test_lib/fake_async.dart @@ -23,25 +23,25 @@ Function fakeAsync(Function fn) { throw 'fakeAsync() calls can not be nested'; } - return ([a0 = _u, a1 = _u, a2 = _u, a3 = _u, a4 = _u, a5 = _u, a6 = _u, - a7 = _u, a8 = _u, a9 = _u]) { + return ( + [a0 = _u, + a1 = _u, + a2 = _u, + a3 = _u, + a4 = _u, + a5 = _u, + a6 = _u, + a7 = _u, + a8 = _u, + a9 = _u]) { // runZoned() to install a custom exception handler that re-throws return runZoned(() { return new quiver.FakeAsync().run((quiver.FakeAsync async) { try { _fakeAsync = async; - List args = [ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7, - a8, - a9 - ].takeWhile((a) => a != _u).toList(); + List args = [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9] + .takeWhile((a) => a != _u) + .toList(); var res = Function.apply(fn, args); _fakeAsync.flushMicrotasks(); @@ -84,8 +84,7 @@ void tick([int millis = 0]) { * This is not needed in Dart. Because quiver correctly removes a timer when * it throws an exception. */ -void clearPendingTimers() { -} +void clearPendingTimers() {} /** * Flush any pending microtasks. diff --git a/modules/angular2/src/test_lib/spies.dart b/modules/angular2/src/test_lib/spies.dart index 3aa7e07ce2..0e0cee62fb 100644 --- a/modules/angular2/src/test_lib/spies.dart +++ b/modules/angular2/src/test_lib/spies.dart @@ -35,6 +35,7 @@ class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef { } @proxy -class SpyIterableDifferFactory extends SpyObject implements IterableDifferFactory { +class SpyIterableDifferFactory extends SpyObject + implements IterableDifferFactory { noSuchMethod(m) => super.noSuchMethod(m); } diff --git a/modules/angular2/src/transform/common/annotation_matcher.dart b/modules/angular2/src/transform/common/annotation_matcher.dart index 014ed8ae3c..92c29a7c3b 100644 --- a/modules/angular2/src/transform/common/annotation_matcher.dart +++ b/modules/angular2/src/transform/common/annotation_matcher.dart @@ -86,7 +86,8 @@ class AnnotationMatcher extends ClassMatcherBase { ClassDescriptor descriptor = firstMatch(annotation.name, assetId); if (descriptor == null) return false; return implements(descriptor, interfaces, - missingSuperClassWarning: 'Missing `custom_annotation` entry for `${descriptor.superClass}`.'); + missingSuperClassWarning: + 'Missing `custom_annotation` entry for `${descriptor.superClass}`.'); } /// Checks if an [Annotation] node implements [Injectable]. diff --git a/modules/angular2/src/transform/common/class_matcher_base.dart b/modules/angular2/src/transform/common/class_matcher_base.dart index f62e0f4bbf..4bd3939cc9 100644 --- a/modules/angular2/src/transform/common/class_matcher_base.dart +++ b/modules/angular2/src/transform/common/class_matcher_base.dart @@ -48,8 +48,8 @@ abstract class ClassMatcherBase { if (descriptor == null) return false; if (interfaces.contains(descriptor)) return true; if (descriptor.superClass == null) return false; - var superClass = _classDescriptors.firstWhere( - (a) => a.name == descriptor.superClass, orElse: () => null); + var superClass = _classDescriptors + .firstWhere((a) => a.name == descriptor.superClass, orElse: () => null); if (superClass == null) { if (missingSuperClassWarning != null && missingSuperClassWarning.isNotEmpty) { @@ -74,7 +74,8 @@ ImportDirective _getMatchingImport( name = className.name; } if (name != descriptor.name) return null; - return (className.root as CompilationUnit).directives + return (className.root as CompilationUnit) + .directives .where((d) => d is ImportDirective) .firstWhere((ImportDirective i) { var importMatch = false; @@ -106,8 +107,10 @@ bool isMatch( class ClassDescriptor { /// The name of the class. final String name; + /// A `package:` style import path to the file where the class is defined. final String import; + /// The class that this class extends or implements. This is the only optional /// field. final String superClass; diff --git a/modules/angular2/src/transform/common/directive_metadata_reader.dart b/modules/angular2/src/transform/common/directive_metadata_reader.dart index 7d948bc59d..d9e7170d94 100644 --- a/modules/angular2/src/transform/common/directive_metadata_reader.dart +++ b/modules/angular2/src/transform/common/directive_metadata_reader.dart @@ -108,7 +108,8 @@ class _DirectiveMetadataVisitor extends Object var directiveType = _getDirectiveType('${node.name}', node.element); if (directiveType >= 0) { if (_hasMeta) { - throw new FormatException('Only one Directive is allowed per class. ' + throw new FormatException( + 'Only one Directive is allowed per class. ' 'Found "$node" but already processed "$meta".', '$node' /* source */); } @@ -125,7 +126,8 @@ class _DirectiveMetadataVisitor extends Object '${node.constructorName.type.name}', node.staticElement); if (directiveType >= 0) { if (_hasMeta) { - throw new FormatException('Only one Directive is allowed per class. ' + throw new FormatException( + 'Only one Directive is allowed per class. ' 'Found "$node" but already processed "$meta".', '$node' /* source */); } @@ -177,8 +179,10 @@ class _DirectiveMetadataVisitor extends Object String _expressionToString(Expression node, String nodeDescription) { var value = node.accept(_evaluator); if (value is! String) { - throw new FormatException('Angular 2 could not understand the value ' - 'in $nodeDescription.', '$node' /* source */); + throw new FormatException( + 'Angular 2 could not understand the value ' + 'in $nodeDescription.', + '$node' /* source */); } return value; } @@ -203,7 +207,8 @@ class _DirectiveMetadataVisitor extends Object if (evaluated is! bool) { throw new FormatException( 'Angular 2 expects a bool but could not understand the value for ' - 'Directive#compileChildren.', '$compileChildrenValue' /* source */); + 'Directive#compileChildren.', + '$compileChildrenValue' /* source */); } _compileChildren = evaluated; } @@ -216,7 +221,8 @@ class _DirectiveMetadataVisitor extends Object if (evaluated is! Map) { throw new FormatException( 'Angular 2 expects a Map but could not understand the value for ' - '$propertyName.', '$expression' /* source */); + '$propertyName.', + '$expression' /* source */); } evaluated.forEach((key, value) { if (value != null) { @@ -233,7 +239,8 @@ class _DirectiveMetadataVisitor extends Object if (evaluated is! List) { throw new FormatException( 'Angular 2 expects a List but could not understand the value for ' - '$propertyName.', '$expression' /* source */); + '$propertyName.', + '$expression' /* source */); } list.addAll(evaluated); } diff --git a/modules/angular2/src/transform/common/logging.dart b/modules/angular2/src/transform/common/logging.dart index c74ca2dd3a..20e51b2730 100644 --- a/modules/angular2/src/transform/common/logging.dart +++ b/modules/angular2/src/transform/common/logging.dart @@ -40,6 +40,7 @@ class PrintLogger implements BuildLogger { void error(msg, {AssetId asset, SourceSpan span}) { throw new PrintLoggerError(msg, asset, span); } + Future writeOutput() => null; Future addLogFilesFromAsset(AssetId id, [int nextNumber = 1]) => null; } diff --git a/modules/angular2/src/transform/common/options.dart b/modules/angular2/src/transform/common/options.dart index 877b69f136..13752ad207 100644 --- a/modules/angular2/src/transform/common/options.dart +++ b/modules/angular2/src/transform/common/options.dart @@ -51,25 +51,41 @@ class TransformerOptions { /// The "correct" number of phases varies with the structure of the app. final int optimizationPhases; - TransformerOptions._internal(this.entryPoints, this.reflectionEntryPoints, - this.modeName, this.mirrorMode, this.initReflector, - this.annotationMatcher, this.optimizationPhases, - this.generateChangeDetectors, this.inlineViews); + TransformerOptions._internal( + this.entryPoints, + this.reflectionEntryPoints, + this.modeName, + this.mirrorMode, + this.initReflector, + this.annotationMatcher, + this.optimizationPhases, + this.generateChangeDetectors, + this.inlineViews); factory TransformerOptions(List entryPoints, - {List reflectionEntryPoints, String modeName: 'release', - MirrorMode mirrorMode: MirrorMode.none, bool initReflector: true, + {List reflectionEntryPoints, + String modeName: 'release', + MirrorMode mirrorMode: MirrorMode.none, + bool initReflector: true, List customAnnotationDescriptors: const [], int optimizationPhases: DEFAULT_OPTIMIZATION_PHASES, - bool inlineViews: true, bool generateChangeDetectors: true}) { + bool inlineViews: true, + bool generateChangeDetectors: true}) { if (reflectionEntryPoints == null || reflectionEntryPoints.isEmpty) { reflectionEntryPoints = entryPoints; } var annotationMatcher = new AnnotationMatcher() ..addAll(customAnnotationDescriptors); optimizationPhases = optimizationPhases.isNegative ? 0 : optimizationPhases; - return new TransformerOptions._internal(entryPoints, reflectionEntryPoints, - modeName, mirrorMode, initReflector, annotationMatcher, - optimizationPhases, generateChangeDetectors, inlineViews); + return new TransformerOptions._internal( + entryPoints, + reflectionEntryPoints, + modeName, + mirrorMode, + initReflector, + annotationMatcher, + optimizationPhases, + generateChangeDetectors, + inlineViews); } } diff --git a/modules/angular2/src/transform/common/registered_type.dart b/modules/angular2/src/transform/common/registered_type.dart index 3fdd5561a6..b1834d7c41 100644 --- a/modules/angular2/src/transform/common/registered_type.dart +++ b/modules/angular2/src/transform/common/registered_type.dart @@ -10,12 +10,16 @@ import 'package:angular2/src/transform/common/names.dart'; class RegisteredType { /// The type registered by this call. final Identifier typeName; + /// The actual call to `Reflector#registerType`. final MethodInvocation registerMethod; + /// The factory method registered. final Expression factoryFn; + /// The parameters registered. final Expression parameters; + /// The annotations registered. final Expression annotations; diff --git a/modules/angular2/src/transform/deferred_rewriter/rewriter.dart b/modules/angular2/src/transform/deferred_rewriter/rewriter.dart index d821517b82..9414880c6f 100644 --- a/modules/angular2/src/transform/deferred_rewriter/rewriter.dart +++ b/modules/angular2/src/transform/deferred_rewriter/rewriter.dart @@ -44,8 +44,8 @@ class Rewriter { visitor.loadLibraryInvocations.sort(compare); var buf = new StringBuffer(); - var idx = visitor.deferredImports.fold(0, - (int lastIdx, ImportDirective node) { + var idx = + visitor.deferredImports.fold(0, (int lastIdx, ImportDirective node) { buf.write(code.substring(lastIdx, node.offset)); var import = code.substring(node.offset, node.end); @@ -120,8 +120,7 @@ class _FindDeferredLibraries extends Object with RecursiveAstVisitor { .map((asset) => _reader.hasInput(asset))); // Filter out any deferred imports that do not have ng_deps. - deferredImports = it - .zip([deferredImports, hasInputs]) + deferredImports = it.zip([deferredImports, hasInputs]) .where((importHasInput) => importHasInput[1]) .map((importHasInput) => importHasInput[0]) .toList(); diff --git a/modules/angular2/src/transform/directive_linker/linker.dart b/modules/angular2/src/transform/directive_linker/linker.dart index caa8a7d422..4c2c8d093e 100644 --- a/modules/angular2/src/transform/directive_linker/linker.dart +++ b/modules/angular2/src/transform/directive_linker/linker.dart @@ -116,5 +116,6 @@ Future> _processNgImports(AssetReader reader, retVal[directive] = ngDepsUri; } }, onError: (_) => null); - })).then((_) => retVal); + })) + .then((_) => retVal); } diff --git a/modules/angular2/src/transform/directive_processor/rewriter.dart b/modules/angular2/src/transform/directive_processor/rewriter.dart index 31ae3566b6..82c4175a1b 100644 --- a/modules/angular2/src/transform/directive_processor/rewriter.dart +++ b/modules/angular2/src/transform/directive_processor/rewriter.dart @@ -30,9 +30,14 @@ Future createNgDeps(AssetReader reader, AssetId assetId, // TODO(kegluneq): Shortcut if we can determine that there are no // [Directive]s present, taking into account `export`s. var writer = new AsyncStringWriter(); - var visitor = new CreateNgDepsVisitor(writer, assetId, - new XhrImpl(reader, assetId), annotationMatcher, _interfaceMatcher, - ngMeta, inlineViews: inlineViews); + var visitor = new CreateNgDepsVisitor( + writer, + assetId, + new XhrImpl(reader, assetId), + annotationMatcher, + _interfaceMatcher, + ngMeta, + inlineViews: inlineViews); var code = await reader.readAsString(assetId); parseCompilationUnit(code, name: assetId.path).accept(visitor); @@ -76,9 +81,14 @@ class CreateNgDepsVisitor extends Object with SimpleAstVisitor { /// The assetId for the file which we are parsing. final AssetId assetId; - CreateNgDepsVisitor(AsyncStringWriter writer, AssetId assetId, XHR xhr, - AnnotationMatcher annotationMatcher, InterfaceMatcher interfaceMatcher, - this.ngMeta, {bool inlineViews}) + CreateNgDepsVisitor( + AsyncStringWriter writer, + AssetId assetId, + XHR xhr, + AnnotationMatcher annotationMatcher, + InterfaceMatcher interfaceMatcher, + this.ngMeta, + {bool inlineViews}) : writer = writer, _copyVisitor = new ToSourceVisitor(writer), _factoryVisitor = new FactoryTransformVisitor(writer), diff --git a/modules/angular2/src/transform/directive_processor/visitors.dart b/modules/angular2/src/transform/directive_processor/visitors.dart index dde4c46aa0..810fb05f80 100644 --- a/modules/angular2/src/transform/directive_processor/visitors.dart +++ b/modules/angular2/src/transform/directive_processor/visitors.dart @@ -124,6 +124,7 @@ class _CtorTransformVisitor extends ToSourceVisitor { } @override + /// Overridden to avoid outputting grouping operators for default parameters. Object visitFormalParameterList(FormalParameterList node) { writer.print('('); diff --git a/modules/angular2/src/transform/reflection_remover/codegen.dart b/modules/angular2/src/transform/reflection_remover/codegen.dart index 83edf5bfa9..3e5897ec08 100644 --- a/modules/angular2/src/transform/reflection_remover/codegen.dart +++ b/modules/angular2/src/transform/reflection_remover/codegen.dart @@ -9,6 +9,7 @@ class Codegen { /// The prefix used to import our generated file. final String prefix; + /// The import uris final Iterable importUris; diff --git a/modules/angular2/src/transform/reflection_remover/rewriter.dart b/modules/angular2/src/transform/reflection_remover/rewriter.dart index ae8121f596..2a01465d33 100644 --- a/modules/angular2/src/transform/reflection_remover/rewriter.dart +++ b/modules/angular2/src/transform/reflection_remover/rewriter.dart @@ -16,8 +16,10 @@ class Rewriter { final MirrorMode _mirrorMode; final bool _writeStaticInit; - Rewriter(this._code, this._codegen, {AstTester tester, - MirrorMode mirrorMode: MirrorMode.none, bool writeStaticInit: true}) + Rewriter(this._code, this._codegen, + {AstTester tester, + MirrorMode mirrorMode: MirrorMode.none, + bool writeStaticInit: true}) : _mirrorMode = mirrorMode, _writeStaticInit = writeStaticInit, _tester = tester == null ? const AstTester() : tester; @@ -132,9 +134,8 @@ class _RewriterVisitor extends Object with RecursiveAstVisitor { 'Found bootstrap${node.argumentList}. Transform may not succeed.'); } - var reflectorInit = _setupAdded - ? '' - : ', () { ${_getStaticReflectorInitBlock()} }'; + var reflectorInit = + _setupAdded ? '' : ', () { ${_getStaticReflectorInitBlock()} }'; // rewrite `bootstrap(...)` to `bootstrapStatic(...)` buf.write('bootstrapStatic(${args[0]}'); diff --git a/modules/angular2/src/transform/template_compiler/change_detector_codegen.dart b/modules/angular2/src/transform/template_compiler/change_detector_codegen.dart index 6aa0642153..105fa555e3 100644 --- a/modules/angular2/src/transform/template_compiler/change_detector_codegen.dart +++ b/modules/angular2/src/transform/template_compiler/change_detector_codegen.dart @@ -18,8 +18,10 @@ import 'package:angular2/src/facade/lang.dart' show BaseException; class Codegen { /// Stores the generated class definitions. final StringBuffer _buf = new StringBuffer(); + /// Stores all generated initialization code. final StringBuffer _initBuf = new StringBuffer(); + /// The names of already generated classes. final Set _names = new Set(); @@ -78,12 +80,18 @@ class _CodegenState { final CodegenNameUtil _names; final bool _generateCheckNoChanges; - _CodegenState._(this._changeDetectorDefId, this._contextTypeName, - this._changeDetectorTypeName, String changeDetectionStrategy, - this._records, this._directiveRecords, this._logic, this._names, + _CodegenState._( + this._changeDetectorDefId, + this._contextTypeName, + this._changeDetectorTypeName, + String changeDetectionStrategy, + this._records, + this._directiveRecords, + this._logic, + this._names, this._generateCheckNoChanges) - : _changeDetectionMode = ChangeDetectionUtil - .changeDetectionMode(changeDetectionStrategy); + : _changeDetectionMode = + ChangeDetectionUtil.changeDetectionMode(changeDetectionStrategy); factory _CodegenState(String typeName, String changeDetectorTypeName, ChangeDetectorDefinition def) { @@ -92,8 +100,15 @@ class _CodegenState { var protoRecords = coalesce(recBuilder.records); var names = new CodegenNameUtil(protoRecords, def.directiveRecords, _UTIL); var logic = new CodegenLogicUtil(names, _UTIL); - return new _CodegenState._(def.id, typeName, changeDetectorTypeName, - def.strategy, protoRecords, def.directiveRecords, logic, names, + return new _CodegenState._( + def.id, + typeName, + changeDetectorTypeName, + def.strategy, + protoRecords, + def.directiveRecords, + logic, + names, def.generateCheckNoChanges); } diff --git a/modules/angular2/src/transform/template_compiler/generator.dart b/modules/angular2/src/transform/template_compiler/generator.dart index 6248298981..b7a060a6bc 100644 --- a/modules/angular2/src/transform/template_compiler/generator.dart +++ b/modules/angular2/src/transform/template_compiler/generator.dart @@ -39,8 +39,8 @@ Future processTemplates(AssetReader reader, AssetId entryPoint, // Note: TemplateCloner(-1) never serializes Nodes into strings. // we might want to change this to TemplateCloner(0) to force the serialization // later when the transformer also stores the proto view template. - var extractor = new _TemplateExtractor( - new DomElementSchemaRegistry(), new TemplateCloner(-1), new XhrImpl(reader, entryPoint)); + var extractor = new _TemplateExtractor(new DomElementSchemaRegistry(), + new TemplateCloner(-1), new XhrImpl(reader, entryPoint)); var registrations = new reg.Codegen(); var changeDetectorClasses = new change.Codegen(); @@ -93,7 +93,8 @@ class _TemplateExtractor { ElementSchemaRegistry _schemaRegistry; TemplateCloner _templateCloner; - _TemplateExtractor(ElementSchemaRegistry schemaRegistry, TemplateCloner templateCloner, XHR xhr) + _TemplateExtractor(ElementSchemaRegistry schemaRegistry, + TemplateCloner templateCloner, XHR xhr) : _factory = new CompileStepFactory(new ng.Parser(new ng.Lexer())) { var urlResolver = new UrlResolver(); var styleUrlResolver = new StyleUrlResolver(urlResolver); @@ -120,10 +121,12 @@ class _TemplateExtractor { var pipeline = new CompilePipeline(_factory.createSteps(viewDef)); var compileElements = pipeline.processElements( - DOM.createTemplate(templateAndStyles.template), ViewType.COMPONENT, + DOM.createTemplate(templateAndStyles.template), + ViewType.COMPONENT, viewDef); - var protoViewDto = - compileElements[0].inheritedProtoView.build(_schemaRegistry, _templateCloner); + var protoViewDto = compileElements[0] + .inheritedProtoView + .build(_schemaRegistry, _templateCloner); reflector.reflectionCapabilities = savedReflectionCapabilities; diff --git a/modules/angular2/src/transform/template_compiler/reflection_capabilities.dart b/modules/angular2/src/transform/template_compiler/reflection_capabilities.dart index 9c24e6fe3c..07246fb47f 100644 --- a/modules/angular2/src/transform/template_compiler/reflection_capabilities.dart +++ b/modules/angular2/src/transform/template_compiler/reflection_capabilities.dart @@ -39,8 +39,10 @@ _nullMethod(Object p, List a) => null; class RecordingReflectionCapabilities extends NullReflectionCapabilities { /// The names of all requested `getter`s. final Set getterNames = new Set(); + /// The names of all requested `setter`s. final Set setterNames = new Set(); + /// The names of all requested `method`s. final Set methodNames = new Set(); diff --git a/modules/angular2/src/web-workers/ui/application.dart b/modules/angular2/src/web-workers/ui/application.dart index 3961f252fe..f40da98726 100644 --- a/modules/angular2/src/web-workers/ui/application.dart +++ b/modules/angular2/src/web-workers/ui/application.dart @@ -65,8 +65,8 @@ class UIMessageBusSource extends MessageBusSource { rawDataStream = port.asBroadcastStream(); Future get sink => rawDataStream.firstWhere((message) { - return message is SendPort; - }); + return message is SendPort; + }); int addListener(Function fn) { var subscription = rawDataStream.listen((message) { diff --git a/modules/angular2/src/web-workers/ui/event_serializer.dart b/modules/angular2/src/web-workers/ui/event_serializer.dart index ef06212e64..ebe2a13122 100644 --- a/modules/angular2/src/web-workers/ui/event_serializer.dart +++ b/modules/angular2/src/web-workers/ui/event_serializer.dart @@ -63,8 +63,16 @@ final Map EVENT_PROPERTIES = { // List of all elements with HTML value attribute. // Taken from: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes -final Set NODES_WITH_VALUE = - new Set.from(["input", "select", "option", "button", "li", "meter", "progress", "param"]); +final Set NODES_WITH_VALUE = new Set.from([ + "input", + "select", + "option", + "button", + "li", + "meter", + "progress", + "param" +]); Map serializeGenericEvent(dynamic e) { return serializeEvent(e, EVENT_PROPERTIES); @@ -76,6 +84,7 @@ Map serializeEventWithValue(dynamic e) { var serializedEvent = serializeEvent(e, EVENT_PROPERTIES); return addValue(e, serializedEvent); } + Map serializeMouseEvent(dynamic e) { return serializeEvent(e, MOUSE_EVENT_PROPERTIES); } @@ -87,7 +96,7 @@ Map serializeKeyboardEvent(dynamic e) { // TODO(jteplitz602): #3374. See above. Map addValue(dynamic e, Map serializedEvent) { - if (NODES_WITH_VALUE.contains(e.target.tagName.toLowerCase())){ + if (NODES_WITH_VALUE.contains(e.target.tagName.toLowerCase())) { serializedEvent['target'] = {'value': e.target.value}; } return serializedEvent; diff --git a/modules/angular2/src/web-workers/worker/event_deserializer.dart b/modules/angular2/src/web-workers/worker/event_deserializer.dart index 170179437b..9e3db72fb7 100644 --- a/modules/angular2/src/web-workers/worker/event_deserializer.dart +++ b/modules/angular2/src/web-workers/worker/event_deserializer.dart @@ -31,10 +31,10 @@ class GenericEvent { Point get page => _getPoint('page'); Point get screen => _getPoint('screen'); - EventTarget get target{ - if (_target != null){ + EventTarget get target { + if (_target != null) { return _target; - } else if (properties.containsKey("target")){ + } else if (properties.containsKey("target")) { _target = new EventTarget(properties['target']); return _target; } else { diff --git a/modules/angular2/test/benchmark/transform/bind_generator/simple.dart b/modules/angular2/test/benchmark/transform/bind_generator/simple.dart index ce431f3714..6e60956e28 100644 --- a/modules/angular2/test/benchmark/transform/bind_generator/simple.dart +++ b/modules/angular2/test/benchmark/transform/bind_generator/simple.dart @@ -16,8 +16,9 @@ allTests() { Future 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 = ''' diff --git a/modules/angular2/test/benchmark/transform/directive_linker/simple.dart b/modules/angular2/test/benchmark/transform/directive_linker/simple.dart index 07c1f807ad..26084d34ee 100644 --- a/modules/angular2/test/benchmark/transform/directive_linker/simple.dart +++ b/modules/angular2/test/benchmark/transform/directive_linker/simple.dart @@ -19,7 +19,9 @@ Future 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 = ''' diff --git a/modules/angular2/test/benchmark/transform/directive_processor/simple.dart b/modules/angular2/test/benchmark/transform/directive_processor/simple.dart index 5b5ad5125e..1dde61f4ed 100644 --- a/modules/angular2/test/benchmark/transform/directive_processor/simple.dart +++ b/modules/angular2/test/benchmark/transform/directive_processor/simple.dart @@ -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 = ''' diff --git a/modules/angular2/test/benchmark/transform/reflection_remover/simple.dart b/modules/angular2/test/benchmark/transform/reflection_remover/simple.dart index f34414f060..2a140d33a2 100644 --- a/modules/angular2/test/benchmark/transform/reflection_remover/simple.dart +++ b/modules/angular2/test/benchmark/transform/reflection_remover/simple.dart @@ -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 = ''' diff --git a/modules/angular2/test/benchmark/transform/template_compiler/inline.dart b/modules/angular2/test/benchmark/transform/template_compiler/inline.dart index 2be7c8378e..72000379b4 100644 --- a/modules/angular2/test/benchmark/transform/template_compiler/inline.dart +++ b/modules/angular2/test/benchmark/transform/template_compiler/inline.dart @@ -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 = ''' diff --git a/modules/angular2/test/benchmark/transform/template_compiler/url.dart b/modules/angular2/test/benchmark/transform/template_compiler/url.dart index 1ec2ebece6..a901c74632 100644 --- a/modules/angular2/test/benchmark/transform/template_compiler/url.dart +++ b/modules/angular2/test/benchmark/transform/template_compiler/url.dart @@ -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 = ''' diff --git a/modules/angular2/test/core/compiler/directive_lifecycle_spec.dart b/modules/angular2/test/core/compiler/directive_lifecycle_spec.dart index ec88f05ed3..fb1120ee60 100644 --- a/modules/angular2/test/core/compiler/directive_lifecycle_spec.dart +++ b/modules/angular2/test/core/compiler/directive_lifecycle_spec.dart @@ -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); }); }); }); diff --git a/modules/angular2/test/core/compiler/integration_dart_spec.dart b/modules/angular2/test/core/compiler/integration_dart_spec.dart index bca7093158..229c887ee3 100644 --- a/modules/angular2/test/core/compiler/integration_dart_spec.dart +++ b/modules/angular2/test/core/compiler/integration_dart_spec.dart @@ -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: '', - 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: + '', + 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: '', - 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: '', + 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: '', - 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: '', + 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: '', - 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: '', + 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: '', - 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: '', + 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: '''''', - 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: '''''', + 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: '''''', - 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: + '''''', + 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>(), - toValue: const ['Hello', 'World']) -]) + const Binding(const TypeLiteral>(), + toValue: const ['Hello', 'World']) + ]) @View(template: '{{list}}') class TypeLiteralComponent { final List 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: '{{item}}', + template: + '{{item}}', directives: const [NgFor, DirectiveLoggingChecks]) class ComponentWithObservableList { Iterable list; diff --git a/modules/angular2/test/di/binding_dart_spec.dart b/modules/angular2/test/di/binding_dart_spec.dart index 79df12b815..ea4a2d1985 100644 --- a/modules/angular2/test/di/binding_dart_spec.dart +++ b/modules/angular2/test/di/binding_dart_spec.dart @@ -40,7 +40,9 @@ main() { } class Foo {} + class Bar extends Foo {} + fn() => null; class Annotation { diff --git a/modules/angular2/test/di/injector_dart_spec.dart b/modules/angular2/test/di/injector_dart_spec.dart index e90c6299c7..ff6a756106 100644 --- a/modules/angular2/test/di/injector_dart_spec.dart +++ b/modules/angular2/test/di/injector_dart_spec.dart @@ -7,8 +7,10 @@ import 'package:angular2/di.dart'; main() { describe('Injector', () { it('should support TypeLiteral', () { - var i = Injector.resolveAndCreate( - [bind(new TypeLiteral>()).toValue([1, 2, 3]), Foo,]); + var i = Injector.resolveAndCreate([ + bind(new TypeLiteral>()).toValue([1, 2, 3]), + Foo, + ]); expect(i.get(Foo).value).toEqual([1, 2, 3]); }); }); diff --git a/modules/angular2/test/directives/observable_list_diff_spec.dart b/modules/angular2/test/directives/observable_list_diff_spec.dart index faad5ed774..8187dea3c1 100644 --- a/modules/angular2/test/directives/observable_list_diff_spec.dart +++ b/modules/angular2/test/directives/observable_list_diff_spec.dart @@ -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); diff --git a/modules/angular2/test/facade/async_dart_spec.dart b/modules/angular2/test/facade/async_dart_spec.dart index aa6541ff22..23c030fcd2 100644 --- a/modules/angular2/test/facade/async_dart_spec.dart +++ b/modules/angular2/test/facade/async_dart_spec.dart @@ -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); + } + })); }); }); }); diff --git a/modules/angular2/test/transform/bind_generator/all_tests.dart b/modules/angular2/test/transform/bind_generator/all_tests.dart index fd3b8351ec..86a48db90d 100644 --- a/modules/angular2/test/transform/bind_generator/all_tests.dart +++ b/modules/angular2/test/transform/bind_generator/all_tests.dart @@ -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'; diff --git a/modules/angular2/test/transform/bind_generator/basic_bind_files/bar.ng_deps.dart b/modules/angular2/test/transform/bind_generator/basic_bind_files/bar.ng_deps.dart index 8983974817..75a6269812 100644 --- a/modules/angular2/test/transform/bind_generator/basic_bind_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/basic_bind_files/bar.ng_deps.dart @@ -8,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())); } diff --git a/modules/angular2/test/transform/bind_generator/basic_bind_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/bind_generator/basic_bind_files/expected/bar.ng_deps.dart index b159efdcb1..7bef603d7f 100644 --- a/modules/angular2/test/transform/bind_generator/basic_bind_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/basic_bind_files/expected/bar.ng_deps.dart @@ -8,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}); } diff --git a/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/expected/soup.ng_deps.dart index fe2854c336..56b37d6068 100644 --- a/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/expected/soup.ng_deps.dart @@ -8,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}); } diff --git a/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/soup.ng_deps.dart b/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/soup.ng_deps.dart index cca9f3b400..f42fc9d540 100644 --- a/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/soup.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/duplicate_bind_name_files/soup.ng_deps.dart @@ -8,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())); } diff --git a/modules/angular2/test/transform/bind_generator/events_files/bar.ng_deps.dart b/modules/angular2/test/transform/bind_generator/events_files/bar.ng_deps.dart index b3052f2ba2..ec672eb502 100644 --- a/modules/angular2/test/transform/bind_generator/events_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/events_files/bar.ng_deps.dart @@ -8,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())); } diff --git a/modules/angular2/test/transform/bind_generator/events_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/bind_generator/events_files/expected/bar.ng_deps.dart index 7a996a8879..60a2e348aa 100644 --- a/modules/angular2/test/transform/bind_generator/events_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/bind_generator/events_files/expected/bar.ng_deps.dart @@ -8,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}); } diff --git a/modules/angular2/test/transform/common/async_string_writer_tests.dart b/modules/angular2/test/transform/common/async_string_writer_tests.dart index 933219b195..3edef68232 100644 --- a/modules/angular2/test/transform/common/async_string_writer_tests.dart +++ b/modules/angular2/test/transform/common/async_string_writer_tests.dart @@ -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(); var completer2 = new Completer(); diff --git a/modules/angular2/test/transform/deferred_rewriter/complex_deferred_example/hello.ng_deps.dart b/modules/angular2/test/transform/deferred_rewriter/complex_deferred_example/hello.ng_deps.dart index a13c43568f..aca33a376e 100644 --- a/modules/angular2/test/transform/deferred_rewriter/complex_deferred_example/hello.ng_deps.dart +++ b/modules/angular2/test/transform/deferred_rewriter/complex_deferred_example/hello.ng_deps.dart @@ -11,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())); } diff --git a/modules/angular2/test/transform/deferred_rewriter/simple_deferred_example/hello.ng_deps.dart b/modules/angular2/test/transform/deferred_rewriter/simple_deferred_example/hello.ng_deps.dart index c4c5cb27b9..876f2aad86 100644 --- a/modules/angular2/test/transform/deferred_rewriter/simple_deferred_example/hello.ng_deps.dart +++ b/modules/angular2/test/transform/deferred_rewriter/simple_deferred_example/hello.ng_deps.dart @@ -11,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())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_export_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_export_files/bar.ng_deps.dart index d348312ec7..e3b6e9b546 100644 --- a/modules/angular2/test/transform/directive_linker/simple_export_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_export_files/bar.ng_deps.dart @@ -11,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())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_export_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_export_files/expected/bar.ng_deps.dart index ddd1ac1551..e264d8f618 100644 --- a/modules/angular2/test/transform/directive_linker/simple_export_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_export_files/expected/bar.ng_deps.dart @@ -12,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(); } diff --git a/modules/angular2/test/transform/directive_linker/simple_export_files/expected/foo.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_export_files/expected/foo.ng_deps.dart index fea254def4..03d243c3a7 100644 --- a/modules/angular2/test/transform/directive_linker/simple_export_files/expected/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_export_files/expected/foo.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_export_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_export_files/foo.ng_deps.dart index fea254def4..03d243c3a7 100644 --- a/modules/angular2/test/transform/directive_linker/simple_export_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_export_files/foo.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_files/bar.ng_deps.dart index 6ca15b94fa..21e9b029da 100644 --- a/modules/angular2/test/transform/directive_linker/simple_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_files/bar.ng_deps.dart @@ -11,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())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_files/expected/bar.ng_deps.dart index b5fd037541..d123689a7b 100644 --- a/modules/angular2/test/transform/directive_linker/simple_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_files/expected/bar.ng_deps.dart @@ -12,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(); } diff --git a/modules/angular2/test/transform/directive_linker/simple_files/expected/foo.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_files/expected/foo.ng_deps.dart index fea254def4..03d243c3a7 100644 --- a/modules/angular2/test/transform/directive_linker/simple_files/expected/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_files/expected/foo.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/directive_linker/simple_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_linker/simple_files/foo.ng_deps.dart index fea254def4..03d243c3a7 100644 --- a/modules/angular2/test/transform/directive_linker/simple_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_linker/simple_files/foo.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart index 35e9d7e9f1..2864ec8e94 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/bar.ng_deps.dart @@ -8,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart index b3685d751a..26f60e5cd1 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/absolute_export_files/foo.ng_deps.dart @@ -11,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); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/adjacent_strings_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/adjacent_strings_files/foo.ng_deps.dart index 54ed526021..4fc8f431e0 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/adjacent_strings_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/adjacent_strings_files/foo.ng_deps.dart @@ -8,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/all_tests.dart b/modules/angular2/test/transform/directive_metadata_extractor/all_tests.dart index 2c403e6030..0f697513b4 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/all_tests.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/all_tests.dart @@ -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'); diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart index 35e9d7e9f1..2864ec8e94 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/bar.ng_deps.dart @@ -8,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart index c105c71a86..64c14be88d 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_aliases_files/foo.ng_deps.dart @@ -11,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); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/changeDetection.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/changeDetection.ng_deps.dart index 054128c750..42243020da 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/changeDetection.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/changeDetection.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/compile_children.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/compile_children.ng_deps.dart index 6c473fea47..737a09c413 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/compile_children.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/compile_children.ng_deps.dart @@ -8,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/directive_export_as.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/directive_export_as.ng_deps.dart index 0b09461be9..1182cf2669 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/directive_export_as.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/directive_export_as.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/events.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/events.ng_deps.dart index a36061eee7..c86aabdc65 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/events.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/events.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/host_listeners.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/host_listeners.ng_deps.dart index d4368f2a59..693b0e0457 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/host_listeners.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/host_listeners.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/lifecycle.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/lifecycle.ng_deps.dart index cc79bab5af..b9180234b4 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/lifecycle.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/lifecycle.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/properties.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/properties.ng_deps.dart index 4447a79354..3b9098a11a 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/properties.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/properties.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/selector.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/selector.ng_deps.dart index 861349094f..fb87b628e9 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/selector.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/selector.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/too_many_directives.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/too_many_directives.ng_deps.dart index 6427189b4d..1103ff4124 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/too_many_directives.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/directive_metadata_files/too_many_directives.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/export_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/export_files/bar.ng_deps.dart index 35e9d7e9f1..2864ec8e94 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/export_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/export_files/bar.ng_deps.dart @@ -8,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/export_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/export_files/foo.ng_deps.dart index c105c71a86..64c14be88d 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/export_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/export_files/foo.ng_deps.dart @@ -11,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); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/bar.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/bar.ng_deps.dart index 3cd9b210c7..ebed259302 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/bar.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/bar.ng_deps.dart @@ -11,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); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/baz.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/baz.ng_deps.dart index d64ac31d00..8d772fa715 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/baz.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/baz.ng_deps.dart @@ -8,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())); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart index c105c71a86..64c14be88d 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/recursive_export_files/foo.ng_deps.dart @@ -11,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); } diff --git a/modules/angular2/test/transform/directive_metadata_extractor/simple_files/foo.ng_deps.dart b/modules/angular2/test/transform/directive_metadata_extractor/simple_files/foo.ng_deps.dart index 160e4371bc..0a585f4b4e 100644 --- a/modules/angular2/test/transform/directive_metadata_extractor/simple_files/foo.ng_deps.dart +++ b/modules/angular2/test/transform/directive_metadata_extractor/simple_files/foo.ng_deps.dart @@ -8,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())); } diff --git a/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart index 4e19709bce..3190acc6fe 100644 --- a/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/absolute_url_expression_files/expected/hello.ng_deps.dart @@ -11,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 [])); } diff --git a/modules/angular2/test/transform/directive_processor/all_tests.dart b/modules/angular2/test/transform/directive_processor/all_tests.dart index eb7207b251..77829d20f4 100644 --- a/modules/angular2/test/transform/directive_processor/all_tests.dart +++ b/modules/angular2/test/transform/directive_processor/all_tests.dart @@ -35,9 +35,9 @@ void allTests() { 'custom_metadata/relative_soup.dart', assetId: new AssetId('soup', 'lib/relative_soup.dart'), customDescriptors: [ - const ClassDescriptor('Soup', 'package:soup/annotations/soup.dart', - superClass: 'Component'), - ]); + const ClassDescriptor('Soup', 'package:soup/annotations/soup.dart', + superClass: 'Component'), + ]); _testProcessor( 'Requires the specified import.', 'custom_metadata/bad_soup.dart', @@ -50,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 customDescriptors: const [], AssetId assetId, - AssetReader reader, List expectedLogs, bool inlineViews: true, + {List customDescriptors: const [], + AssetId assetId, + AssetReader reader, + List expectedLogs, + bool inlineViews: true, bool isolate: false}) { var testFn = isolate ? iit : it; testFn(name, () async { @@ -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 { diff --git a/modules/angular2/test/transform/directive_processor/custom_metadata/expected/package_soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/custom_metadata/expected/package_soup.ng_deps.dart index 003aed347c..7c784c5d0e 100644 --- a/modules/angular2/test/transform/directive_processor/custom_metadata/expected/package_soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/custom_metadata/expected/package_soup.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/directive_processor/custom_metadata/expected/relative_soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/custom_metadata/expected/relative_soup.ng_deps.dart index 2a98e3ff41..a4a100a52d 100644 --- a/modules/angular2/test/transform/directive_processor/custom_metadata/expected/relative_soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/custom_metadata/expected/relative_soup.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/directive_processor/directive_aliases_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/directive_aliases_files/expected/hello.ng_deps.dart index 903b37f845..480aea055a 100644 --- a/modules/angular2/test/transform/directive_processor/directive_aliases_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/directive_aliases_files/expected/hello.ng_deps.dart @@ -13,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())); } diff --git a/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart index 2c40e0bdeb..a6afaf11e9 100644 --- a/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/expected/hello.ng_deps.dart @@ -11,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())); } diff --git a/modules/angular2/test/transform/directive_processor/interface_chain_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/interface_chain_files/expected/soup.ng_deps.dart index e8188cd44d..a1c6a556be 100644 --- a/modules/angular2/test/transform/directive_processor/interface_chain_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/interface_chain_files/expected/soup.ng_deps.dart @@ -10,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])); } diff --git a/modules/angular2/test/transform/directive_processor/interface_lifecycle_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/interface_lifecycle_files/expected/soup.ng_deps.dart index 47f911417a..d8da46f484 100644 --- a/modules/angular2/test/transform/directive_processor/interface_lifecycle_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/interface_lifecycle_files/expected/soup.ng_deps.dart @@ -10,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])); } diff --git a/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart index 0dc3c02caa..349ba7862b 100644 --- a/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/interfaces_files/expected/soup.ng_deps.dart @@ -10,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])); } diff --git a/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart index a65500b8a6..ddd0870cc5 100644 --- a/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/invalid_url_files/expected/hello.ng_deps.dart @@ -11,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())); } diff --git a/modules/angular2/test/transform/directive_processor/multiple_interface_lifecycle_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/multiple_interface_lifecycle_files/expected/soup.ng_deps.dart index e8a58a1047..6843e7c17e 100644 --- a/modules/angular2/test/transform/directive_processor/multiple_interface_lifecycle_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/multiple_interface_lifecycle_files/expected/soup.ng_deps.dart @@ -10,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])); } diff --git a/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart index 3671dd4d75..f863ef1f99 100644 --- a/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/multiple_style_urls_files/expected/hello.ng_deps.dart @@ -11,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())); } diff --git a/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart index a08bd4e2be..0a74af9b54 100644 --- a/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/multiple_style_urls_not_inlined_files/expected/hello.ng_deps.dart @@ -11,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())); } diff --git a/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ng_deps.dart index e9237a2569..a37cda3028 100644 --- a/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/parameter_metadata/expected/soup.ng_deps.dart @@ -10,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))); } diff --git a/modules/angular2/test/transform/directive_processor/prefixed_interface_lifecycle_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/prefixed_interface_lifecycle_files/expected/soup.ng_deps.dart index 66249985ef..914e941c64 100644 --- a/modules/angular2/test/transform/directive_processor/prefixed_interface_lifecycle_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/prefixed_interface_lifecycle_files/expected/soup.ng_deps.dart @@ -10,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])); } diff --git a/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart index 4b2f4db32a..a502a11d12 100644 --- a/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/split_url_expression_files/expected/hello.ng_deps.dart @@ -11,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())); } diff --git a/modules/angular2/test/transform/directive_processor/static_function_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/static_function_files/expected/hello.ng_deps.dart index b55192f087..4abe3f9f95 100644 --- a/modules/angular2/test/transform/directive_processor/static_function_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/static_function_files/expected/hello.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/directive_processor/superclass_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/superclass_files/expected/soup.ng_deps.dart index 5a2dec1325..1815f7f0ac 100644 --- a/modules/angular2/test/transform/directive_processor/superclass_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/superclass_files/expected/soup.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/directive_processor/superclass_lifecycle_files/expected/soup.ng_deps.dart b/modules/angular2/test/transform/directive_processor/superclass_lifecycle_files/expected/soup.ng_deps.dart index 94e4f6e651..d0eb3f5328 100644 --- a/modules/angular2/test/transform/directive_processor/superclass_lifecycle_files/expected/soup.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/superclass_lifecycle_files/expected/soup.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart index 31e450d880..155b083575 100644 --- a/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/directive_processor/url_expression_files/expected/hello.ng_deps.dart @@ -11,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())); } diff --git a/modules/angular2/test/transform/integration/all_tests.dart b/modules/angular2/test/transform/integration/all_tests.dart index c9d0789db9..f10786bec9 100644 --- a/modules/angular2/test/transform/integration/all_tests.dart +++ b/modules/angular2/test/transform/integration/all_tests.dart @@ -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); } } diff --git a/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ng_deps.dart index 870af15e56..de5fef1daf 100644 --- a/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/integration/list_of_types_files/expected/bar.ng_deps.dart @@ -11,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))); } diff --git a/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ng_deps.dart index 3eb5bc7433..e153d17ba4 100644 --- a/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/integration/simple_annotation_files/expected/bar.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ng_deps.dart index 3eb5bc7433..e153d17ba4 100644 --- a/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/integration/synthetic_ctor_files/expected/bar.ng_deps.dart @@ -10,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())); } diff --git a/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ng_deps.dart index 3be081861a..1e63908547 100644 --- a/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/integration/two_annotations_files/expected/bar.ng_deps.dart @@ -14,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 { 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; diff --git a/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ng_deps.dart b/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ng_deps.dart index 7ff2f9b4fc..6d99c1a3f9 100644 --- a/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ng_deps.dart +++ b/modules/angular2/test/transform/integration/two_deps_files/expected/bar.ng_deps.dart @@ -11,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))); } diff --git a/modules/angular2/test/transform/reflection_remover/all_tests.dart b/modules/angular2/test/transform/reflection_remover/all_tests.dart index e1b2c7ad57..f237e7d4e4 100644 --- a/modules/angular2/test/transform/reflection_remover/all_tests.dart +++ b/modules/angular2/test/transform/reflection_remover/all_tests.dart @@ -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)); diff --git a/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello1.ng_deps.dart b/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello1.ng_deps.dart index 35960e0ab7..e7d6cdef29 100644 --- a/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello1.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello1.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello2.ng_deps.dart b/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello2.ng_deps.dart index 79f7148de1..ce941d9226 100644 --- a/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello2.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/directive_aliases_files/hello2.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/template_compiler/duplicate_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/duplicate_files/expected/hello.ng_deps.dart index fbbf90f53d..1a75201ce0 100644 --- a/modules/angular2/test/transform/template_compiler/duplicate_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/duplicate_files/expected/hello.ng_deps.dart @@ -9,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}); } diff --git a/modules/angular2/test/transform/template_compiler/duplicate_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/duplicate_files/hello.ng_deps.dart index 6de58b238b..76afa3b819 100644 --- a/modules/angular2/test/transform/template_compiler/duplicate_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/duplicate_files/hello.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart index 98805de3d4..ef96f7070c 100644 --- a/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart @@ -9,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}}
') - ], const [const []], () => new HelloCmp())) + ..registerType( + HelloCmp, + new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: '
{{greeting}}
') + ], const [ + const [] + ], () => new HelloCmp())) ..registerGetters({'b': (o) => o.b, 'greeting': (o) => o.greeting}) ..registerSetters( {'b': (o, v) => o.b = v, 'greeting': (o, v) => o.greeting = v}); diff --git a/modules/angular2/test/transform/template_compiler/inline_expression_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/inline_expression_files/hello.ng_deps.dart index ac62a8fa2b..16d550917c 100644 --- a/modules/angular2/test/transform/template_compiler/inline_expression_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/inline_expression_files/hello.ng_deps.dart @@ -9,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}}
') - ], const [const []], () => new HelloCmp())); + ..registerType( + HelloCmp, + new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: '
{{greeting}}
') + ], const [ + const [] + ], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/inline_method_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/inline_method_files/expected/hello.ng_deps.dart index 9a1cb0f270..ff3896471f 100644 --- a/modules/angular2/test/transform/template_compiler/inline_method_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/inline_method_files/expected/hello.ng_deps.dart @@ -9,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: '') - ], const [const []], () => new HelloCmp())) + ..registerType( + HelloCmp, + new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: '') + ], const [ + const [] + ], () => new HelloCmp())) ..registerMethods( {'action': (o, List args) => Function.apply(o.action, args)}); } diff --git a/modules/angular2/test/transform/template_compiler/inline_method_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/inline_method_files/hello.ng_deps.dart index 0422745a25..0b78ebc1ed 100644 --- a/modules/angular2/test/transform/template_compiler/inline_method_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/inline_method_files/hello.ng_deps.dart @@ -9,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: '') - ], const [const []], () => new HelloCmp())); + ..registerType( + HelloCmp, + new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View(template: '') + ], const [ + const [] + ], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/ng_for_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/ng_for_files/hello.ng_deps.dart index 287c714995..6de68199e8 100644 --- a/modules/angular2/test/transform/template_compiler/ng_for_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/ng_for_files/hello.ng_deps.dart @@ -9,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: '
  • test
  • ', - directives: const [NgFor]) - ], const [const []], () => new HelloCmp())); + ..registerType( + HelloCmp, + new ReflectionInfo(const [ + const Component(selector: 'hello-app'), + const View( + template: '
  • test
  • ', + directives: const [NgFor]) + ], const [ + const [] + ], () => new HelloCmp())); } diff --git a/modules/angular2/test/transform/template_compiler/one_directive_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/one_directive_files/expected/hello.ng_deps.dart index 8932494359..8d3f4503f0 100644 --- a/modules/angular2/test/transform/template_compiler/one_directive_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/one_directive_files/expected/hello.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/template_compiler/one_directive_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/one_directive_files/hello.ng_deps.dart index 8932494359..8d3f4503f0 100644 --- a/modules/angular2/test/transform/template_compiler/one_directive_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/one_directive_files/hello.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/template_compiler/url_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/url_expression_files/expected/hello.ng_deps.dart index e788a6e937..99f5d1b6bd 100644 --- a/modules/angular2/test/transform/template_compiler/url_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/url_expression_files/expected/hello.ng_deps.dart @@ -9,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}); } diff --git a/modules/angular2/test/transform/template_compiler/url_expression_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/url_expression_files/hello.ng_deps.dart index 4d8fb2df6b..6c2b4ac37b 100644 --- a/modules/angular2/test/transform/template_compiler/url_expression_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/url_expression_files/hello.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/template_compiler/url_method_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/url_method_files/expected/hello.ng_deps.dart index 7b0af555b6..c16ff0de17 100644 --- a/modules/angular2/test/transform/template_compiler/url_method_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/url_method_files/expected/hello.ng_deps.dart @@ -9,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)}); } diff --git a/modules/angular2/test/transform/template_compiler/url_method_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/url_method_files/hello.ng_deps.dart index 4d8fb2df6b..6c2b4ac37b 100644 --- a/modules/angular2/test/transform/template_compiler/url_method_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/url_method_files/hello.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/goodbye.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/goodbye.ng_deps.dart index 530d6d039e..be86e23445 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/goodbye.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/goodbye.ng_deps.dart @@ -9,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}); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/hello.ng_deps.dart index 8b6a5dfc44..0a0826cecb 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/hello.ng_deps.dart @@ -11,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); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/ng2_prefix.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/ng2_prefix.ng_deps.dart index f1d4f3c913..29c3fb4fe9 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/ng2_prefix.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/expected/ng2_prefix.ng_deps.dart @@ -9,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}); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/goodbye.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/goodbye.ng_deps.dart index c72b2dce9b..6d8d79de61 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/goodbye.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/goodbye.ng_deps.dart @@ -9,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())); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/hello.ng_deps.dart index 8b6a5dfc44..0a0826cecb 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/hello.ng_deps.dart @@ -11,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); } diff --git a/modules/angular2/test/transform/template_compiler/with_prefix_files/ng2_prefix.ng_deps.dart b/modules/angular2/test/transform/template_compiler/with_prefix_files/ng2_prefix.ng_deps.dart index 4e1bbe8aa8..1e2488b827 100644 --- a/modules/angular2/test/transform/template_compiler/with_prefix_files/ng2_prefix.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/with_prefix_files/ng2_prefix.ng_deps.dart @@ -9,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())); } diff --git a/modules/benchmarks_external/src/naive_infinite_scroll/app.dart b/modules/benchmarks_external/src/naive_infinite_scroll/app.dart index 6a09e61630..c9e99fab10 100644 --- a/modules/benchmarks_external/src/naive_infinite_scroll/app.dart +++ b/modules/benchmarks_external/src/naive_infinite_scroll/app.dart @@ -5,7 +5,9 @@ import 'dart:html'; import 'package:angular/angular.dart'; import 'package:angular2/src/test_lib/benchmark_util.dart'; -@Component(selector: 'scroll-app', template: ''' +@Component( + selector: 'scroll-app', + template: '''
    diff --git a/modules/benchmarks_external/src/naive_infinite_scroll/cells.dart b/modules/benchmarks_external/src/naive_infinite_scroll/cells.dart index 2047361075..366d549efd 100644 --- a/modules/benchmarks_external/src/naive_infinite_scroll/cells.dart +++ b/modules/benchmarks_external/src/naive_infinite_scroll/cells.dart @@ -3,25 +3,34 @@ library cells; import 'package:angular/angular.dart'; import 'common.dart'; -@Component(selector: 'company-name', template: ''' +@Component( + selector: 'company-name', + template: '''
    {{company.name}}
    - ''', map: const {'company': '=>company', 'cell-width': '=>width',}) + ''', + map: const {'company': '=>company', 'cell-width': '=>width',}) class CompanyNameComponent { String width; Company company; } -@Component(selector: 'opportunity-name', template: ''' +@Component( + selector: 'opportunity-name', + template: '''
    {{opportunity.name}}
    - ''', map: const {'opportunity': '=>opportunity', 'cell-width': '=>width',}) + ''', + map: const {'opportunity': '=>opportunity', 'cell-width': '=>width',}) class OpportunityNameComponent { String width; Opportunity opportunity; } -@Component(selector: 'offering-name', template: ''' +@Component( + selector: 'offering-name', + template: '''
    {{offering.name}}
    - ''', map: const {'offering': '=>offering', 'cell-width': '=>width',}) + ''', + map: const {'offering': '=>offering', 'cell-width': '=>width',}) class OfferingNameComponent { String width; Offering offering; @@ -38,7 +47,9 @@ class Stage { : ''; } -@Component(selector: 'stage-buttons', template: ''' +@Component( + selector: 'stage-buttons', + template: '''
    - ''', map: const {'offering': '=>offering', 'cell-width': '=>width',}) + ''', + map: const {'offering': '=>offering', 'cell-width': '=>width',}) class StageButtonsComponent { Offering _offering; List stages; @@ -83,13 +95,16 @@ class StageButtonsComponent { } } -@Component(selector: 'account-cell', template: ''' +@Component( + selector: 'account-cell', + template: ''' - ''', map: const {'account': '=>account', 'cell-width': '=>width',}) + ''', + map: const {'account': '=>account', 'cell-width': '=>width',}) class AccountCellComponent { Account account; String width; diff --git a/modules/benchmarks_external/src/naive_infinite_scroll/common.dart b/modules/benchmarks_external/src/naive_infinite_scroll/common.dart index dd27e5a30a..e77ed3b69a 100644 --- a/modules/benchmarks_external/src/naive_infinite_scroll/common.dart +++ b/modules/benchmarks_external/src/naive_infinite_scroll/common.dart @@ -40,7 +40,8 @@ const AAT_STATUS_LIST = const ['Active', 'Passive', 'Abandoned']; // Imitate Streamy entities. -class RawEntity extends Object with MapMixin +class RawEntity extends Object + with MapMixin implements ObservableMap { ObservableMap _data = new ObservableMap(); @@ -113,10 +114,12 @@ class RawEntity extends Object with MapMixin void notifyChange(ChangeRecord record) { _data.notifyChange(record); } + @override void observed() { _data.observed(); } + @override void unobserved() { _data.observed(); diff --git a/modules/benchmarks_external/src/naive_infinite_scroll/random_data.dart b/modules/benchmarks_external/src/naive_infinite_scroll/random_data.dart index 2a1c00ce1d..b2f0f89dda 100644 --- a/modules/benchmarks_external/src/naive_infinite_scroll/random_data.dart +++ b/modules/benchmarks_external/src/naive_infinite_scroll/random_data.dart @@ -62,12 +62,8 @@ DateTime randomDate(int seed, {DateTime minDate}) { } String randomString(int seed) { - return new String.fromCharCodes(new List.generate(const [ - 5, - 7, - 9, - 11, - 13 - ][seed % 5], (i) => - 'a'.codeUnitAt(0) + const [0, 1, 2, 3, 4, 5, 6, 7, 8][seed % 9] + i)); + return new String.fromCharCodes(new List.generate( + const [5, 7, 9, 11, 13][seed % 5], + (i) => + 'a'.codeUnitAt(0) + const [0, 1, 2, 3, 4, 5, 6, 7, 8][seed % 9] + i)); } diff --git a/modules/benchmarks_external/src/naive_infinite_scroll/scroll_item.dart b/modules/benchmarks_external/src/naive_infinite_scroll/scroll_item.dart index 732a4c6eb2..2b871fd78c 100644 --- a/modules/benchmarks_external/src/naive_infinite_scroll/scroll_item.dart +++ b/modules/benchmarks_external/src/naive_infinite_scroll/scroll_item.dart @@ -24,6 +24,7 @@ class ScrollItemComponent implements ShadowRootAware { 'justify-content': 'space-between', }); } + get companyNameWidth => '${COMPANY_NAME_WIDTH}px'; get opportunityNameWidth => '${OPPORTUNITY_NAME_WIDTH}px'; get offeringNameWidth => '${OFFERING_NAME_WIDTH}px'; diff --git a/modules/benchmarks_external/src/static_tree/tree_benchmark.dart b/modules/benchmarks_external/src/static_tree/tree_benchmark.dart index 8f2740fae4..7b0a09916b 100644 --- a/modules/benchmarks_external/src/static_tree/tree_benchmark.dart +++ b/modules/benchmarks_external/src/static_tree/tree_benchmark.dart @@ -70,7 +70,8 @@ class TreeComponent0 { @Component( selector: 'tree1', map: const {'data': '=>data'}, - template: ' {{data.value}} ') + template: + ' {{data.value}} ') class TreeComponent1 { var data; } @@ -78,7 +79,8 @@ class TreeComponent1 { @Component( selector: 'tree2', map: const {'data': '=>data'}, - template: ' {{data.value}} ') + template: + ' {{data.value}} ') class TreeComponent2 { var data; } @@ -86,7 +88,8 @@ class TreeComponent2 { @Component( selector: 'tree3', map: const {'data': '=>data'}, - template: ' {{data.value}} ') + template: + ' {{data.value}} ') class TreeComponent3 { var data; } @@ -94,7 +97,8 @@ class TreeComponent3 { @Component( selector: 'tree4', map: const {'data': '=>data'}, - template: ' {{data.value}} ') + template: + ' {{data.value}} ') class TreeComponent4 { var data; } @@ -102,7 +106,8 @@ class TreeComponent4 { @Component( selector: 'tree5', map: const {'data': '=>data'}, - template: ' {{data.value}} ') + template: + ' {{data.value}} ') class TreeComponent5 { var data; } @@ -110,7 +115,8 @@ class TreeComponent5 { @Component( selector: 'tree6', map: const {'data': '=>data'}, - template: ' {{data.value}} ') + template: + ' {{data.value}} ') class TreeComponent6 { var data; } @@ -118,7 +124,8 @@ class TreeComponent6 { @Component( selector: 'tree7', map: const {'data': '=>data'}, - template: ' {{data.value}} ') + template: + ' {{data.value}} ') class TreeComponent7 { var data; } @@ -126,7 +133,8 @@ class TreeComponent7 { @Component( selector: 'tree8', map: const {'data': '=>data'}, - template: ' {{data.value}} ') + template: + ' {{data.value}} ') class TreeComponent8 { var data; } @@ -134,14 +142,16 @@ class TreeComponent8 { @Component( selector: 'tree9', map: const {'data': '=>data'}, - template: ' {{data.value}} ') + template: + ' {{data.value}} ') class TreeComponent9 { var data; } buildTree(maxDepth, values, curDepth) { if (maxDepth == curDepth) return new TreeNode(''); - return new TreeNode(values[curDepth], + return new TreeNode( + values[curDepth], buildTree(maxDepth, values, curDepth + 1), buildTree(maxDepth, values, curDepth + 1)); } diff --git a/modules/benchmarks_external/src/tree/tree_benchmark.dart b/modules/benchmarks_external/src/tree/tree_benchmark.dart index f29adbb598..f7f477a4e7 100644 --- a/modules/benchmarks_external/src/tree/tree_benchmark.dart +++ b/modules/benchmarks_external/src/tree/tree_benchmark.dart @@ -50,16 +50,17 @@ main() { selector: 'tree', map: const {'data': '=>data'}, template: ' {{data.value}}' - '' - '' - '') + '' + '' + '') class TreeComponent { var data; } buildTree(maxDepth, values, curDepth) { if (maxDepth == curDepth) return new TreeNode(''); - return new TreeNode(values[curDepth], + return new TreeNode( + values[curDepth], buildTree(maxDepth, values, curDepth + 1), buildTree(maxDepth, values, curDepth + 1)); } diff --git a/modules/examples/e2e_test/routing/routing_spec.dart b/modules/examples/e2e_test/routing/routing_spec.dart index a5e5988946..61648bc4cd 100644 --- a/modules/examples/e2e_test/routing/routing_spec.dart +++ b/modules/examples/e2e_test/routing/routing_spec.dart @@ -1,5 +1,3 @@ library examples.e2e_test.routing.routing_spec; -main() { - -} +main() {} diff --git a/modules/examples/e2e_test/web_workers/kitchen_sink/kitchen_sink_spec.dart b/modules/examples/e2e_test/web_workers/kitchen_sink/kitchen_sink_spec.dart index e64cb5819f..f82ef5dd47 100644 --- a/modules/examples/e2e_test/web_workers/kitchen_sink/kitchen_sink_spec.dart +++ b/modules/examples/e2e_test/web_workers/kitchen_sink/kitchen_sink_spec.dart @@ -1,5 +1,3 @@ library examples.e2e_test.web_workers.kitchen_sink_spec; -main() { - -} +main() {} diff --git a/modules/examples/e2e_test/web_workers/todo/todo_spec.dart b/modules/examples/e2e_test/web_workers/todo/todo_spec.dart index ef47ade78b..25b27c2975 100644 --- a/modules/examples/e2e_test/web_workers/todo/todo_spec.dart +++ b/modules/examples/e2e_test/web_workers/todo/todo_spec.dart @@ -1,5 +1,3 @@ library examples.e2e_test.web_workers.todo_spec; -main() { - -} +main() {} diff --git a/modules/examples/src/jsonp/jsonp_comp.dart b/modules/examples/src/jsonp/jsonp_comp.dart index 79df410204..e24d8407c3 100644 --- a/modules/examples/src/jsonp/jsonp_comp.dart +++ b/modules/examples/src/jsonp/jsonp_comp.dart @@ -5,7 +5,9 @@ import "package:angular2/http.dart" show Jsonp; import "package:angular2/src/facade/async.dart" show ObservableWrapper; @Component(selector: "jsonp-app") -@View(directives: const [NgFor], template: ''' +@View( + directives: const [NgFor], + template: '''

    people

    • diff --git a/modules/examples/src/message_broker/background_index.dart b/modules/examples/src/message_broker/background_index.dart index 79fe32f5fb..40b6081c31 100644 --- a/modules/examples/src/message_broker/background_index.dart +++ b/modules/examples/src/message_broker/background_index.dart @@ -4,7 +4,8 @@ import "package:angular2/src/web-workers/worker/application.dart" show WorkerMessageBus, WorkerMessageBusSource, WorkerMessageBusSink; import "package:angular2/src/web-workers/worker/broker.dart" show MessageBroker, UiArguments; -import "package:angular2/src/web-workers/shared/serializer.dart" show Serializer; +import "package:angular2/src/web-workers/shared/serializer.dart" + show Serializer; import "dart:isolate"; @@ -18,7 +19,8 @@ main(List args, SendPort replyTo) { } }); - MessageBroker broker = new MessageBroker(bus, new Serializer(null, null, null), null); + MessageBroker broker = + new MessageBroker(bus, new Serializer(null, null, null), null); var args = new UiArguments("test", "tester"); broker.runOnUiThread(args, String).then((data) { bus.sink.send({"type": "result", "value": data}); diff --git a/modules/examples/src/message_broker/index.dart b/modules/examples/src/message_broker/index.dart index bee72e3b27..8bdd7ac2ee 100644 --- a/modules/examples/src/message_broker/index.dart +++ b/modules/examples/src/message_broker/index.dart @@ -18,8 +18,7 @@ main() { querySelector("#echo_result") .appendHtml("${data['value']}"); } else if (identical(data['type'], "test")) { - bus.sink.send( - {'type': "result", 'id': data['id'], 'value': VALUE}); + bus.sink.send({'type': "result", 'id': data['id'], 'value': VALUE}); } else if (identical(data['type'], "result")) { querySelector("#ui_result") .appendHtml("${data['value']}"); diff --git a/modules/examples/test/benchpress/webdriver_async.server.spec.dart b/modules/examples/test/benchpress/webdriver_async.server.spec.dart index 8df51d565c..5700443b92 100644 --- a/modules/examples/test/benchpress/webdriver_async.server.spec.dart +++ b/modules/examples/test/benchpress/webdriver_async.server.spec.dart @@ -16,8 +16,8 @@ main() { .get('http://localhost:8002/examples/src/benchpress/index.html'); var bindings = [ - bind(WebDriverAdapter).toFactory( - () => new AsyncWebDriverAdapter(driver), []) + bind(WebDriverAdapter) + .toFactory(() => new AsyncWebDriverAdapter(driver), []) ]; runner = new Runner(bindings); }); @@ -39,8 +39,7 @@ main() { Future createTestDriver() { Map env = Platform.environment; - return WebDriver.createDriver( - desiredCapabilities: { + return WebDriver.createDriver(desiredCapabilities: { 'name': 'Dartium', 'browserName': 'chrome', 'chromeOptions': {