@@ -35,14 +35,6 @@ abstract class ClosureData {
3535 /// Accessor to the information about scopes that closures capture. Used by
3636 /// the SSA builder.
3737 CapturedScope getCapturedScope (MemberEntity entity);
38-
39- /// If [entity] is a closure call method or closure signature method, the
40- /// original enclosing member is returned. Otherwise [entity] is returned.
41- ///
42- /// A member and its nested closure share the underlying AST, we need to
43- /// ensure that locals are shared between them. We therefore store the
44- /// locals in the global locals map using the enclosing member as key.
45- MemberEntity getEnclosingMember (MemberEntity entity);
4638}
4739
4840/// Enum used for identifying [ScopeInfo] subclasses in serialization.
@@ -76,7 +68,7 @@ class ScopeInfo {
7668 case ScopeInfoKind .capturedLoopScope:
7769 return new JsCapturedLoopScope .readFromDataSource (source);
7870 case ScopeInfoKind .closureRepresentationInfo:
79- return new JsClosureClassInfo .readFromDataSource (source);
71+ return new KernelClosureClassInfo .readFromDataSource (source);
8072 }
8173 throw new UnsupportedError ('Unexpected ScopeInfoKind $kind ' );
8274 }
@@ -100,8 +92,7 @@ class ScopeInfo {
10092 /// Also parameters to a `sync*` generator must be boxed, because of the way
10193 /// we rewrite sync* functions. See also comments in
10294 /// [ClosureClassMap.useLocal] .
103- bool localIsUsedInTryOrSync (KernelToLocalsMap localsMap, Local variable) =>
104- false ;
95+ bool localIsUsedInTryOrSync (Local variable) => false ;
10596
10697 /// Loop through each variable that has been defined in this scope, modified
10798 /// anywhere (this scope or another scope) and used in another scope. Because
@@ -113,11 +104,10 @@ class ScopeInfo {
113104 /// In the case of loops, this is the set of iteration variables (or any
114105 /// variables declared in the for loop expression (`for (...here...)` ) that
115106 /// need to be boxed to snapshot their value.
116- void forEachBoxedVariable (
117- KernelToLocalsMap localsMap, f (Local local, FieldEntity field)) {}
107+ void forEachBoxedVariable (f (Local local, FieldEntity field)) {}
118108
119109 /// True if [variable] has been mutated and is also used in another scope.
120- bool isBoxedVariable (KernelToLocalsMap localsMap, Local variable) => false ;
110+ bool isBoxedVariable (Local variable) => false ;
121111}
122112
123113/// Class representing the usage of a scope that has been captured in the
@@ -151,7 +141,7 @@ class CapturedScope extends ScopeInfo {
151141 /// executed. This will encapsulate the value of any variables that have been
152142 /// scoped into this context from outside. This is an accessor to the
153143 /// contextBox that [requiresContextBox] is testing is required.
154- Local get contextBox => null ;
144+ Local get context => null ;
155145}
156146
157147/// Class that describes the actual mechanics of how values of variables
@@ -205,8 +195,7 @@ class CapturedLoopScope extends CapturedScope {
205195 ///
206196 /// `i` would be a part of the boxedLoopVariables AND boxedVariables, but b
207197 /// would only be a part of boxedVariables.
208- List <Local > getBoxedLoopVariables (KernelToLocalsMap localsMap) =>
209- const < Local > [];
198+ List <Local > get boxedLoopVariables => const < Local > [];
210199}
211200
212201/// Class that describes the actual mechanics of how the converted, rewritten
@@ -250,15 +239,15 @@ class ClosureRepresentationInfo extends ScopeInfo {
250239 throw new UnsupportedError (
251240 'Unexpected ClosureRepresentationInfo kind $kind ' );
252241 case ScopeInfoKind .closureRepresentationInfo:
253- return new JsClosureClassInfo .readFromDataSource (source);
242+ return new KernelClosureClassInfo .readFromDataSource (source);
254243 }
255244 throw new UnsupportedError ('Unexpected ScopeInfoKind $kind ' );
256245 }
257246
258247 /// The original local function before any translation.
259248 ///
260249 /// Will be null for methods.
261- Local getClosureEntity ( KernelToLocalsMap localsMap) => null ;
250+ Local get closureEntity => null ;
262251
263252 /// The entity for the class used to represent the rewritten closure in the
264253 /// emitted JavaScript.
@@ -277,14 +266,13 @@ class ClosureRepresentationInfo extends ScopeInfo {
277266 /// List of locals that this closure class has created corresponding field
278267 /// entities for.
279268 @deprecated
280- List <Local > getCreatedFieldEntities (KernelToLocalsMap localsMap) =>
281- const < Local > [];
269+ List <Local > get createdFieldEntities => const < Local > [];
282270
283271 /// As shown in the example in the comments at the top of this class, we
284272 /// create fields in the closure class for each captured variable. This is an
285273 /// accessor the [local] for which [field] was created.
286274 /// Returns the [local] for which [field] was created.
287- Local getLocalForField (KernelToLocalsMap localsMap, FieldEntity field) {
275+ Local getLocalForField (FieldEntity field) {
288276 failedAt (field, "No local for $field ." );
289277 return null ;
290278 }
@@ -301,14 +289,12 @@ class ClosureRepresentationInfo extends ScopeInfo {
301289 /// strictly variables defined in this closure, unlike the behavior in
302290 /// the superclass ScopeInfo.
303291 @override
304- void forEachBoxedVariable (
305- KernelToLocalsMap localsMap, f (Local local, FieldEntity field)) {}
292+ void forEachBoxedVariable (f (Local local, FieldEntity field)) {}
306293
307294 /// Loop through each free variable in this closure. Free variables are the
308295 /// variables that have been captured *just* in this closure, not in nested
309296 /// scopes.
310- void forEachFreeVariable (
311- KernelToLocalsMap localsMap, f (Local variable, FieldEntity field)) {}
297+ void forEachFreeVariable (f (Local variable, FieldEntity field)) {}
312298
313299 // TODO(efortuna): Remove this method. The old system was using
314300 // ClosureClassMaps for situations other than closure class maps, and that's
0 commit comments