diff --git a/modules_dart/transform/lib/src/transform/common/code/queries_code.dart b/modules_dart/transform/lib/src/transform/common/code/queries_code.dart index 86b943c8fe..3114a67855 100644 --- a/modules_dart/transform/lib/src/transform/common/code/queries_code.dart +++ b/modules_dart/transform/lib/src/transform/common/code/queries_code.dart @@ -3,7 +3,7 @@ library angular2.transform.common.code.queries_code; import 'package:analyzer/analyzer.dart'; import 'package:analyzer/src/generated/ast.dart'; import 'package:angular2/src/transform/common/annotation_matcher.dart'; -import 'package:angular2/src/transform/common/dumb_eval.dart'; +import 'package:angular2/src/transform/common/naive_eval.dart'; import 'package:barback/barback.dart'; /// Visitor responsbile for processing a [ClassDeclaration] and extracting any @@ -125,7 +125,7 @@ class _QueriesAnnotationVisitor extends SimpleAstVisitor> { } final queries = node.expression as MapLiteral; for (var entry in queries.entries) { - var queryField = dumbEval(entry.key); + var queryField = naiveEval(entry.key); if (queryField != NOT_A_CONSTANT) { _queryFields.add(queryField.toString()); } diff --git a/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart b/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart index 324f20c62a..1fd0df7ca6 100644 --- a/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart +++ b/modules_dart/transform/lib/src/transform/common/directive_metadata_reader.dart @@ -12,7 +12,7 @@ import 'package:angular2/src/transform/common/annotation_matcher.dart'; import 'package:angular2/src/transform/common/interface_matcher.dart'; import 'package:barback/barback.dart' show AssetId; -import 'dumb_eval.dart'; +import 'naive_eval.dart'; class DirectiveMetadataReader { final _DirectiveMetadataVisitor _visitor; @@ -59,7 +59,7 @@ class DirectiveMetadataReader { /// `value` pairs to `map`. If `expression` does not evaluate to a [Map], /// throws a descriptive [FormatException]. void _populateMap(Expression expression, Map map, String propertyName) { - var evaluated = dumbEval(expression); + var evaluated = naiveEval(expression); if (evaluated is! Map) { throw new FormatException( 'Angular 2 expects a Map but could not understand the value for ' @@ -78,7 +78,7 @@ void _populateMap(Expression expression, Map map, String propertyName) { /// descriptive [FormatException]. void _populateList( Expression expression, List list, String propertyName) { - var evaluated = dumbEval(expression); + var evaluated = naiveEval(expression); if (evaluated is! List) { throw new FormatException( 'Angular 2 expects a List but could not understand the value for ' @@ -91,7 +91,7 @@ void _populateList( /// Evaluates `node` and expects that the result will be a string. If not, /// throws a [FormatException]. String _expressionToString(Expression node, String nodeDescription) { - var value = dumbEval(node); + var value = naiveEval(node); if (value is! String) { throw new FormatException( 'Angular 2 could not understand the value ' diff --git a/modules_dart/transform/lib/src/transform/common/dumb_eval.dart b/modules_dart/transform/lib/src/transform/common/naive_eval.dart similarity index 83% rename from modules_dart/transform/lib/src/transform/common/dumb_eval.dart rename to modules_dart/transform/lib/src/transform/common/naive_eval.dart index 85aa57a937..7f73ee338b 100644 --- a/modules_dart/transform/lib/src/transform/common/dumb_eval.dart +++ b/modules_dart/transform/lib/src/transform/common/naive_eval.dart @@ -1,10 +1,10 @@ -library angular2.transform.common.dumb_eval; +library angular2.transform.common.naive_eval; import 'package:analyzer/analyzer.dart'; final _constantEvaluator = new ConstantEvaluator(); -/// The value returned if the result of `dumbEval` is not a constant. +/// The value returned if the result of `naiveEval` is not a constant. final NOT_A_CONSTANT = ConstantEvaluator.NOT_A_CONSTANT; /// Performs a very limited syntactic evaluation of `expr`. @@ -15,7 +15,7 @@ final NOT_A_CONSTANT = ConstantEvaluator.NOT_A_CONSTANT; /// even if that identifier is defined in the same [CompilationUnit]. /// /// Returns the result of evaluation or [NOT_A_CONSTANT] where appropriate. -dynamic dumbEval(Expression expr) { +dynamic naiveEval(Expression expr) { var val; if (expr is SimpleStringLiteral) { val = stringLiteralToString(expr); diff --git a/modules_dart/transform/lib/src/transform/inliner_for_test/transformer.dart b/modules_dart/transform/lib/src/transform/inliner_for_test/transformer.dart index fb4cdcb76e..d13e7faef7 100644 --- a/modules_dart/transform/lib/src/transform/inliner_for_test/transformer.dart +++ b/modules_dart/transform/lib/src/transform/inliner_for_test/transformer.dart @@ -7,7 +7,7 @@ import 'package:analyzer/src/generated/ast.dart'; import 'package:angular2/src/core/compiler/xhr.dart' show XHR; import 'package:angular2/src/transform/common/annotation_matcher.dart'; import 'package:angular2/src/transform/common/asset_reader.dart'; -import 'package:angular2/src/transform/common/dumb_eval.dart'; +import 'package:angular2/src/transform/common/naive_eval.dart'; import 'package:angular2/src/transform/common/async_string_writer.dart'; import 'package:angular2/src/transform/common/logging.dart'; import 'package:angular2/src/transform/common/options.dart'; @@ -142,7 +142,7 @@ class _ViewPropInliner extends RecursiveAstVisitor { } void _populateStyleUrls(NamedExpression node) { - var urls = dumbEval(node.expression); + var urls = naiveEval(node.expression); if (urls is! List) { logger.warning('styleUrls is not a List of Strings (${node.expression})'); return; @@ -163,7 +163,7 @@ class _ViewPropInliner extends RecursiveAstVisitor { } void _populateTemplateUrl(NamedExpression node) { - var url = dumbEval(node.expression); + var url = naiveEval(node.expression); if (url is! String) { logger.warning('template url is not a String (${node.expression})'); return;