refactor(dart): Format Dart code

Use the dart formatter to clean up all pure Dart code.

Closes #4832
This commit is contained in:
Tim Blasi
2015-10-20 09:38:14 -07:00
committed by Timothy Blasi
parent 6be95ae88a
commit fd0ba37734
44 changed files with 326 additions and 258 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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