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

Unified Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10035059: Special case mangling for a variable named 't'. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/codegen.dart
===================================================================
--- lib/compiler/implementation/ssa/codegen.dart (revision 6746)
+++ lib/compiler/implementation/ssa/codegen.dart (working copy)
@@ -93,6 +93,8 @@
static final int STATE_EXPRESSION = 3;
static final int STATE_DECLARATION = 4;
+ static final String TEMPORARY_PREFIX = 't';
+
final Compiler compiler;
final WorkItem work;
final StringBuffer buffer;
@@ -156,7 +158,7 @@
}
// Create a namespace for temporaries.
- prefixes['t'] = 0;
+ prefixes[TEMPORARY_PREFIX] = 0;
equalsNullElement =
compiler.builder.interceptors.getEqualsNullInterceptor();
@@ -277,11 +279,16 @@
String name = names[id];
if (name !== null) return name;
- String prefix = 't';
+ String prefix = TEMPORARY_PREFIX;
if (instruction.sourceElement !== null) {
Element element = instruction.sourceElement;
if (element !== null && !element.name.isEmpty()) {
prefix = element.name.slowToString();
+ // Special case the variable named [TEMPORARY_PREFIX] to allow keeping its
floitsch 2012/04/20 10:36:37 80 chars.
+ // name.
+ if (prefix == TEMPORARY_PREFIX && !usedNames.contains(prefix)) {
+ return newName(id, prefix);
+ }
// If we've never seen that prefix before, try to use it
// directly.
if (!prefixes.containsKey(prefix)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698