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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart

Issue 255843005: Avoid generating VariableUse nodes with non-identifier names (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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: sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
index c2cb16be184f734ce89383a9af869eff74fd08e8..b46b6fb5dd49ec20300183d7c29d8de630cf5f56 100644
--- a/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_emitter/type_test_emitter.dart
@@ -279,25 +279,36 @@ class TypeTestEmitter extends CodeEmitterHelper {
// Add checks to the constructors of instantiated classes.
// TODO(sigurdm): We should avoid running through this list for each
// output unit.
+
+ List<jsAst.Statement> statements = <jsAst.Statement>[];
+
for (ClassElement cls in typeChecks) {
OutputUnit destination =
compiler.deferredLoadTask.outputUnitForElement(cls);
if (destination != outputUnit) continue;
// TODO(9556). The properties added to 'holder' should be generated
// directly as properties of the class object, not added later.
- String holder = namer.isolateAccess(backend.getImplementationClass(cls));
+ jsAst.Expression holder
+ = namer.elementAccess(backend.getImplementationClass(cls));
+
for (TypeCheck check in typeChecks[cls]) {
ClassElement cls = check.cls;
- buffer.write('$holder.${namer.operatorIs(cls)}$_=${_}true$N');
+ buffer.write(
+ jsAst.prettyPrint(
+ js('#.# = true', [holder, namer.operatorIs(cls)]),
+ compiler));
+ buffer.write('$N');
Substitution substitution = check.substitution;
if (substitution != null) {
- CodeBuffer body =
- jsAst.prettyPrint(substitution.getCode(rti, false), compiler);
- buffer.write('$holder.${namer.substitutionName(cls)}$_=${_}');
- buffer.write(body);
+ jsAst.Expression body = substitution.getCode(rti, false);
+ buffer.write(
+ jsAst.prettyPrint(
+ js('#.# = #',
+ [holder, namer.substitutionName(cls), body]),
+ compiler));
buffer.write('$N');
}
- };
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698