Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: third_party/pkg/angular/lib/core/parser/utils.dart

Issue 176943008: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/core/parser/utils.dart
diff --git a/third_party/pkg/angular/lib/core/parser/utils.dart b/third_party/pkg/angular/lib/core/parser/utils.dart
index 5a31e052a6d39d53f32a3d483130c27ec00be093..d79c9c96f4deb6fa899011a27275d746b64e24c0 100644
--- a/third_party/pkg/angular/lib/core/parser/utils.dart
+++ b/third_party/pkg/angular/lib/core/parser/utils.dart
@@ -1,6 +1,8 @@
library angular.core.parser.utils;
import 'package:angular/core/parser/syntax.dart' show Expression;
+import 'package:angular/core/module.dart';
+import 'package:angular/utils.dart' show isReservedWord;
export 'package:angular/utils.dart' show relaxFnApply, relaxFnArgs, toBool;
/// Marker for an uninitialized value.
@@ -18,14 +20,14 @@ class EvalError {
}
/// Evaluate the [list] in context of the [scope].
-List evalList(scope, List<Expression> list) {
+List evalList(scope, List<Expression> list, [FilterMap filters]) {
int length = list.length;
- for(int cacheLength = _evalListCache.length; cacheLength <= length; cacheLength++) {
+ for (int cacheLength = _evalListCache.length; cacheLength <= length; cacheLength++) {
_evalListCache.add(new List(cacheLength));
}
List result = _evalListCache[length];
for (int i = 0; i < length; i++) {
- result[i] = list[i].eval(scope);
+ result[i] = list[i].eval(scope, filters);
}
return result;
}
@@ -77,8 +79,9 @@ getKeyed(object, key) {
return object["$key"]; // toString dangerous?
} else if (object == null) {
throw new EvalError('Accessing null object');
+ } else {
+ return object[key];
}
- throw new EvalError("Attempted field access on a non-list, non-map");
}
/// Set a keyed element in the given [object].
@@ -90,7 +93,13 @@ setKeyed(object, key, value) {
} else if (object is Map) {
object["$key"] = value; // toString dangerous?
} else {
- throw new EvalError("Attempting to set a field on a non-list, non-map");
+ object[key] = value;
}
return value;
}
+
+/// Returns a new symbol with the given name if the name is a legal
+/// symbol name. Otherwise, returns null.
+Symbol newSymbol(String name) {
+ return isReservedWord(name) ? null : new Symbol(name);
+}

Powered by Google App Engine
This is Rietveld 408576698