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

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

Issue 1022023002: Revert "Do not use the namer for naming closure elements." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 | « pkg/compiler/lib/src/js_backend/minify_namer.dart ('k') | no next file » | 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 5411599b637c5a0e14fe2cd8e5b49fa0377adfaa..9308dc16b2ef2f0271c0409e0f98c54fe9621686 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -101,7 +101,7 @@ part of js_backend;
* For local variables, the [Namer] only provides *proposed names*. These names
* must be disambiguated elsewhere.
*/
-class Namer {
+class Namer implements ClosureNamer {
static const List<String> javaScriptKeywords = const <String>[
// These are current keywords.
@@ -972,6 +972,20 @@ class Namer {
return name;
}
+ /// Generate a unique name for the [id]th closure variable, with proposed name
+ /// [name].
+ ///
+ /// The result is used as the name of [BoxFieldElement]s and
+ /// [ClosureFieldElement]s, and must therefore be unique to avoid breaking an
+ /// invariant in the element model (classes cannot declare multiple fields
+ /// with the same name).
+ ///
+ /// Since the result is used as an element name, it will later show up as a
+ /// *proposed name* when the element is passed to [instanceFieldPropertyName].
+ String getClosureVariableName(String name, int id) {
+ return "${name}_$id";
+ }
+
/**
* Returns a proposed name for the given top-level or static element.
* The returned id is guaranteed to be a valid JS-id.
« no previous file with comments | « pkg/compiler/lib/src/js_backend/minify_namer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698