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

Unified Diff: pkg/compiler/lib/src/js_backend/namer.dart

Issue 1274203003: dart2js: Ensure each use site of a name uses a new ast node. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | pkg/compiler/lib/src/js_backend/namer_names.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/namer.dart
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index ad7f725dbb3237f19e8435efc38343afc95837d1..917295e42356ab41c9cf0f9301b8652dafe222cc 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -520,6 +520,14 @@ class Namer {
}
}
+ /// Return a reference to the given [name].
+ ///
+ /// This is used to ensure that every use site of a name has a unique node so
+ /// that we can properly attribute source information.
+ jsAst.Name _newReference(jsAst.Name name) {
+ return new _NameReference(name);
+ }
+
/// Disambiguated name for [constant].
///
/// Unique within the global-member namespace.
@@ -534,7 +542,7 @@ class Namer {
result = getFreshName(NamingScope.constant, longName);
constantNames[constant] = result;
}
- return result;
+ return _newReference(result);
}
/// Proposed name for [constant].
@@ -855,7 +863,7 @@ class Namer {
newName = getFreshName(NamingScope.global, name);
internalGlobals[name] = newName;
}
- return newName;
+ return _newReference(newName);
}
/// Returns the property name to use for a compiler-owner global variable,
@@ -902,7 +910,7 @@ class Namer {
newName = getFreshName(NamingScope.global, proposedName);
userGlobals[element] = newName;
}
- return newName;
+ return _newReference(newName);
}
/// Returns the disambiguated name for an instance method or field
@@ -943,7 +951,7 @@ class Namer {
sanitizeForAnnotations: true);
userInstanceMembers[key] = newName;
}
- return newName;
+ return _newReference(newName);
}
/// Returns the disambiguated name for the instance member identified by
@@ -966,7 +974,7 @@ class Namer {
sanitizeForAnnotations: true);
userInstanceMembers[key] = newName;
}
- return newName;
+ return _newReference(newName);
}
/// Forces the public instance member with [originalName] to have the given
@@ -1006,7 +1014,7 @@ class Namer {
sanitizeForNatives: mayClashNative);
internalInstanceMembers[element] = newName;
}
- return newName;
+ return _newReference(newName);
}
/// Disambiguated name for the given operator.
@@ -1021,7 +1029,7 @@ class Namer {
newName = getFreshName(NamingScope.instance, operatorIdentifier);
userInstanceOperators[operatorIdentifier] = newName;
}
- return newName;
+ return _newReference(newName);
}
String _generateFreshStringForName(String proposedName,
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/namer_names.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698