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

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

Issue 304223004: Remove Comprehension type in polymer expressions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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: pkg/polymer_expressions/lib/eval.dart
diff --git a/pkg/polymer_expressions/lib/eval.dart b/pkg/polymer_expressions/lib/eval.dart
index a33abeb126709838ae4ed21109cce2528924f15c..ba336edb03c96f62c6720b342eb4ad9d1ed4c399 100644
--- a/pkg/polymer_expressions/lib/eval.dart
+++ b/pkg/polymer_expressions/lib/eval.dart
@@ -208,6 +208,8 @@ class _ModelScope extends Scope {
}
Object _isModelProperty(String name) => name != 'this';
+
+ String toString() => "[model: $model]";
}
/**
@@ -239,6 +241,8 @@ class _LocalVariableScope extends Scope {
if (varName == name) return false;
return parent == null ? false : parent._isModelProperty(name);
}
+
+ String toString() => "$parent > [local: $varName]";
}
/** A scope that holds a reference to a global variables. */
@@ -264,6 +268,8 @@ class _GlobalsScope extends Scope {
if (variables.containsKey(name)) return false;
return parent == null ? false : parent._isModelProperty(name);
}
+
+ String toString() => "$parent > [global: ${variables.keys}]";
}
Object _convert(v) => v is Stream ? new StreamBinding(v) : v;
@@ -730,8 +736,9 @@ class InObserver extends ExpressionObserver<InExpression>
_subscription = iterable.listChanges.listen((_) => _invalidate(scope));
}
- // TODO: make Comprehension observable and update it
Jennifer Messerly 2014/05/30 22:55:10 does this TODO need to stick around?
Siggi Cherem (dart-lang) 2014/05/31 00:56:17 Yes, but there was already an equivalent TODO in _
- _value = new Comprehension(identifier.value, iterable);
+ var name = identifier.value;
+ _value = iterable == null ? const [] :
+ iterable.map((i) => scope.childScope(name, i)).toList(growable: false);
}
accept(Visitor v) => v.visitInExpression(this);
@@ -739,19 +746,6 @@ class InObserver extends ExpressionObserver<InExpression>
_toBool(v) => (v == null) ? false : v;
-/**
- * A comprehension declaration ("a in b"). [identifier] is the loop variable
- * that's added to the scope during iteration. [iterable] is the set of
- * objects to iterate over.
- */
-class Comprehension {
- final String identifier;
- final Iterable iterable;
-
- Comprehension(this.identifier, Iterable iterable)
- : iterable = (iterable != null) ? iterable : const [];
-}
-
class EvalException implements Exception {
final String message;
EvalException(this.message);

Powered by Google App Engine
This is Rietveld 408576698