OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
6 | 6 |
7 import '../closure.dart'; | 7 import '../closure.dart'; |
8 import '../common.dart'; | 8 import '../common.dart'; |
9 import '../common/tasks.dart'; | 9 import '../common/tasks.dart'; |
10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 switch (definition.kind) { | 93 switch (definition.kind) { |
94 case MemberKind.regular: | 94 case MemberKind.regular: |
95 case MemberKind.constructor: | 95 case MemberKind.constructor: |
96 break; | 96 break; |
97 default: | 97 default: |
98 failedAt(entity, "Unexpected member definition $definition"); | 98 failedAt(entity, "Unexpected member definition $definition"); |
99 } | 99 } |
100 ir.Node node = definition.node; | 100 ir.Node node = definition.node; |
101 if (_capturedScopesMap.keys.contains(node)) return; | 101 if (_capturedScopesMap.keys.contains(node)) return; |
102 CapturedScopeBuilder translator = new CapturedScopeBuilder( | 102 CapturedScopeBuilder translator = new CapturedScopeBuilder( |
| 103 entity, |
103 _capturedScopesMap, | 104 _capturedScopesMap, |
104 _scopeMap, | 105 _scopeMap, |
105 entity, | |
106 closuresToGenerate, | 106 closuresToGenerate, |
107 _globalLocalsMap.getLocalsMap(entity), | 107 _globalLocalsMap.getLocalsMap(entity), |
108 _elementMap); | 108 _elementMap); |
109 if (entity.isField) { | 109 if (entity.isField) { |
110 if (node is ir.Field && node.initializer != null) { | 110 if (node is ir.Field && node.initializer != null) { |
111 translator.translateLazyInitializer(node); | 111 translator.translateLazyInitializer(node); |
112 } | 112 } |
113 } else { | 113 } else { |
114 assert(node is ir.Procedure || node is ir.Constructor); | 114 assert(node is ir.Procedure || node is ir.Constructor); |
115 translator.translateConstructorOrProcedure(node); | 115 translator.translateConstructorOrProcedure(node); |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 ClosureClassDefinition(this.cls, this.location); | 434 ClosureClassDefinition(this.cls, this.location); |
435 | 435 |
436 ClassKind get kind => ClassKind.closure; | 436 ClassKind get kind => ClassKind.closure; |
437 | 437 |
438 ir.Node get node => | 438 ir.Node get node => |
439 throw new UnsupportedError('ClosureClassDefinition.node for $cls'); | 439 throw new UnsupportedError('ClosureClassDefinition.node for $cls'); |
440 | 440 |
441 String toString() => | 441 String toString() => |
442 'ClosureClassDefinition(kind:$kind,cls:$cls,location:$location)'; | 442 'ClosureClassDefinition(kind:$kind,cls:$cls,location:$location)'; |
443 } | 443 } |
OLD | NEW |