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

Unified Diff: lib/src/codegen/js_names.dart

Issue 1139673005: fix temps that have the same name to have different Elements (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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: lib/src/codegen/js_names.dart
diff --git a/lib/src/codegen/js_names.dart b/lib/src/codegen/js_names.dart
index 9d03bc37cb69d7939447509fe15f37d92c391ac4..00ee437a6231bef9120e9a0ab4c880c9ac3e9e93 100644
--- a/lib/src/codegen/js_names.dart
+++ b/lib/src/codegen/js_names.dart
@@ -85,7 +85,10 @@ class _RenameVisitor extends VariableDeclarationVisitor {
declare(Identifier node) {
var id = identifierKey(node);
- scope.declared.add(id);
+ var notAlreadyDeclared = scope.declared.add(id);
+ // Normal identifiers can be declared multiple times, because we don't
+ // implement block scope yet. However temps should only be declared once.
+ assert(notAlreadyDeclared || node is! TemporaryId);
_markUsed(node, id, scope);
}

Powered by Google App Engine
This is Rietveld 408576698