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) { |