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

Unified Diff: frog/gen.dart

Issue 8662015: fix generic const canonicalization bug (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: presubmit tests Created 9 years, 1 month 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 | « frog/frogsh ('k') | frog/leg/scanner/listener.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/gen.dart
diff --git a/frog/gen.dart b/frog/gen.dart
index 3357544b0bf80633835c206f3298f3ff18419cb4..8c68880923fa0d4a83a7db142cc993d7932d2b2e 100644
--- a/frog/gen.dart
+++ b/frog/gen.dart
@@ -111,12 +111,15 @@ class WorldGenerator {
}
GlobalValue globalForConst(EvaluatedValue exp, List<Value> dependencies) {
- var code = exp.canonicalCode;
- if (!globals.containsKey(code)) {
- globals[code] =
+ // Include type name to ensure unique constants - this matches
+ // the code above that includes the type name for static fields.
+ var key = exp.type.jsname + ':' + exp.canonicalCode;
+ if (!globals.containsKey(key)) {
+ globals[key] =
new GlobalValue.fromConst(globals.length, exp, dependencies);
}
- return globals[code];
+ assert(globals[key].type == exp.type);
+ return globals[key];
}
writeTypes(Library lib) {
« no previous file with comments | « frog/frogsh ('k') | frog/leg/scanner/listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698