chore: analyzer fixes for Dart transformer

This commit is contained in:
Kevin Moore 2015-04-01 13:47:42 -07:00 committed by Rado Kirov
parent 25c709c58e
commit d77f409093
4 changed files with 11 additions and 14 deletions

View File

@ -2,7 +2,6 @@ library angular2.transform.directive_processor.transformer;
import 'dart:async';
import 'package:angular2/src/transform/common/formatter.dart';
import 'package:angular2/src/transform/common/logging.dart' as log;
import 'package:angular2/src/transform/common/names.dart';
import 'package:angular2/src/transform/common/options.dart';

View File

@ -77,7 +77,7 @@ class _ReflectorVisitor extends Object with SimpleAstVisitor<Expression> {
@override
Expression visitPropertyAccess(PropertyAccess node) {
if (node == null || node.target == null) return;
if (node == null || node.target == null) return null;
return node.target;
}

View File

@ -160,7 +160,7 @@ class _TemplateExtractVisitor extends Object with RecursiveAstVisitor<Object> {
// TODO(kegluneq): Remove this limitation.
if (node.name is! Label || node.name.label is! SimpleIdentifier) {
logger.error(
'Angular 2 currently only supports simple identifiers in directives',
'Angular 2 currently only supports simple identifiers in directives.'
' Source: ${node}');
return null;
}
@ -168,7 +168,7 @@ class _TemplateExtractVisitor extends Object with RecursiveAstVisitor<Object> {
if (keyString == 'inline' || keyString == 'url') {
if (node.expression is! SimpleStringLiteral) {
logger.error(
'Angular 2 currently only supports string literals in directives',
'Angular 2 currently only supports string literals in directives.'
' Source: ${node}');
return null;
}

View File

@ -8,15 +8,13 @@ import 'package:angular2/src/reflection/types.dart';
/// reflectively accessed at runtime.
class RecordingReflectionCapabilities implements ReflectionCapabilities {
/// The names of all requested `getter`s.
final List<String> getterNames = [];
final List<String> getterNames = <String>[];
/// The names of all requested `setter`s.
final List<String> setterNames = [];
final List<String> setterNames = <String>[];
/// The names of all requested `method`s.
final List<String> methodNames = [];
final List<String> methodNames = <String>[];
void _notImplemented(String name) {
throw 'Not implemented: $name';
}
_notImplemented(String name) => throw 'Not implemented: $name';
Function factory(Type type) => _notImplemented('factory');
@ -24,10 +22,6 @@ class RecordingReflectionCapabilities implements ReflectionCapabilities {
List annotations(typeOrFunc) => _notImplemented('annotations');
static GetterFn _nullGetter = (Object p) => null;
static SetterFn _nullSetter = (Object p, v) => null;
static MethodFn _nullMethod = (Object p, List a) => null;
GetterFn getter(String name) {
getterNames.add(name);
return _nullGetter;
@ -43,3 +37,7 @@ class RecordingReflectionCapabilities implements ReflectionCapabilities {
return _nullMethod;
}
}
_nullGetter(Object p) => null;
_nullSetter(Object p, v) => null;
_nullMethod(Object p, List a) => null;