Skip to content

Commit ae84eb7

Browse files
author
Tim Blasi
committed
refactor(dart/transform): Correct Dart analyzer warnings
1 parent f89bb8e commit ae84eb7

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

modules/angular2/src/transform/template_compiler/directive_metadata_reader.dart

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ library angular2.transform.template_compiler.directive_metadata_reader;
22

33
import 'package:analyzer/analyzer.dart';
44
import 'package:angular2/src/render/api.dart';
5-
import 'package:angular2/src/transform/common/asset_reader.dart';
65
import 'package:angular2/src/transform/common/logging.dart';
7-
import 'package:angular2/src/transform/common/names.dart';
86
import 'package:angular2/src/transform/common/parser.dart';
9-
import 'package:angular2/src/transform/common/property_utils.dart' as prop;
107

118
/// Reads [DirectiveMetadata] from the `attributes` of `t`.
129
List<DirectiveMetadata> readDirectiveMetadata(RegisteredType t) {
@@ -102,20 +99,20 @@ class _DirectiveMetadataVisitor extends Object
10299
logger.error(
103100
'Angular 2 currently only supports boolean literal values for '
104101
'Decorator#compileChildren.'
105-
' Source: ${node}');
102+
' Source: ${compileChildrenValue}');
106103
return;
107104
}
108-
current.compileChildren = compileChildrenValue.value;
105+
current.compileChildren = (compileChildrenValue as BooleanLiteral).value;
109106
}
110107

111108
void _populateProperties(Expression propertiesValue) {
112109
if (propertiesValue is! MapLiteral) {
113110
logger.error('Angular 2 currently only supports map literal values for '
114111
'Directive#properties.'
115-
' Source: ${node}');
112+
' Source: ${propertiesValue}');
116113
return;
117114
}
118-
for (MapLiteralEntry entry in propertiesValue.entries) {
115+
for (MapLiteralEntry entry in (propertiesValue as MapLiteral).entries) {
119116
var sKey = _expressionToString(entry.key, 'Directive#properties keys');
120117
var sVal = _expressionToString(entry.value, 'Direcive#properties values');
121118
current.properties[sKey] = sVal;
@@ -126,10 +123,10 @@ class _DirectiveMetadataVisitor extends Object
126123
if (hostListenersValue is! MapLiteral) {
127124
logger.error('Angular 2 currently only supports map literal values for '
128125
'Directive#hostListeners.'
129-
' Source: ${node}');
126+
' Source: ${hostListenersValue}');
130127
return;
131128
}
132-
for (MapLiteralEntry entry in hostListenersValue.entries) {
129+
for (MapLiteralEntry entry in (hostListenersValue as MapLiteral).entries) {
133130
var sKey = _expressionToString(entry.key, 'Directive#hostListeners keys');
134131
var sVal =
135132
_expressionToString(entry.value, 'Directive#hostListeners values');

modules/angular2/test/transform/common/application.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'dart:async';
88
/// Mocked out version of [bootstrap], defined in application.dart. Importing
99
/// the actual file in tests causes issues with resolution due to its
1010
/// transitive dependencies.
11-
Future bootstrap(Type appComponentType, [List<Binding> bindings = null,
12-
Function givenBootstrapErrorReporter = null]) {
11+
Future bootstrap(Type appComponentType,
12+
[List bindings = null, Function givenBootstrapErrorReporter = null]) {
1313
return null;
1414
}

0 commit comments

Comments
 (0)