| Index: pkg/compiler/lib/src/closure.dart
|
| diff --git a/pkg/compiler/lib/src/closure.dart b/pkg/compiler/lib/src/closure.dart
|
| index 00cb34ca1a62dca2496e1f335ff3f9d295c8ab1c..e14adef9debc880a86d00a81fc2d65105fe80fd3 100644
|
| --- a/pkg/compiler/lib/src/closure.dart
|
| +++ b/pkg/compiler/lib/src/closure.dart
|
| @@ -103,7 +103,7 @@ abstract class CapturedVariable implements Element {}
|
| // TODO(ahe): These classes continuously cause problems. We need to
|
| // find a more general solution.
|
| class ClosureFieldElement extends ElementX
|
| - implements FieldElement, CapturedVariable {
|
| + implements FieldElement, CapturedVariable, PrivatelyNamedJSEntity {
|
| /// The [BoxLocal] or [LocalElement] being accessed through the field.
|
| final Local local;
|
|
|
| @@ -120,6 +120,11 @@ class ClosureFieldElement extends ElementX
|
|
|
| MemberElement get memberContext => closureClass.methodElement.memberContext;
|
|
|
| + @override
|
| + Entity get declaredEntity => local;
|
| + @override
|
| + Entity get rootOfScope => closureClass;
|
| +
|
| bool get hasNode => false;
|
|
|
| Node get node {
|
| @@ -246,10 +251,12 @@ class BoxLocal extends Local {
|
| // TODO(ngeoffray, ahe): These classes continuously cause problems. We need to
|
| // find a more general solution.
|
| class BoxFieldElement extends ElementX
|
| - implements TypedElement, CapturedVariable, FieldElement {
|
| + implements TypedElement, CapturedVariable, FieldElement,
|
| + PrivatelyNamedJSEntity {
|
| final BoxLocal box;
|
|
|
| - BoxFieldElement(String name, this.variableElement, BoxLocal box)
|
| + BoxFieldElement(String name, this.variableElement,
|
| + BoxLocal box)
|
| : this.box = box,
|
| super(name, ElementKind.FIELD, box.executableContext);
|
|
|
| @@ -257,6 +264,11 @@ class BoxFieldElement extends ElementX
|
|
|
| DartType get type => variableElement.type;
|
|
|
| + @override
|
| + Entity get declaredEntity => variableElement;
|
| + @override
|
| + Entity get rootOfScope => box;
|
| +
|
| final VariableElement variableElement;
|
|
|
| accept(ElementVisitor visitor, arg) {
|
| @@ -519,6 +531,8 @@ class ClosureTranslator extends Visitor {
|
| ///
|
| /// Also, the names should be distinct from real field names to prevent
|
| /// clashes with selectors for those fields.
|
| + ///
|
| + /// These names are not used in generated code, just as element name.
|
| String getClosureVariableName(String name, int id) {
|
| return "_captured_${name}_$id";
|
| }
|
| @@ -532,6 +546,8 @@ class ClosureTranslator extends Visitor {
|
| ///
|
| /// Also, the names should be distinct from real field names to prevent
|
| /// clashes with selectors for those fields.
|
| + ///
|
| + /// These names are not used in generated code, just as element name.
|
| String getBoxFieldName(int id) {
|
| return "_box_$id";
|
| }
|
| @@ -1134,3 +1150,14 @@ class TypeVariableLocal implements Local {
|
| return typeVariable == other.typeVariable;
|
| }
|
| }
|
| +
|
| +///
|
| +/// Move the below classes to a JS model eventually.
|
| +///
|
| +abstract class JSEntity implements Entity {
|
| + Entity get declaredEntity;
|
| +}
|
| +
|
| +abstract class PrivatelyNamedJSEntity implements JSEntity {
|
| + Entity get rootOfScope;
|
| +}
|
|
|