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

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, 3 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 | « no previous file | 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 dd7d7af922ff6993199749f82ea2cea972f62a2c..e94e3337a407c593f530dd1604220a1e90b49664 100644
--- a/pkg/polymer_expressions/lib/polymer_expressions.dart
+++ b/pkg/polymer_expressions/lib/polymer_expressions.dart
@@ -12,6 +12,7 @@ import 'package:observe/observe.dart';
import 'eval.dart';
import 'expression.dart';
import 'parser.dart';
+import 'src/globals.dart';
// TODO(justin): Investigate XSS protection
Object _classAttributeConverter(v) =>
@@ -25,11 +26,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;
justinfagnani 2013/09/17 21:45:05 I think I'd rather see the default globals set in
Jennifer Messerly 2013/10/08 00:55:01 yeah, I was kinda wondering that too. So far we do
_Binding getBinding(model, String path, name, node) {
if (path == null) return null;
@@ -105,5 +114,4 @@ class _Binding extends Object with ChangeNotifierMixin {
setValueWorkaround(key, v) {
if (key == _VALUE) value = v;
}
-
}
« no previous file with comments | « no previous file | pkg/polymer_expressions/lib/src/globals.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698