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

Unified Diff: lib/compiler/implementation/tree/nodes.dart

Issue 9802023: Correctly handle constness for list and map literals inside bodies. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add TODOs. Created 8 years, 9 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 | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/tree/nodes.dart
diff --git a/lib/compiler/implementation/tree/nodes.dart b/lib/compiler/implementation/tree/nodes.dart
index 6b489f4eea5ca4240047a5270c7a042daa22b5ce..01f6cf276062779a1750bbb180ac2eb2476892ad 100644
--- a/lib/compiler/implementation/tree/nodes.dart
+++ b/lib/compiler/implementation/tree/nodes.dart
@@ -1220,9 +1220,11 @@ class LiteralMap extends Expression {
final NodeList typeArguments;
final NodeList entries;
- LiteralMap(this.typeArguments, this.entries);
+ final Token constKeyword;
+
+ LiteralMap(this.typeArguments, this.entries, this.constKeyword);
- bool isConst() => false; // TODO(ahe): Store constness.
+ bool isConst() => constKeyword !== null;
LiteralMap asLiteralMap() => this;
@@ -1233,7 +1235,10 @@ class LiteralMap extends Expression {
entries.accept(visitor);
}
- Token getBeginToken() => firstBeginToken(typeArguments, entries);
+ Token getBeginToken() {
+ if (constKeyword !== null) return constKeyword;
+ return firstBeginToken(typeArguments, entries);
+ }
Token getEndToken() => entries.getEndToken();
}
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698