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

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

Issue 139903008: List literals in polymer_expressions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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/expression.dart
diff --git a/pkg/polymer_expressions/lib/expression.dart b/pkg/polymer_expressions/lib/expression.dart
index 5a69ab05891db0e655869bcf7e0295d76520746c..54adfd7579bc7c2a7730309996b63786f1de26b2 100644
--- a/pkg/polymer_expressions/lib/expression.dart
+++ b/pkg/polymer_expressions/lib/expression.dart
@@ -10,6 +10,7 @@ import 'visitor.dart';
EmptyExpression empty() => const EmptyExpression();
Literal literal(v) => new Literal(v);
+ListLiteral listLiteral(List<Expression> items) => new ListLiteral(items);
MapLiteral mapLiteral(List<MapLiteralEntry> entries) => new MapLiteral(entries);
MapLiteralEntry mapLiteralEntry(Literal key, Expression value) =>
new MapLiteralEntry(key, value);
@@ -85,6 +86,20 @@ class Literal<T> extends Expression {
int get hashCode => value.hashCode;
}
+class ListLiteral extends Expression {
+ final List<Expression> items;
+
+ ListLiteral(this.items);
+
+ accept(Visitor v) => v.visitListLiteral(this);
+
+ String toString() => "$items";
+
+ bool operator ==(o) => o is ListLiteral && _listEquals(o.items, items);
+
+ int get hashCode => _hashList(items);
+}
+
class MapLiteral extends Expression {
final List<MapLiteralEntry> entries;

Powered by Google App Engine
This is Rietveld 408576698