From fd0ba37734f1df3455346bb47df85c55d479d679 Mon Sep 17 00:00:00 2001 From: Tim Blasi Date: Tue, 20 Oct 2015 09:38:14 -0700 Subject: [PATCH] refactor(dart): Format Dart code Use the dart formatter to clean up all pure Dart code. Closes #4832 --- modules/angular2/angular2.dart | 6 +- modules/angular2/core.dart | 3 +- modules/angular2/src/core/application.dart | 3 +- .../angular2/src/core/application_static.dart | 3 +- .../change_detection_jit_generator.dart | 3 +- .../core/change_detection/codegen_facade.dart | 2 +- .../change_detection/observable_facade.dart | 2 +- .../src/core/dom/abstract_html_adapter.dart | 4 +- .../src/core/dom/browser_adapter.dart | 7 +- .../angular2/src/core/dom/emulated_css.dart | 31 ++- .../angular2/src/core/facade/collection.dart | 3 +- .../angular2/src/core/facade/exceptions.dart | 13 +- modules/angular2/src/core/facade/lang.dart | 2 +- .../angular2/src/core/linker/query_list.dart | 3 +- modules/angular2/src/core/metadata.dart | 182 ++++++++++-------- .../angular2/src/core/platform_bindings.dart | 4 +- .../reflection/reflection_capabilities.dart | 7 +- .../core/testability/browser_testability.dart | 27 ++- modules/angular2/src/core/zone/ng_zone.dart | 1 - .../src/router/route_config_nomalizer.dart | 3 +- .../src/testing/testing_internal.dart | 11 +- modules/angular2/src/tools/tools.dart | 3 +- .../src/web_workers/worker/application.dart | 6 +- .../change_detector_spec_util.dart | 2 +- .../test/core/compiler/eval_module.dart | 47 +++-- .../directives/observable_list_diff_spec.dart | 3 +- .../core/linker/directive_lifecycle_spec.dart | 70 ++++--- .../core/linker/integration_dart_spec.dart | 19 +- .../core/reflection/reflector_common.dart | 2 +- modules/angular2/test/core/spies.dart | 6 +- .../symbol_inspector/symbol_inspector.dart | 17 +- .../debug_tools/bootstrap.server.spec.dart | 2 +- .../debug_tools/message_bus_common.dart | 5 +- ...client_server_message_bus.server.spec.dart | 8 +- ...client_server_message_bus.server.spec.dart | 5 +- .../web_socket_message_bus_spec.dart | 5 +- .../shared/mock_event_emitter.dart | 3 +- .../test/web_workers/worker/spies.dart | 2 - .../common/directive_metadata_reader.dart | 9 +- .../transform/common/interface_matcher.dart | 12 +- .../src/transform/common/registered_type.dart | 10 +- .../src/transform/common/url_resolver.dart | 4 +- .../bar.ng_deps.dart | 12 +- .../expected/bar.ng_deps.dart | 12 +- 44 files changed, 326 insertions(+), 258 deletions(-) diff --git a/modules/angular2/angular2.dart b/modules/angular2/angular2.dart index 7a4a73ae17..697c5230b8 100644 --- a/modules/angular2/angular2.dart +++ b/modules/angular2/angular2.dart @@ -5,8 +5,10 @@ library angular2; * * This library does not include `bootstrap`. Import `bootstrap.dart` instead. */ -export 'package:angular2/core.dart' hide forwardRef, resolveForwardRef, ForwardRefFn; +export 'package:angular2/core.dart' + hide forwardRef, resolveForwardRef, ForwardRefFn; export 'package:angular2/profile.dart'; export 'package:angular2/lifecycle_hooks.dart'; -export 'package:angular2/src/core/application_tokens.dart' hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER; +export 'package:angular2/src/core/application_tokens.dart' + hide APP_COMPONENT_REF_PROMISE, APP_ID_RANDOM_PROVIDER; export 'package:angular2/src/core/render/dom/dom_tokens.dart'; diff --git a/modules/angular2/core.dart b/modules/angular2/core.dart index 6313ee6851..603432dc7b 100644 --- a/modules/angular2/core.dart +++ b/modules/angular2/core.dart @@ -8,7 +8,8 @@ export 'package:angular2/src/core/pipes.dart'; export 'package:angular2/src/core/facade.dart'; // Do not export application for dart. Must import from angular2/bootstrap //export 'package:angular2/src/core/application.dart'; -export 'package:angular2/src/core/application_ref.dart' hide ApplicationRef_, PlatformRef_; +export 'package:angular2/src/core/application_ref.dart' + hide ApplicationRef_, PlatformRef_; export 'package:angular2/src/core/services.dart'; export 'package:angular2/src/core/linker.dart'; export 'package:angular2/src/core/lifecycle.dart'; diff --git a/modules/angular2/src/core/application.dart b/modules/angular2/src/core/application.dart index a338922584..e0bf2835cb 100644 --- a/modules/angular2/src/core/application.dart +++ b/modules/angular2/src/core/application.dart @@ -9,7 +9,8 @@ import 'application_common.dart'; import 'package:angular2/src/core/compiler/compiler.dart'; import 'package:angular2/src/core/linker/dynamic_component_loader.dart'; -export 'package:angular2/src/core/linker/dynamic_component_loader.dart' show ComponentRef; +export 'package:angular2/src/core/linker/dynamic_component_loader.dart' + show ComponentRef; /// Starts an application from a root component. This implementation uses /// mirrors. Angular 2 transformer automatically replaces this method with a diff --git a/modules/angular2/src/core/application_static.dart b/modules/angular2/src/core/application_static.dart index 8ba5d7c70a..fac49ccf1c 100644 --- a/modules/angular2/src/core/application_static.dart +++ b/modules/angular2/src/core/application_static.dart @@ -2,7 +2,8 @@ library angular2.src.core.application_static; import 'dart:async'; import 'application_common.dart'; -import 'package:angular2/src/core/linker/dynamic_component_loader.dart' show ComponentRef; +import 'package:angular2/src/core/linker/dynamic_component_loader.dart' + show ComponentRef; /// Starts an application from a root component. /// diff --git a/modules/angular2/src/core/change_detection/change_detection_jit_generator.dart b/modules/angular2/src/core/change_detection/change_detection_jit_generator.dart index 6010a73011..7811a13b06 100644 --- a/modules/angular2/src/core/change_detection/change_detection_jit_generator.dart +++ b/modules/angular2/src/core/change_detection/change_detection_jit_generator.dart @@ -8,7 +8,8 @@ library change_detection.change_detection_jit_generator; /// `src/transform/template_compiler/change_detector_codegen.dart` for details. class ChangeDetectorJITGenerator { String typeName; - ChangeDetectorJITGenerator(definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) {} + ChangeDetectorJITGenerator( + definition, changeDetectionUtilVarName, abstractChangeDetectorVarName) {} generate() { throw "Jit Change Detection is not supported in Dart"; diff --git a/modules/angular2/src/core/change_detection/codegen_facade.dart b/modules/angular2/src/core/change_detection/codegen_facade.dart index 347c32fab1..5e995a87b1 100644 --- a/modules/angular2/src/core/change_detection/codegen_facade.dart +++ b/modules/angular2/src/core/change_detection/codegen_facade.dart @@ -16,4 +16,4 @@ String combineGeneratedStrings(List vals) { String rawString(String str) { return "r'$str'"; -} \ No newline at end of file +} diff --git a/modules/angular2/src/core/change_detection/observable_facade.dart b/modules/angular2/src/core/change_detection/observable_facade.dart index 31591ddb03..6dd8b43e6b 100644 --- a/modules/angular2/src/core/change_detection/observable_facade.dart +++ b/modules/angular2/src/core/change_detection/observable_facade.dart @@ -2,4 +2,4 @@ library change_detection.observable_facade; import 'package:observe/observe.dart'; -bool isObservable(value) => value is Observable; \ No newline at end of file +bool isObservable(value) => value is Observable; diff --git a/modules/angular2/src/core/dom/abstract_html_adapter.dart b/modules/angular2/src/core/dom/abstract_html_adapter.dart index e38156cc72..58440d39a3 100644 --- a/modules/angular2/src/core/dom/abstract_html_adapter.dart +++ b/modules/angular2/src/core/dom/abstract_html_adapter.dart @@ -340,13 +340,13 @@ abstract class AbstractHtml5LibAdapter implements DomAdapter { throw 'not implemented'; } - bool isPageRule(rule) => (rule.type == 6); + bool isPageRule(rule) => (rule.type == 6); bool isStyleRule(rule) => (rule.type == 1); bool isMediaRule(rule) => (rule.type == 4); - bool isKeyframesRule(rule) => (rule.type == 7); + bool isKeyframesRule(rule) => (rule.type == 7); String getHref(element) { throw 'not implemented'; diff --git a/modules/angular2/src/core/dom/browser_adapter.dart b/modules/angular2/src/core/dom/browser_adapter.dart index a1fb1e47c1..66fab085c6 100644 --- a/modules/angular2/src/core/dom/browser_adapter.dart +++ b/modules/angular2/src/core/dom/browser_adapter.dart @@ -98,7 +98,7 @@ final _keyCodeToKeyMap = const { final bool _supportsTemplateElement = () { try { return new TemplateElement().content != null; - } catch(_) { + } catch (_) { return false; } }(); @@ -216,7 +216,8 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { String nodeName(Node el) => el.nodeName; String nodeValue(Node el) => el.nodeValue; String type(InputElement el) => el.type; - Node content(TemplateElement el) => _supportsTemplateElement ? el.content : el; + Node content(TemplateElement el) => + _supportsTemplateElement ? el.content : el; Node firstChild(el) => el.firstChild; Node nextSibling(Node el) => el.nextNode; Element parentElement(Node el) => el.parent; @@ -456,7 +457,7 @@ class BrowserDomAdapter extends GenericBrowserDomAdapter { setGlobalVar(String path, value) { var parts = path.split('.'); var obj = js.context; - while(parts.length > 1) { + while (parts.length > 1) { var name = parts.removeAt(0); if (obj.hasProperty(name)) { obj = obj[name]; diff --git a/modules/angular2/src/core/dom/emulated_css.dart b/modules/angular2/src/core/dom/emulated_css.dart index df62906afe..4e263692e1 100644 --- a/modules/angular2/src/core/dom/emulated_css.dart +++ b/modules/angular2/src/core/dom/emulated_css.dart @@ -18,22 +18,19 @@ List parseAndEmulateCssRules(String css) { /// Converts `csslib` [rules] to their emulated counterparts. List emulateRules(Iterable rules) { - return rules - .map((cssv.TreeNode node) { - if (node is cssv.RuleSet) { - if (node.declarationGroup.span.text.isEmpty) { - // Skip CSS matchers with no bodies - return null; - } - return new EmulatedCssStyleRule(node); - } else if (node is cssv.MediaDirective) { - return new EmulatedCssMedialRule(node); - } else if (node is cssv.ImportDirective) { - return new EmulatedCssImportRule(node); + return rules.map((cssv.TreeNode node) { + if (node is cssv.RuleSet) { + if (node.declarationGroup.span.text.isEmpty) { + // Skip CSS matchers with no bodies + return null; } - }) - .where((r) => r != null) - .toList(); + return new EmulatedCssStyleRule(node); + } else if (node is cssv.MediaDirective) { + return new EmulatedCssMedialRule(node); + } else if (node is cssv.ImportDirective) { + return new EmulatedCssImportRule(node); + } + }).where((r) => r != null).toList(); } /// Emulates [CSSRule](https://developer.mozilla.org/en-US/docs/Web/API/CSSRule) @@ -98,8 +95,8 @@ class EmulatedMediaList { String mediaText; EmulatedMediaList(cssv.MediaDirective directive) { - this.mediaText = directive.mediaQueries - .map((q) => q.span.text).join(' and '); + this.mediaText = + directive.mediaQueries.map((q) => q.span.text).join(' and '); } } diff --git a/modules/angular2/src/core/facade/collection.dart b/modules/angular2/src/core/facade/collection.dart index 359356aa86..fe89a16d53 100644 --- a/modules/angular2/src/core/facade/collection.dart +++ b/modules/angular2/src/core/facade/collection.dart @@ -170,7 +170,7 @@ class ListWrapper { from = _startOffset(l, from); to = _endOffset(l, to); //in JS if from > to an empty array is returned - if(to != null && from > to) { + if (to != null && from > to) { return []; } return l.sublist(from, to); @@ -211,7 +211,6 @@ class ListWrapper { return end < 0 ? max(len + end, 0) : min(end, len); } - static maximum(List l, fn(item)) { if (l.length == 0) { return null; diff --git a/modules/angular2/src/core/facade/exceptions.dart b/modules/angular2/src/core/facade/exceptions.dart index 8629dd65cb..77f9accfbf 100644 --- a/modules/angular2/src/core/facade/exceptions.dart +++ b/modules/angular2/src/core/facade/exceptions.dart @@ -20,11 +20,18 @@ class WrappedException extends Error { final originalStack; WrappedException( - [this.wrapperMessage, this.originalException, this.originalStack, this.context]); + [this.wrapperMessage, + this.originalException, + this.originalStack, + this.context]); - get message { return ExceptionHandler.exceptionToString(this); } + get message { + return ExceptionHandler.exceptionToString(this); + } - String toString() { return this.message; } + String toString() { + return this.message; + } } Error makeTypeError([String message = ""]) { diff --git a/modules/angular2/src/core/facade/lang.dart b/modules/angular2/src/core/facade/lang.dart index 0d2fb27aa7..718c7e5b58 100644 --- a/modules/angular2/src/core/facade/lang.dart +++ b/modules/angular2/src/core/facade/lang.dart @@ -94,7 +94,7 @@ class StringWrapper { start = _startOffset(s, start); end = _endOffset(s, end); //in JS if start > end an empty string is returned - if(end != null && start > end) { + if (end != null && start > end) { return ""; } return s.substring(start, end); diff --git a/modules/angular2/src/core/linker/query_list.dart b/modules/angular2/src/core/linker/query_list.dart index 298a5bffa2..6d1d3d62c7 100644 --- a/modules/angular2/src/core/linker/query_list.dart +++ b/modules/angular2/src/core/linker/query_list.dart @@ -6,8 +6,7 @@ import 'package:angular2/src/core/facade/async.dart'; /** * See query_list.ts */ -class QueryList extends Object - with IterableMixin { +class QueryList extends Object with IterableMixin { List _results = []; EventEmitter _emitter = new EventEmitter(); diff --git a/modules/angular2/src/core/metadata.dart b/modules/angular2/src/core/metadata.dart index 3cdbd85d57..b0f4f4608f 100644 --- a/modules/angular2/src/core/metadata.dart +++ b/modules/angular2/src/core/metadata.dart @@ -14,85 +14,102 @@ export './metadata/view.dart' hide VIEW_ENCAPSULATION_VALUES; * See: [DirectiveMetadata] for docs. */ class Directive extends DirectiveMetadata { - const Directive({String selector, List inputs, - List outputs, - @deprecated List properties, - @deprecated List events, - Map host, - @deprecated List bindings, - List providers, String exportAs, String moduleId, - Map queries}) - : super( - selector: selector, - inputs: inputs, - outputs: outputs, - properties: properties, - events: events, - host: host, - bindings: bindings, - providers: providers, - exportAs: exportAs, - moduleId: moduleId, - queries: queries); + const Directive( + {String selector, + List inputs, + List outputs, + @deprecated List properties, + @deprecated List events, + Map host, + @deprecated List bindings, + List providers, + String exportAs, + String moduleId, + Map queries}) + : super( + selector: selector, + inputs: inputs, + outputs: outputs, + properties: properties, + events: events, + host: host, + bindings: bindings, + providers: providers, + exportAs: exportAs, + moduleId: moduleId, + queries: queries); } /** * See: [ComponentMetadata] for docs. */ class Component extends ComponentMetadata { - const Component({String selector, List inputs, - List outputs, - @deprecated List properties, - @deprecated List events, - Map host, - @deprecated List bindings, List providers, String exportAs, String moduleId, - Map queries, - @deprecated List viewBindings, - List viewProviders, ChangeDetectionStrategy changeDetection, - String templateUrl, String template, dynamic directives, - dynamic pipes, ViewEncapsulation encapsulation, List styles, - List styleUrls - }) - : super( - selector: selector, - inputs: inputs, - outputs: outputs, - properties: properties, - events: events, - host: host, - bindings: bindings, - providers: providers, - exportAs: exportAs, - moduleId: moduleId, - viewBindings: viewBindings, - viewProviders: viewProviders, - queries: queries, - changeDetection: changeDetection, - templateUrl: templateUrl, - template: template, - directives: directives, - pipes: pipes, - encapsulation: encapsulation, - styles: styles, - styleUrls: styleUrls - ); + const Component( + {String selector, + List inputs, + List outputs, + @deprecated List properties, + @deprecated List events, + Map host, + @deprecated List bindings, + List providers, + String exportAs, + String moduleId, + Map queries, + @deprecated List viewBindings, + List viewProviders, + ChangeDetectionStrategy changeDetection, + String templateUrl, + String template, + dynamic directives, + dynamic pipes, + ViewEncapsulation encapsulation, + List styles, + List styleUrls}) + : super( + selector: selector, + inputs: inputs, + outputs: outputs, + properties: properties, + events: events, + host: host, + bindings: bindings, + providers: providers, + exportAs: exportAs, + moduleId: moduleId, + viewBindings: viewBindings, + viewProviders: viewProviders, + queries: queries, + changeDetection: changeDetection, + templateUrl: templateUrl, + template: template, + directives: directives, + pipes: pipes, + encapsulation: encapsulation, + styles: styles, + styleUrls: styleUrls); } /** * See: [ViewMetadata] for docs. */ class View extends ViewMetadata { - const View({String templateUrl, String template, dynamic directives, - dynamic pipes, ViewEncapsulation encapsulation, List styles, - List styleUrls}) - : super( - templateUrl: templateUrl, - template: template, - directives: directives, - pipes: pipes, - encapsulation: encapsulation, - styles: styles, - styleUrls: styleUrls); + const View( + {String templateUrl, + String template, + dynamic directives, + dynamic pipes, + ViewEncapsulation encapsulation, + List styles, + List styleUrls}) + : super( + templateUrl: templateUrl, + template: template, + directives: directives, + pipes: pipes, + encapsulation: encapsulation, + styles: styles, + styleUrls: styleUrls); } /** @@ -114,23 +131,23 @@ class Attribute extends AttributeMetadata { */ class Query extends QueryMetadata { const Query(dynamic /*Type | string*/ selector, {bool descendants: false}) - : super(selector, descendants: descendants); + : super(selector, descendants: descendants); } /** * See: [ContentChildrenMetadata] for docs. */ class ContentChildren extends ContentChildrenMetadata { - const ContentChildren(dynamic /*Type | string*/ selector, {bool descendants: false}) - : super(selector, descendants: descendants); + const ContentChildren(dynamic /*Type | string*/ selector, + {bool descendants: false}) + : super(selector, descendants: descendants); } /** * See: [ContentChildMetadata] for docs. */ class ContentChild extends ContentChildMetadata { - const ContentChild(dynamic /*Type | string*/ selector) - : super(selector); + const ContentChild(dynamic /*Type | string*/ selector) : super(selector); } /** @@ -138,47 +155,42 @@ class ContentChild extends ContentChildMetadata { */ class ViewQuery extends ViewQueryMetadata { const ViewQuery(dynamic /*Type | string*/ selector) - : super(selector, descendants: true); + : super(selector, descendants: true); } /** * See: [ViewChildrenMetadata] for docs. */ class ViewChildren extends ViewChildrenMetadata { - const ViewChildren(dynamic /*Type | string*/ selector) - : super(selector); + const ViewChildren(dynamic /*Type | string*/ selector) : super(selector); } /** * See: [ViewChildMetadata] for docs. */ class ViewChild extends ViewChildMetadata { - const ViewChild(dynamic /*Type | string*/ selector) - : super(selector); + const ViewChild(dynamic /*Type | string*/ selector) : super(selector); } /** * See: [InputMetadata] for docs. */ class Input extends InputMetadata { - const Input([String bindingPropertyName]) - : super(bindingPropertyName); + const Input([String bindingPropertyName]) : super(bindingPropertyName); } /** * See: [OutputMetadata] for docs. */ class Output extends OutputMetadata { - const Output([String bindingPropertyName]) - : super(bindingPropertyName); + const Output([String bindingPropertyName]) : super(bindingPropertyName); } /** * See: [HostBindingMetadata] for docs. */ class HostBinding extends HostBindingMetadata { - const HostBinding([String hostPropertyName]) - : super(hostPropertyName); + const HostBinding([String hostPropertyName]) : super(hostPropertyName); } /** @@ -186,5 +198,5 @@ class HostBinding extends HostBindingMetadata { */ class HostListener extends HostListenerMetadata { const HostListener(String eventName, [List args]) - : super(eventName, args); -} \ No newline at end of file + : super(eventName, args); +} diff --git a/modules/angular2/src/core/platform_bindings.dart b/modules/angular2/src/core/platform_bindings.dart index 9298e4155b..a386b20a66 100644 --- a/modules/angular2/src/core/platform_bindings.dart +++ b/modules/angular2/src/core/platform_bindings.dart @@ -1,12 +1,12 @@ library angular2.src.core.platform_bindings; - import 'package:angular2/core.dart'; import 'package:angular2/src/core/facade/exceptions.dart'; import 'package:angular2/src/core/dom/dom_adapter.dart'; exceptionFactory() => new ExceptionHandler(DOM, true); -const EXCEPTION_PROVIDER = const Binding(ExceptionHandler, toFactory: exceptionFactory, deps: const []); +const EXCEPTION_PROVIDER = const Binding(ExceptionHandler, + toFactory: exceptionFactory, deps: const []); const EXCEPTION_BINDING = EXCEPTION_PROVIDER; diff --git a/modules/angular2/src/core/reflection/reflection_capabilities.dart b/modules/angular2/src/core/reflection/reflection_capabilities.dart index 6f10add97d..533922d4a7 100644 --- a/modules/angular2/src/core/reflection/reflection_capabilities.dart +++ b/modules/angular2/src/core/reflection/reflection_capabilities.dart @@ -259,7 +259,7 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities { Map propMetadata(typeOrFunc) { final res = {}; - reflectClass(typeOrFunc).declarations.forEach((k,v) { + reflectClass(typeOrFunc).declarations.forEach((k, v) { var name = _normalizeName(MirrorSystem.getName(k)); if (res[name] == null) res[name] = []; res[name].addAll(v.metadata.map((fm) => fm.reflectee)); @@ -277,8 +277,9 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities { List _interfacesFromMirror(classMirror) { return classMirror.superinterfaces.map((si) => si.reflectedType).toList() - ..addAll(classMirror.superclass == null ? [] - : _interfacesFromMirror(classMirror.superclass)); + ..addAll(classMirror.superclass == null + ? [] + : _interfacesFromMirror(classMirror.superclass)); } GetterFn getter(String name) { diff --git a/modules/angular2/src/core/testability/browser_testability.dart b/modules/angular2/src/core/testability/browser_testability.dart index 5b48cb5c9c..9c56d8ac72 100644 --- a/modules/angular2/src/core/testability/browser_testability.dart +++ b/modules/angular2/src/core/testability/browser_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); }); } @@ -91,17 +100,17 @@ class BrowserGetTestability implements GetTestability { static init() { setTestabilityGetter(const BrowserGetTestability()); } - + void addToWindow(TestabilityRegistry registry) { var jsRegistry = js.context['ngTestabilityRegistries']; if (jsRegistry == null) { js.context['ngTestabilityRegistries'] = jsRegistry = new js.JsArray(); - js.context['getAngularTestability'] = _jsify((Element elem, - [bool findInAncestors = true]) { + js.context['getAngularTestability'] = + _jsify((Element elem, [bool findInAncestors = true]) { var registry = js.context['ngTestabilityRegistries']; for (int i = 0; i < registry.length; i++) { - var result = registry[i].callMethod( - 'getAngularTestability', [elem, findInAncestors]); + var result = registry[i] + .callMethod('getAngularTestability', [elem, findInAncestors]); if (result != null) return result; } throw 'Could not find testability for element.'; @@ -122,8 +131,8 @@ class BrowserGetTestability implements GetTestability { js.JsObject _createRegistry(TestabilityRegistry registry) { var object = new js.JsObject(js.context['Object']); - object['getAngularTestability'] = _jsify((Element elem, - bool findInAncestors) { + object['getAngularTestability'] = + _jsify((Element elem, bool findInAncestors) { var testability = registry.findTestabilityInTree(elem, findInAncestors); return testability == null ? null diff --git a/modules/angular2/src/core/zone/ng_zone.dart b/modules/angular2/src/core/zone/ng_zone.dart index 5ffbe7985e..90b851ae0d 100644 --- a/modules/angular2/src/core/zone/ng_zone.dart +++ b/modules/angular2/src/core/zone/ng_zone.dart @@ -214,7 +214,6 @@ class NgZone { try { _inVmTurnDone = true; parent.run(_innerZone, _onTurnDone); - } finally { _inVmTurnDone = false; _hasExecutedCodeInInnerZone = false; diff --git a/modules/angular2/src/router/route_config_nomalizer.dart b/modules/angular2/src/router/route_config_nomalizer.dart index c28f7027f2..f063eaa051 100644 --- a/modules/angular2/src/router/route_config_nomalizer.dart +++ b/modules/angular2/src/router/route_config_nomalizer.dart @@ -9,6 +9,7 @@ RouteDefinition normalizeRouteConfig(RouteDefinition config) { void assertComponentExists(Type component, String path) { if (component == null) { - throw new BaseException('Component for route "${path}" is not defined, or is not a class.'); + throw new BaseException( + 'Component for route "${path}" is not defined, or is not a class.'); } } diff --git a/modules/angular2/src/testing/testing_internal.dart b/modules/angular2/src/testing/testing_internal.dart index 253048b89b..e2c896250d 100644 --- a/modules/angular2/src/testing/testing_internal.dart +++ b/modules/angular2/src/testing/testing_internal.dart @@ -67,7 +67,6 @@ void testSetup() { }, priority: 1); } - /** * Allows overriding default bindings defined in test_injector.js. * @@ -93,14 +92,16 @@ void beforeEachBindings(Function fn) { } void beforeEach(fn) { - if (fn is! FunctionWithParamTokens) fn = new FunctionWithParamTokens([], fn, false); + if (fn is! FunctionWithParamTokens) fn = + new FunctionWithParamTokens([], fn, false); gns.beforeEach(() { fn.execute(_injector); }); } void _it(gnsFn, name, fn) { - if (fn is! FunctionWithParamTokens) fn = new FunctionWithParamTokens([], fn, false); + if (fn is! FunctionWithParamTokens) fn = + new FunctionWithParamTokens([], fn, false); gnsFn(name, () { _inIt = true; fn.execute(_injector); @@ -139,7 +140,9 @@ class SpyObject extends gns.SpyObject { _spyFuncs.putIfAbsent(funcName, () => new SpyFunction(funcName)); void prop(String funcName, value) { - _spyFuncs.putIfAbsent("get:${funcName}", () => new SpyFunction(funcName)).andReturn(value); + _spyFuncs + .putIfAbsent("get:${funcName}", () => new SpyFunction(funcName)) + .andReturn(value); } static stub([object = null, config = null, overrides = null]) { diff --git a/modules/angular2/src/tools/tools.dart b/modules/angular2/src/tools/tools.dart index 51c43cb243..11f3fd693b 100644 --- a/modules/angular2/src/tools/tools.dart +++ b/modules/angular2/src/tools/tools.dart @@ -1,7 +1,8 @@ library angular2.src.tools.tools; import 'dart:js'; -import 'package:angular2/src/core/linker/dynamic_component_loader.dart' show ComponentRef; +import 'package:angular2/src/core/linker/dynamic_component_loader.dart' + show ComponentRef; import 'common_tools.dart' show AngularTools; /** diff --git a/modules/angular2/src/web_workers/worker/application.dart b/modules/angular2/src/web_workers/worker/application.dart index 7ad5d3a4b6..5b3f057af9 100644 --- a/modules/angular2/src/web_workers/worker/application.dart +++ b/modules/angular2/src/web_workers/worker/application.dart @@ -5,7 +5,8 @@ import "package:angular2/src/web_workers/worker/application_common.dart" show bootstrapWebWorkerCommon; import "package:angular2/src/core/facade/async.dart" show Future; import "package:angular2/src/core/facade/lang.dart" show Type, BaseException; -import "package:angular2/src/core/linker/dynamic_component_loader.dart" show ComponentRef; +import "package:angular2/src/core/linker/dynamic_component_loader.dart" + show ComponentRef; import "dart:isolate"; import "dart:async"; import 'dart:core'; @@ -22,8 +23,7 @@ import 'package:angular2/src/core/dom/webworker_adapter.dart'; * bootstrap() in a regular Angular application * See the bootstrap() docs for more details. */ -Future bootstrapWebWorker( - SendPort replyTo, Type appComponentType, +Future bootstrapWebWorker(SendPort replyTo, Type appComponentType, [List componentInjectableBindings = null]) { WebWorkerDomAdapter.makeCurrent(); ReceivePort rPort = new ReceivePort(); diff --git a/modules/angular2/test/core/change_detection/change_detector_spec_util.dart b/modules/angular2/test/core/change_detection/change_detector_spec_util.dart index 889e71d6cb..4678fa002f 100644 --- a/modules/angular2/test/core/change_detection/change_detector_spec_util.dart +++ b/modules/angular2/test/core/change_detection/change_detector_spec_util.dart @@ -24,4 +24,4 @@ class Entity implements Observable { bool deliverChanges() => null; notifyPropertyChange(Symbol field, Object oldValue, Object newValue) => null; void notifyChange(record) {} -} \ No newline at end of file +} diff --git a/modules/angular2/test/core/compiler/eval_module.dart b/modules/angular2/test/core/compiler/eval_module.dart index e2fb01e2fa..ac44414ce0 100644 --- a/modules/angular2/test/core/compiler/eval_module.dart +++ b/modules/angular2/test/core/compiler/eval_module.dart @@ -3,7 +3,7 @@ import "dart:async"; Uri toDartDataUri(String source) { return Uri.parse("data:application/dart;charset=utf-8," - "${Uri.encodeComponent(source)}"); + "${Uri.encodeComponent(source)}"); } createIsolateSource(String moduleSource, List> moduleImports) { @@ -24,27 +24,32 @@ main(List args, SendPort replyPort) { var timeStamp = new DateTime.now().millisecondsSinceEpoch; -dynamic callModule(dynamic data) { return data.map( (a) => a+1); } +dynamic callModule(dynamic data) { + return data.map((a) => a + 1); +} evalModule(String moduleSource, List> imports, List args) { - String source = createIsolateSource(moduleSource, imports); - Completer completer = new Completer(); - RawReceivePort receivePort; - receivePort = new RawReceivePort( (message) { - receivePort.close(); - completer.complete(message); - }); - // Note: we have a special karma plugin that sends files under - // urls like /package_1234 as permanently cached. - // With this, spawning multiple isolates gets faster as Darts does not - // reload the files from the server. - var packageRoot = Uri.parse('/packages_${timeStamp}'); - return Isolate.spawnUri(toDartDataUri(source), args, receivePort.sendPort, packageRoot: packageRoot).then( (isolate) { - RawReceivePort errorPort; - errorPort = new RawReceivePort( (message) { - completer.completeError(message); - }); - isolate.addErrorListener(errorPort.sendPort); - return completer.future; + String source = createIsolateSource(moduleSource, imports); + Completer completer = new Completer(); + RawReceivePort receivePort; + receivePort = new RawReceivePort((message) { + receivePort.close(); + completer.complete(message); + }); + // Note: we have a special karma plugin that sends files under + // urls like /package_1234 as permanently cached. + // With this, spawning multiple isolates gets faster as Darts does not + // reload the files from the server. + var packageRoot = Uri.parse('/packages_${timeStamp}'); + return Isolate + .spawnUri(toDartDataUri(source), args, receivePort.sendPort, + packageRoot: packageRoot) + .then((isolate) { + RawReceivePort errorPort; + errorPort = new RawReceivePort((message) { + completer.completeError(message); }); + isolate.addErrorListener(errorPort.sendPort); + return completer.future; + }); } diff --git a/modules/angular2/test/core/directives/observable_list_diff_spec.dart b/modules/angular2/test/core/directives/observable_list_diff_spec.dart index da9504216d..28f13e08ae 100644 --- a/modules/angular2/test/core/directives/observable_list_diff_spec.dart +++ b/modules/angular2/test/core/directives/observable_list_diff_spec.dart @@ -2,7 +2,8 @@ library angular2.test.directives.observable_list_iterable_diff_spec; import 'package:angular2/testing_internal.dart'; import 'package:observe/observe.dart' show ObservableList; -import 'package:angular2/core.dart' show ObservableListDiffFactory, ChangeDetectorRef; +import 'package:angular2/core.dart' + show ObservableListDiffFactory, ChangeDetectorRef; @proxy class SpyChangeDetectorRef extends SpyObject implements ChangeDetectorRef { diff --git a/modules/angular2/test/core/linker/directive_lifecycle_spec.dart b/modules/angular2/test/core/linker/directive_lifecycle_spec.dart index 0765b34b21..321ff61d9d 100644 --- a/modules/angular2/test/core/linker/directive_lifecycle_spec.dart +++ b/modules/angular2/test/core/linker/directive_lifecycle_spec.dart @@ -7,96 +7,106 @@ import 'package:angular2/src/core/linker/interfaces.dart'; main() { describe('Create DirectiveMetadata', () { describe('lifecycle', () { - describe("onChanges", () { it("should be true when the directive has the onChanges method", () { - expect(hasLifecycleHook(LifecycleHooks.OnChanges, DirectiveImplementingOnChanges)) + expect(hasLifecycleHook( + LifecycleHooks.OnChanges, DirectiveImplementingOnChanges)) .toBe(true); }); it("should be false otherwise", () { - expect(hasLifecycleHook(LifecycleHooks.OnChanges, DirectiveNoHooks)).toBe(false); + expect(hasLifecycleHook(LifecycleHooks.OnChanges, DirectiveNoHooks)) + .toBe(false); }); }); describe("onDestroy", () { it("should be true when the directive has the onDestroy method", () { - expect(hasLifecycleHook(LifecycleHooks.OnDestroy, DirectiveImplementingOnDestroy)) + expect(hasLifecycleHook( + LifecycleHooks.OnDestroy, DirectiveImplementingOnDestroy)) .toBe(true); }); it("should be false otherwise", () { - expect(hasLifecycleHook(LifecycleHooks.OnDestroy, DirectiveNoHooks)).toBe(false); + expect(hasLifecycleHook(LifecycleHooks.OnDestroy, DirectiveNoHooks)) + .toBe(false); }); }); describe("onInit", () { it("should be true when the directive has the onInit method", () { - expect(hasLifecycleHook(LifecycleHooks.OnInit, DirectiveImplementingOnInit)) - .toBe(true); + expect(hasLifecycleHook( + LifecycleHooks.OnInit, DirectiveImplementingOnInit)).toBe(true); }); it("should be false otherwise", () { - expect(hasLifecycleHook(LifecycleHooks.OnInit, DirectiveNoHooks)).toBe(false); + expect(hasLifecycleHook(LifecycleHooks.OnInit, DirectiveNoHooks)) + .toBe(false); }); }); describe("doCheck", () { it("should be true when the directive has the doCheck method", () { - expect(hasLifecycleHook(LifecycleHooks.DoCheck, DirectiveImplementingOnCheck)) - .toBe(true); + expect(hasLifecycleHook( + LifecycleHooks.DoCheck, DirectiveImplementingOnCheck)).toBe(true); }); it("should be false otherwise", () { - expect(hasLifecycleHook(LifecycleHooks.DoCheck, DirectiveNoHooks)).toBe(false); + expect(hasLifecycleHook(LifecycleHooks.DoCheck, DirectiveNoHooks)) + .toBe(false); }); }); describe("afterContentInit", () { - it("should be true when the directive has the afterContentInit method", () { - expect(hasLifecycleHook(LifecycleHooks.AfterContentInit, DirectiveImplementingAfterContentInit)) - .toBe(true); + it("should be true when the directive has the afterContentInit method", + () { + expect(hasLifecycleHook(LifecycleHooks.AfterContentInit, + DirectiveImplementingAfterContentInit)).toBe(true); }); it("should be false otherwise", () { - expect(hasLifecycleHook(LifecycleHooks.AfterContentInit, DirectiveNoHooks)) - .toBe(false); + expect(hasLifecycleHook( + LifecycleHooks.AfterContentInit, DirectiveNoHooks)).toBe(false); }); }); describe("afterContentChecked", () { - it("should be true when the directive has the afterContentChecked method", () { - expect(hasLifecycleHook(LifecycleHooks.AfterContentChecked, DirectiveImplementingAfterContentChecked)) - .toBe(true); + it("should be true when the directive has the afterContentChecked method", + () { + expect(hasLifecycleHook(LifecycleHooks.AfterContentChecked, + DirectiveImplementingAfterContentChecked)).toBe(true); }); it("should be false otherwise", () { - expect(hasLifecycleHook(LifecycleHooks.AfterContentChecked, DirectiveNoHooks)) + expect(hasLifecycleHook( + LifecycleHooks.AfterContentChecked, DirectiveNoHooks)) .toBe(false); }); }); - describe("afterViewInit", () { - it("should be true when the directive has the afterViewInit method", () { - expect(hasLifecycleHook(LifecycleHooks.AfterViewInit, DirectiveImplementingAfterViewInit)) - .toBe(true); + it("should be true when the directive has the afterViewInit method", + () { + expect(hasLifecycleHook(LifecycleHooks.AfterViewInit, + DirectiveImplementingAfterViewInit)).toBe(true); }); it("should be false otherwise", () { - expect(hasLifecycleHook(LifecycleHooks.AfterViewInit, DirectiveNoHooks)).toBe(false); + expect(hasLifecycleHook( + LifecycleHooks.AfterViewInit, DirectiveNoHooks)).toBe(false); }); }); describe("afterViewChecked", () { - it("should be true when the directive has the afterViewChecked method", () { - expect(hasLifecycleHook(LifecycleHooks.AfterViewChecked, DirectiveImplementingAfterViewChecked)) - .toBe(true); + it("should be true when the directive has the afterViewChecked method", + () { + expect(hasLifecycleHook(LifecycleHooks.AfterViewChecked, + DirectiveImplementingAfterViewChecked)).toBe(true); }); it("should be false otherwise", () { - expect(hasLifecycleHook(LifecycleHooks.AfterViewChecked, DirectiveNoHooks)) - .toBe(false); + expect(hasLifecycleHook( + LifecycleHooks.AfterViewChecked, DirectiveNoHooks)).toBe(false); }); }); }); diff --git a/modules/angular2/test/core/linker/integration_dart_spec.dart b/modules/angular2/test/core/linker/integration_dart_spec.dart index ba880f7d31..6abfbdfd0d 100644 --- a/modules/angular2/test/core/linker/integration_dart_spec.dart +++ b/modules/angular2/test/core/linker/integration_dart_spec.dart @@ -149,7 +149,8 @@ main() { .createAsync(Dummy) .then((tc) { tc.detectChanges(); - var cmp = tc.debugElement.componentViewChildren[0].inject(OnChangeComponent); + var cmp = tc.debugElement.componentViewChildren[0] + .inject(OnChangeComponent); expect(cmp.prop).toEqual('hello'); expect(cmp.changes.containsKey('prop')).toEqual(true); async.done(); @@ -171,12 +172,14 @@ main() { directives: [ComponentWithObservableList])) .createAsync(Dummy) .then((tc) { - tc.debugElement.componentInstance.value = new ObservableList.from([1, 2]); + tc.debugElement.componentInstance.value = + new ObservableList.from([1, 2]); tc.detectChanges(); expect(log.result()).toEqual("check"); - expect(asNativeElements(tc.debugElement.componentViewChildren)).toHaveText('12'); + expect(asNativeElements(tc.debugElement.componentViewChildren)) + .toHaveText('12'); tc.detectChanges(); @@ -195,7 +198,8 @@ main() { .toHaveText('123'); // we replaced the list => a check - tc.debugElement.componentInstance.value = new ObservableList.from([5, 6, 7]); + tc.debugElement.componentInstance.value = + new ObservableList.from([5, 6, 7]); tc.detectChanges(); @@ -264,9 +268,7 @@ class NoPropertyAccess { final model = new PropModel(); } -@Component( - selector: 'on-change', - inputs: const ['prop']) +@Component(selector: 'on-change', inputs: const ['prop']) @View(template: '') class OnChangeComponent implements OnChanges { Map changes; @@ -297,8 +299,7 @@ class ComponentWithObservableList { Iterable list; } -@Directive( - selector: 'directive-logging-checks') +@Directive(selector: 'directive-logging-checks') class DirectiveLoggingChecks implements DoCheck { Log log; diff --git a/modules/angular2/test/core/reflection/reflector_common.dart b/modules/angular2/test/core/reflection/reflector_common.dart index d6ee459713..4a3b307ac4 100644 --- a/modules/angular2/test/core/reflection/reflector_common.dart +++ b/modules/angular2/test/core/reflection/reflector_common.dart @@ -31,4 +31,4 @@ PropDecorator propDecorator(value) { class HasGetterAndSetterDecorators { @PropDecorator("get") get a {} @PropDecorator("set") set a(v) {} -} \ No newline at end of file +} diff --git a/modules/angular2/test/core/spies.dart b/modules/angular2/test/core/spies.dart index ad23a3ba3f..caa9706c12 100644 --- a/modules/angular2/test/core/spies.dart +++ b/modules/angular2/test/core/spies.dart @@ -83,7 +83,8 @@ class SpyProtoViewFactory extends SpyObject implements ProtoViewFactory { } @proxy -class SpyProtoElementInjector extends SpyObject implements ProtoElementInjector { +class SpyProtoElementInjector extends SpyObject + implements ProtoElementInjector { noSuchMethod(m) => super.noSuchMethod(m); } @@ -108,7 +109,8 @@ class SpyXHR extends SpyObject implements XHR { } @proxy -class SpyRenderEventDispatcher extends SpyObject implements RenderEventDispatcher { +class SpyRenderEventDispatcher extends SpyObject + implements RenderEventDispatcher { noSuchMethod(m) => super.noSuchMethod(m); } diff --git a/modules/angular2/test/symbol_inspector/symbol_inspector.dart b/modules/angular2/test/symbol_inspector/symbol_inspector.dart index 2404c5fdec..0ae5a336a5 100644 --- a/modules/angular2/test/symbol_inspector/symbol_inspector.dart +++ b/modules/angular2/test/symbol_inspector/symbol_inspector.dart @@ -89,8 +89,8 @@ class LibraryInfo { } } -Iterable _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyType) { - +Iterable _getUsedSymbols( + DeclarationMirror decl, seenDecls, path, onlyType) { if (seenDecls.containsKey(decl.qualifiedName)) return []; seenDecls[decl.qualifiedName] = true; @@ -111,13 +111,11 @@ Iterable _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyTy used.addAll(_getUsedSymbols(p.type, seenDecls, path, onlyType)); }); used.addAll(_getUsedSymbols(ftdecl.returnType, seenDecls, path, onlyType)); - } - else if (decl is TypeMirror) { + } else if (decl is TypeMirror) { var tdecl = decl; used.add(tdecl.qualifiedName); } - if (!onlyType) { if (decl is ClassMirror) { ClassMirror cdecl = decl; @@ -128,15 +126,13 @@ Iterable _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyTy print("Got error [$e] when visiting $d\n$s"); } }); - } if (decl is MethodMirror) { MethodMirror mdecl = decl; - if (mdecl.parameters != null) - mdecl.parameters.forEach((p) { - used.addAll(_getUsedSymbols(p.type, seenDecls, path, true)); - }); + if (mdecl.parameters != null) mdecl.parameters.forEach((p) { + used.addAll(_getUsedSymbols(p.type, seenDecls, path, true)); + }); used.addAll(_getUsedSymbols(mdecl.returnType, seenDecls, path, true)); } @@ -209,6 +205,5 @@ LibraryInfo extractSymbols(LibraryMirror lib, [String printPrefix = ""]) { return new LibraryInfo(exportedSymbols, used); } - var _SYMBOL_NAME = new RegExp('"(.*)"'); unwrapSymbol(sym) => _SYMBOL_NAME.firstMatch(sym.toString()).group(1); diff --git a/modules/angular2/test/web_workers/debug_tools/bootstrap.server.spec.dart b/modules/angular2/test/web_workers/debug_tools/bootstrap.server.spec.dart index f7da218a23..a217505310 100644 --- a/modules/angular2/test/web_workers/debug_tools/bootstrap.server.spec.dart +++ b/modules/angular2/test/web_workers/debug_tools/bootstrap.server.spec.dart @@ -10,7 +10,7 @@ import "dart:convert"; main() { describe("bootstrapWebWorkerCommon", () { - it ("should bootstrap on a Dart VM", () { + it("should bootstrap on a Dart VM", () { reflector.reflectionCapabilities = new ReflectionCapabilities(); var buses = createPairedMessageBuses(); bootstrapWebWorkerCommon(App, buses.worker); diff --git a/modules/angular2/test/web_workers/debug_tools/message_bus_common.dart b/modules/angular2/test/web_workers/debug_tools/message_bus_common.dart index 17a02362d9..5016e268a0 100644 --- a/modules/angular2/test/web_workers/debug_tools/message_bus_common.dart +++ b/modules/angular2/test/web_workers/debug_tools/message_bus_common.dart @@ -18,6 +18,7 @@ void expectSinkSendsEncodedJson(SpyObject socket, MessageBusSink sink, } void expectMessageEquality(String message, Map expectedData, String channel) { - expect(JSON.decode(message)) - .toEqual([{'channel': channel, 'message': expectedData}]); + expect(JSON.decode(message)).toEqual([ + {'channel': channel, 'message': expectedData} + ]); } diff --git a/modules/angular2/test/web_workers/debug_tools/multi_client_server_message_bus.server.spec.dart b/modules/angular2/test/web_workers/debug_tools/multi_client_server_message_bus.server.spec.dart index 06f0a30927..9f1bc727e9 100644 --- a/modules/angular2/test/web_workers/debug_tools/multi_client_server_message_bus.server.spec.dart +++ b/modules/angular2/test/web_workers/debug_tools/multi_client_server_message_bus.server.spec.dart @@ -79,8 +79,9 @@ main() { var random = new Random(); for (var i = 0; i < numMessages; i++) { var message = {'value': random.nextInt(MAX)}; - messageHistory - .add(JSON.encode([{'channel': CHANNEL, 'message': message}])); + messageHistory.add(JSON.encode([ + {'channel': CHANNEL, 'message': message} + ])); } // copy the message history to ensure the test fails if the wrapper modifies the list return new List.from(messageHistory); @@ -189,8 +190,7 @@ main() { messageHistory, resultMarkers, result.socket); socket.setPrimary(true); - var source = - new MultiClientServerMessageBusSource(); + var source = new MultiClientServerMessageBusSource(); source.onResult.listen((result) => async.done()); source.initChannel(CHANNEL, false); source.addConnection(socket); diff --git a/modules/angular2/test/web_workers/debug_tools/single_client_server_message_bus.server.spec.dart b/modules/angular2/test/web_workers/debug_tools/single_client_server_message_bus.server.spec.dart index 9b75d1a826..460d3e08a0 100644 --- a/modules/angular2/test/web_workers/debug_tools/single_client_server_message_bus.server.spec.dart +++ b/modules/angular2/test/web_workers/debug_tools/single_client_server_message_bus.server.spec.dart @@ -94,8 +94,9 @@ main() { async.done(); }); - controller - .add(JSON.encode([{'channel': CHANNEL, 'message': MESSAGE}])); + controller.add(JSON.encode([ + {'channel': CHANNEL, 'message': MESSAGE} + ])); })); }); } diff --git a/modules/angular2/test/web_workers/debug_tools/web_socket_message_bus_spec.dart b/modules/angular2/test/web_workers/debug_tools/web_socket_message_bus_spec.dart index 4c1eb0fac2..71cefb27a4 100644 --- a/modules/angular2/test/web_workers/debug_tools/web_socket_message_bus_spec.dart +++ b/modules/angular2/test/web_workers/debug_tools/web_socket_message_bus_spec.dart @@ -50,8 +50,9 @@ main() { }); var event = new SpyMessageEvent(); - event.spy("get:data").andCallFake( - () => JSON.encode([{'channel': CHANNEL, 'message': MESSAGE}])); + event.spy("get:data").andCallFake(() => JSON.encode([ + {'channel': CHANNEL, 'message': MESSAGE} + ])); controller.add(event); })); }); diff --git a/modules/angular2/test/web_workers/shared/mock_event_emitter.dart b/modules/angular2/test/web_workers/shared/mock_event_emitter.dart index 6f83ce7f60..ee7546b0d8 100644 --- a/modules/angular2/test/web_workers/shared/mock_event_emitter.dart +++ b/modules/angular2/test/web_workers/shared/mock_event_emitter.dart @@ -10,7 +10,8 @@ class MockEventEmitter extends EventEmitter { @override StreamSubscription listen(void onData(dynamic line), {void onError(Error error), void onDone(), bool cancelOnError}) { - return controller.stream.listen(onData, onError: onError, onDone: onDone, cancelOnError: cancelOnError); + return controller.stream.listen(onData, + onError: onError, onDone: onDone, cancelOnError: cancelOnError); } @override diff --git a/modules/angular2/test/web_workers/worker/spies.dart b/modules/angular2/test/web_workers/worker/spies.dart index 7d6fa9d961..c3385ca77c 100644 --- a/modules/angular2/test/web_workers/worker/spies.dart +++ b/modules/angular2/test/web_workers/worker/spies.dart @@ -7,5 +7,3 @@ import 'package:angular2/testing_internal.dart'; class SpyMessageBroker extends SpyObject implements ClientMessageBroker { noSuchMethod(m) => super.noSuchMethod(m); } - - diff --git a/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart b/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart index 4126061ab6..fe8998de4d 100644 --- a/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart +++ b/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart @@ -171,7 +171,7 @@ class _DirectiveMetadataVisitor extends Object type: _type, isComponent: _isComponent, dynamicLoadable: true, - // NOTE(kegluneq): For future optimization. + // NOTE(kegluneq): For future optimization. selector: _selector, exportAs: _exportAs, changeDetection: _changeDetection, @@ -190,7 +190,7 @@ class _DirectiveMetadataVisitor extends Object if (_hasMetadata) { throw new FormatException( 'Only one Directive is allowed per class. ' - 'Found unexpected "$node".', + 'Found unexpected "$node".', '$node' /* source */); } _isComponent = isComponent; @@ -203,13 +203,14 @@ class _DirectiveMetadataVisitor extends Object } super.visitAnnotation(node); } else if (_annotationMatcher.isView(node, _assetId)) { - if (_viewTemplate!= null) { + if (_viewTemplate != null) { throw new FormatException( 'Only one View is allowed per class. ' 'Found unexpected "$node".', '$node' /* source */); } - _viewTemplate = new _CompileTemplateMetadataVisitor().visitAnnotation(node); + _viewTemplate = + new _CompileTemplateMetadataVisitor().visitAnnotation(node); } // Annotation we do not recognize - no need to visit. diff --git a/modules_dart/transform/lib/src/transform/common/interface_matcher.dart b/modules_dart/transform/lib/src/transform/common/interface_matcher.dart index 7d6e418733..747632d4b2 100644 --- a/modules_dart/transform/lib/src/transform/common/interface_matcher.dart +++ b/modules_dart/transform/lib/src/transform/common/interface_matcher.dart @@ -47,7 +47,8 @@ const _ON_AFTER_CONTENT_INIT_INTERFACES = const [ 'AfterContentInit', 'package:angular2/src/core/linker/interfaces.dart') ]; const _ON_AFTER_CONTENT_CHECKED_INTERFACES = const [ - const ClassDescriptor('AfterContentChecked', 'package:angular2/angular2.dart'), + const ClassDescriptor( + 'AfterContentChecked', 'package:angular2/angular2.dart'), const ClassDescriptor( 'AfterContentChecked', 'package:angular2/lifecycle_hooks.dart'), const ClassDescriptor( @@ -112,12 +113,13 @@ class InterfaceMatcher extends ClassMatcherBase { firstMatch(typeName, assetId), _ON_AFTER_CONTENT_INIT_INTERFACES); /// Checks if an [Identifier] implements [AfterContentChecked]. - bool isAfterContentChecked(Identifier typeName, AssetId assetId) => implements( - firstMatch(typeName, assetId), _ON_AFTER_CONTENT_CHECKED_INTERFACES); + bool isAfterContentChecked(Identifier typeName, AssetId assetId) => + implements( + firstMatch(typeName, assetId), _ON_AFTER_CONTENT_CHECKED_INTERFACES); /// Checks if an [Identifier] implements [AfterViewInit]. - bool isAfterViewInit(Identifier typeName, AssetId assetId) => implements( - firstMatch(typeName, assetId), _ON_AFTER_VIEW_INIT_INTERFACES); + bool isAfterViewInit(Identifier typeName, AssetId assetId) => + implements(firstMatch(typeName, assetId), _ON_AFTER_VIEW_INIT_INTERFACES); /// Checks if an [Identifier] implements [AfterViewChecked]. bool isAfterViewChecked(Identifier typeName, AssetId assetId) => implements( diff --git a/modules_dart/transform/lib/src/transform/common/registered_type.dart b/modules_dart/transform/lib/src/transform/common/registered_type.dart index 1c6f1849d2..18a68125a5 100644 --- a/modules_dart/transform/lib/src/transform/common/registered_type.dart +++ b/modules_dart/transform/lib/src/transform/common/registered_type.dart @@ -40,8 +40,14 @@ class RegisteredType { factory RegisteredType.fromMethodInvocation(MethodInvocation registerMethod) { var visitor = new _ParseRegisterTypeVisitor(); registerMethod.accept(visitor); - return new RegisteredType._(visitor.typeName, registerMethod, visitor.info, - visitor.factoryFn, visitor.parameters, visitor.annotations, visitor.propMetadata); + return new RegisteredType._( + visitor.typeName, + registerMethod, + visitor.info, + visitor.factoryFn, + visitor.parameters, + visitor.annotations, + visitor.propMetadata); } } diff --git a/modules_dart/transform/lib/src/transform/common/url_resolver.dart b/modules_dart/transform/lib/src/transform/common/url_resolver.dart index 56290aadfa..b8613f334f 100644 --- a/modules_dart/transform/lib/src/transform/common/url_resolver.dart +++ b/modules_dart/transform/lib/src/transform/common/url_resolver.dart @@ -45,8 +45,8 @@ Uri toAssetScheme(Uri absoluteUri) { if (absoluteUri == null) throw new ArgumentError.notNull('absoluteUri'); if (!absoluteUri.isAbsolute) { - throw new ArgumentError.value( - absoluteUri.toString(), 'absoluteUri', 'Value passed must be an absolute uri'); + throw new ArgumentError.value(absoluteUri.toString(), 'absoluteUri', + 'Value passed must be an absolute uri'); } if (absoluteUri.scheme == 'asset') { if (absoluteUri.pathSegments.length < 3) { diff --git a/modules_dart/transform/test/transform/bind_generator/queries_prop_annotations_files/bar.ng_deps.dart b/modules_dart/transform/test/transform/bind_generator/queries_prop_annotations_files/bar.ng_deps.dart index 96e0132162..478acb2e1d 100644 --- a/modules_dart/transform/test/transform/bind_generator/queries_prop_annotations_files/bar.ng_deps.dart +++ b/modules_dart/transform/test/transform/bind_generator/queries_prop_annotations_files/bar.ng_deps.dart @@ -10,8 +10,12 @@ void initReflector(reflector) { reflector ..registerType( ToolTip, - new ReflectionInfo(const [ - const Directive( - selector: '[tool-tip]') - ], const [], () => new ToolTip(), null, const {'queryField': const [const ContentChild('child')]})); + new ReflectionInfo( + const [const Directive(selector: '[tool-tip]')], + const [], + () => new ToolTip(), + null, + const { + 'queryField': const [const ContentChild('child')] + })); } diff --git a/modules_dart/transform/test/transform/bind_generator/queries_prop_annotations_files/expected/bar.ng_deps.dart b/modules_dart/transform/test/transform/bind_generator/queries_prop_annotations_files/expected/bar.ng_deps.dart index 3129e9f34d..1b16d58b8f 100644 --- a/modules_dart/transform/test/transform/bind_generator/queries_prop_annotations_files/expected/bar.ng_deps.dart +++ b/modules_dart/transform/test/transform/bind_generator/queries_prop_annotations_files/expected/bar.ng_deps.dart @@ -10,9 +10,13 @@ void initReflector(reflector) { reflector ..registerType( ToolTip, - new ReflectionInfo(const [ - const Directive( - selector: '[tool-tip]') - ], const [], () => new ToolTip(), null, const {'queryField': const [const ContentChild('child')]})) + new ReflectionInfo( + const [const Directive(selector: '[tool-tip]')], + const [], + () => new ToolTip(), + null, + const { + 'queryField': const [const ContentChild('child')] + })) ..registerSetters({'queryField': (o, v) => o.queryField = v}); }