| 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.
|
|
|