refactor(dart/transform): Correct Dart analyzer warnings

This commit is contained in:
Tim Blasi 2015-04-14 13:55:15 -07:00
parent f89bb8eaf3
commit ae84eb7462
2 changed files with 8 additions and 11 deletions

View File

@ -2,11 +2,8 @@ library angular2.transform.template_compiler.directive_metadata_reader;
import 'package:analyzer/analyzer.dart'; import 'package:analyzer/analyzer.dart';
import 'package:angular2/src/render/api.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/logging.dart';
import 'package:angular2/src/transform/common/names.dart';
import 'package:angular2/src/transform/common/parser.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`. /// Reads [DirectiveMetadata] from the `attributes` of `t`.
List<DirectiveMetadata> readDirectiveMetadata(RegisteredType t) { List<DirectiveMetadata> readDirectiveMetadata(RegisteredType t) {
@ -102,20 +99,20 @@ class _DirectiveMetadataVisitor extends Object
logger.error( logger.error(
'Angular 2 currently only supports boolean literal values for ' 'Angular 2 currently only supports boolean literal values for '
'Decorator#compileChildren.' 'Decorator#compileChildren.'
' Source: ${node}'); ' Source: ${compileChildrenValue}');
return; return;
} }
current.compileChildren = compileChildrenValue.value; current.compileChildren = (compileChildrenValue as BooleanLiteral).value;
} }
void _populateProperties(Expression propertiesValue) { void _populateProperties(Expression propertiesValue) {
if (propertiesValue is! MapLiteral) { if (propertiesValue is! MapLiteral) {
logger.error('Angular 2 currently only supports map literal values for ' logger.error('Angular 2 currently only supports map literal values for '
'Directive#properties.' 'Directive#properties.'
' Source: ${node}'); ' Source: ${propertiesValue}');
return; return;
} }
for (MapLiteralEntry entry in propertiesValue.entries) { for (MapLiteralEntry entry in (propertiesValue as MapLiteral).entries) {
var sKey = _expressionToString(entry.key, 'Directive#properties keys'); var sKey = _expressionToString(entry.key, 'Directive#properties keys');
var sVal = _expressionToString(entry.value, 'Direcive#properties values'); var sVal = _expressionToString(entry.value, 'Direcive#properties values');
current.properties[sKey] = sVal; current.properties[sKey] = sVal;
@ -126,10 +123,10 @@ class _DirectiveMetadataVisitor extends Object
if (hostListenersValue is! MapLiteral) { if (hostListenersValue is! MapLiteral) {
logger.error('Angular 2 currently only supports map literal values for ' logger.error('Angular 2 currently only supports map literal values for '
'Directive#hostListeners.' 'Directive#hostListeners.'
' Source: ${node}'); ' Source: ${hostListenersValue}');
return; return;
} }
for (MapLiteralEntry entry in hostListenersValue.entries) { for (MapLiteralEntry entry in (hostListenersValue as MapLiteral).entries) {
var sKey = _expressionToString(entry.key, 'Directive#hostListeners keys'); var sKey = _expressionToString(entry.key, 'Directive#hostListeners keys');
var sVal = var sVal =
_expressionToString(entry.value, 'Directive#hostListeners values'); _expressionToString(entry.value, 'Directive#hostListeners values');

View File

@ -8,7 +8,7 @@ import 'dart:async';
/// Mocked out version of [bootstrap], defined in application.dart. Importing /// Mocked out version of [bootstrap], defined in application.dart. Importing
/// the actual file in tests causes issues with resolution due to its /// the actual file in tests causes issues with resolution due to its
/// transitive dependencies. /// transitive dependencies.
Future bootstrap(Type appComponentType, [List<Binding> bindings = null, Future bootstrap(Type appComponentType,
Function givenBootstrapErrorReporter = null]) { [List bindings = null, Function givenBootstrapErrorReporter = null]) {
return null; return null;
} }