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

Unified Diff: pkg/polymer_expressions/lib/polymer_expressions.dart

Issue 23874018: add enumerate to the default filter set (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
« no previous file with comments | « pkg/pkg.status ('k') | pkg/polymer_expressions/lib/src/globals.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer_expressions/lib/polymer_expressions.dart
diff --git a/pkg/polymer_expressions/lib/polymer_expressions.dart b/pkg/polymer_expressions/lib/polymer_expressions.dart
index e7148ad98be8ebce9e7b83f23d109da3929588a1..ddb85fe667a7ff15401e582f9994c561c67f50b5 100644
--- a/pkg/polymer_expressions/lib/polymer_expressions.dart
+++ b/pkg/polymer_expressions/lib/polymer_expressions.dart
@@ -36,6 +36,7 @@ import 'package:logging/logging.dart';
import 'eval.dart';
import 'expression.dart';
import 'parser.dart';
+import 'src/globals.dart';
final Logger _logger = new Logger('polymer_expressions');
@@ -51,11 +52,19 @@ Object _styleAttributeConverter(v) =>
v;
class PolymerExpressions extends BindingDelegate {
+ /** The default [globals] to use for Polymer expressions. */
+ static const Map DEFAULT_GLOBALS = const { 'enumerate': enumerate };
final Map<String, Object> globals;
+ /**
+ * Creates a new binding delegate for Polymer expressions, with the provided
+ * variables used as [globals]. If no globals are supplied, a copy of the
+ * [DEFAULT_GLOBALS] will be used.
+ */
PolymerExpressions({Map<String, Object> globals})
- : globals = (globals == null) ? new Map<String, Object>() : globals;
+ : globals = (globals == null) ?
+ new Map<String, Object>.from(DEFAULT_GLOBALS) : globals;
_Binding getBinding(model, String path, name, node) {
if (path == null) return null;
@@ -137,5 +146,4 @@ class _Binding extends Object with ChangeNotifierMixin {
setValueWorkaround(key, v) {
if (key == _VALUE) value = v;
}
-
}
« no previous file with comments | « pkg/pkg.status ('k') | pkg/polymer_expressions/lib/src/globals.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698