From ae84eb7462de836b5cb8d5982796afa9e95be37e Mon Sep 17 00:00:00 2001 From: Tim Blasi Date: Tue, 14 Apr 2015 13:55:15 -0700 Subject: [PATCH] refactor(dart/transform): Correct Dart analyzer warnings --- .../directive_metadata_reader.dart | 15 ++++++--------- .../test/transform/common/application.dart | 4 ++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/modules/angular2/src/transform/template_compiler/directive_metadata_reader.dart b/modules/angular2/src/transform/template_compiler/directive_metadata_reader.dart index 0637fecdee..5183d5c71b 100644 --- a/modules/angular2/src/transform/template_compiler/directive_metadata_reader.dart +++ b/modules/angular2/src/transform/template_compiler/directive_metadata_reader.dart @@ -2,11 +2,8 @@ library angular2.transform.template_compiler.directive_metadata_reader; import 'package:analyzer/analyzer.dart'; import 'package:angular2/src/render/api.dart'; -import 'package:angular2/src/transform/common/asset_reader.dart'; import 'package:angular2/src/transform/common/logging.dart'; -import 'package:angular2/src/transform/common/names.dart'; import 'package:angular2/src/transform/common/parser.dart'; -import 'package:angular2/src/transform/common/property_utils.dart' as prop; /// Reads [DirectiveMetadata] from the `attributes` of `t`. List readDirectiveMetadata(RegisteredType t) { @@ -102,20 +99,20 @@ class _DirectiveMetadataVisitor extends Object logger.error( 'Angular 2 currently only supports boolean literal values for ' 'Decorator#compileChildren.' - ' Source: ${node}'); + ' Source: ${compileChildrenValue}'); return; } - current.compileChildren = compileChildrenValue.value; + current.compileChildren = (compileChildrenValue as BooleanLiteral).value; } void _populateProperties(Expression propertiesValue) { if (propertiesValue is! MapLiteral) { logger.error('Angular 2 currently only supports map literal values for ' 'Directive#properties.' - ' Source: ${node}'); + ' Source: ${propertiesValue}'); return; } - for (MapLiteralEntry entry in propertiesValue.entries) { + for (MapLiteralEntry entry in (propertiesValue as MapLiteral).entries) { var sKey = _expressionToString(entry.key, 'Directive#properties keys'); var sVal = _expressionToString(entry.value, 'Direcive#properties values'); current.properties[sKey] = sVal; @@ -126,10 +123,10 @@ class _DirectiveMetadataVisitor extends Object if (hostListenersValue is! MapLiteral) { logger.error('Angular 2 currently only supports map literal values for ' 'Directive#hostListeners.' - ' Source: ${node}'); + ' Source: ${hostListenersValue}'); return; } - for (MapLiteralEntry entry in hostListenersValue.entries) { + for (MapLiteralEntry entry in (hostListenersValue as MapLiteral).entries) { var sKey = _expressionToString(entry.key, 'Directive#hostListeners keys'); var sVal = _expressionToString(entry.value, 'Directive#hostListeners values'); diff --git a/modules/angular2/test/transform/common/application.dart b/modules/angular2/test/transform/common/application.dart index e2fce446ea..5cd5276bb8 100644 --- a/modules/angular2/test/transform/common/application.dart +++ b/modules/angular2/test/transform/common/application.dart @@ -8,7 +8,7 @@ import 'dart:async'; /// Mocked out version of [bootstrap], defined in application.dart. Importing /// the actual file in tests causes issues with resolution due to its /// transitive dependencies. -Future bootstrap(Type appComponentType, [List bindings = null, - Function givenBootstrapErrorReporter = null]) { +Future bootstrap(Type appComponentType, + [List bindings = null, Function givenBootstrapErrorReporter = null]) { return null; }