| Index: pkg/compiler/lib/src/js_model/closure.dart
|
| diff --git a/pkg/compiler/lib/src/js_model/closure.dart b/pkg/compiler/lib/src/js_model/closure.dart
|
| index 8ecb8b571bcc1c56b316a461e344d038ef51e98f..e35f4c6e85e3fa900c5f7bb02d142224f4190d08 100644
|
| --- a/pkg/compiler/lib/src/js_model/closure.dart
|
| +++ b/pkg/compiler/lib/src/js_model/closure.dart
|
| @@ -388,14 +388,14 @@ class KernelClosureClass extends JsScopeInfo
|
| @override
|
| void forEachBoxedVariable(f(Local local, JField field)) {
|
| for (Local l in localToFieldMap.keys) {
|
| - if (localToFieldMap[l] is JBoxedField) f(l, localToFieldMap[l]);
|
| + if (localToFieldMap[l] is JRecordField) f(l, localToFieldMap[l]);
|
| }
|
| }
|
|
|
| void forEachFreeVariable(f(Local variable, JField field)) {
|
| for (Local l in localToFieldMap.keys) {
|
| var jField = localToFieldMap[l];
|
| - if (jField is! JBoxedField && jField is! BoxLocal) f(l, jField);
|
| + if (jField is! JRecordField && jField is! BoxLocal) f(l, jField);
|
| }
|
| }
|
|
|
| @@ -437,18 +437,39 @@ class JClosureField extends JField {
|
| isStatic: false);
|
| }
|
|
|
| -/// A ClosureField that has been "boxed" to prevent name shadowing with the
|
| +/// A container for variables declared in a particular scope that are accessed
|
| +/// elsewhere.
|
| +// TODO(efortuna, johnniwinther): Don't implement JClass. This isn't actually a
|
| +// class.
|
| +class JRecord implements JClass {
|
| + final JLibrary library;
|
| + final String name;
|
| +
|
| + /// Index into the classData, classList and classEnvironment lists where this
|
| + /// entity is stored in [JsToFrontendMapImpl].
|
| + final int classIndex;
|
| +
|
| + JRecord(this.library, this.classIndex, this.name);
|
| +
|
| + bool get isAbstract => false;
|
| +
|
| + bool get isClosure => false;
|
| +
|
| + String toString() => '${jsElementPrefix}record_container($name)';
|
| +}
|
| +
|
| +/// A variable that has been "boxed" to prevent name shadowing with the
|
| /// original variable and ensure that this variable is updated/read with the
|
| /// most recent value.
|
| /// This corresponds to BoxFieldElement; we reuse BoxLocal from the original
|
| /// algorithm to correspond to the actual name of the variable.
|
| -class JBoxedField extends JField {
|
| +class JRecordField extends JField {
|
| final BoxLocal box;
|
| - JBoxedField(String name, int memberIndex, this.box, JClass containingClass,
|
| - bool isConst, bool isAssignable)
|
| + JRecordField(String name, int memberIndex, this.box, JClass containingClass,
|
| + bool isConst)
|
| : super(memberIndex, containingClass.library, containingClass,
|
| new Name(name, containingClass.library),
|
| - isAssignable: isAssignable, isConst: isConst);
|
| + isStatic: false, isAssignable: true, isConst: isConst);
|
| }
|
|
|
| class ClosureClassDefinition implements ClassDefinition {
|
| @@ -548,6 +569,21 @@ class ClosureMemberDefinition implements MemberDefinition {
|
| 'ClosureMemberDefinition(kind:$kind,member:$member,location:$location)';
|
| }
|
|
|
| +class RecordContainerDefinition implements ClassDefinition {
|
| + final ClassEntity cls;
|
| + final SourceSpan location;
|
| +
|
| + RecordContainerDefinition(this.cls, this.location);
|
| +
|
| + ClassKind get kind => ClassKind.record;
|
| +
|
| + ir.Node get node =>
|
| + throw new UnsupportedError('RecordContainerDefinition.node for $cls');
|
| +
|
| + String toString() =>
|
| + 'RecordContainerDefinition(kind:$kind,cls:$cls,location:$location)';
|
| +}
|
| +
|
| /// Collection of scope data collected for a single member.
|
| class ScopeModel {
|
| /// Collection [ScopeInfo] data for the member.
|
|
|