Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 library closureToClassMapper; | 5 library closureDataLookup; |
|
Siggi Cherem (dart-lang)
2017/06/14 23:17:12
nit: the convention is to use a lower.case.name.wi
Emily Fortuna
2017/06/14 23:44:13
removed
| |
| 6 | 6 |
| 7 import 'common/names.dart' show Identifiers; | 7 import 'common/names.dart' show Identifiers; |
| 8 import 'common/resolution.dart' show ParsingContext, Resolution; | 8 import 'common/resolution.dart' show ParsingContext, Resolution; |
| 9 import 'common/tasks.dart' show CompilerTask; | 9 import 'common/tasks.dart' show CompilerTask; |
| 10 import 'common.dart'; | 10 import 'common.dart'; |
| 11 import 'compiler.dart' show Compiler; | 11 import 'compiler.dart' show Compiler; |
| 12 import 'constants/expressions.dart'; | 12 import 'constants/expressions.dart'; |
| 13 import 'elements/elements.dart'; | 13 import 'elements/elements.dart'; |
| 14 import 'elements/entities.dart'; | 14 import 'elements/entities.dart'; |
| 15 import 'elements/entity_utils.dart' as utils; | 15 import 'elements/entity_utils.dart' as utils; |
| 16 import 'elements/modelx.dart' | 16 import 'elements/modelx.dart' |
| 17 show BaseFunctionElementX, ClassElementX, ElementX; | 17 show BaseFunctionElementX, ClassElementX, ElementX; |
| 18 import 'elements/resolution_types.dart'; | 18 import 'elements/resolution_types.dart'; |
| 19 import 'elements/types.dart'; | 19 import 'elements/types.dart'; |
| 20 import 'elements/visitor.dart' show ElementVisitor; | 20 import 'elements/visitor.dart' show ElementVisitor; |
| 21 import 'js_backend/js_backend.dart' show JavaScriptBackend; | 21 import 'js_backend/js_backend.dart' show JavaScriptBackend; |
| 22 import 'resolution/tree_elements.dart' show TreeElements; | 22 import 'resolution/tree_elements.dart' show TreeElements; |
| 23 import 'package:front_end/src/fasta/scanner.dart' show Token; | 23 import 'package:front_end/src/fasta/scanner.dart' show Token; |
| 24 import 'tree/tree.dart'; | 24 import 'tree/tree.dart'; |
| 25 import 'util/util.dart'; | 25 import 'util/util.dart'; |
| 26 import 'world.dart' show ClosedWorldRefiner; | 26 import 'world.dart' show ClosedWorldRefiner; |
| 27 | 27 |
| 28 /// Where T is ir.Node or Node. | 28 /// Class that provides information for how closures are rewritten/represented |
| 29 // TODO(efortuna): Rename this class. | 29 /// to preserve Dart semantics in other situations. Given a particular node to |
|
Siggi Cherem (dart-lang)
2017/06/14 23:17:12
not sure I follow the prat "in other situations" h
Emily Fortuna
2017/06/14 23:44:13
Done.
| |
| 30 abstract class ClosureClassMaps<T> { | 30 /// look up, it returns a information about the internal representation of how |
| 31 /// closure conversion is implemented. T is an ir.Node or Node. | |
| 32 abstract class ClosureDataLookup<T> { | |
|
Siggi Cherem (dart-lang)
2017/06/14 23:17:12
another reason I'd change *Info below to *Data :-)
Emily Fortuna
2017/06/14 23:44:13
I messaged you in chat about this:
For me, as a n
Siggi Cherem (dart-lang)
2017/06/15 00:09:01
Thanks, to bring the full loop of the discussion:
| |
| 31 /// Look up information about the variables that have been mutated and are | 33 /// Look up information about the variables that have been mutated and are |
| 32 /// used inside the scope of [node]. | 34 /// used inside the scope of [node]. |
| 33 // TODO(johnniwinther): Split this up into two functions, one for members and | 35 // TODO(johnniwinther): Split this up into two functions, one for members and |
| 34 // one for local functions. | 36 // one for local functions. |
| 35 ClosureRepresentationInfo getClosureRepresentationInfo(Entity member); | 37 ClosureRepresentationInfo getClosureRepresentationInfo(Entity member); |
| 36 | 38 |
| 37 /// Look up information about a loop, in case any variables it declares need | 39 /// Look up information about a loop, in case any variables it declares need |
| 38 /// to be boxed/snapshotted. | 40 /// to be boxed/snapshotted. |
| 39 LoopClosureRepresentationInfo getClosureRepresentationInfoForLoop(T loopNode); | 41 LoopClosureRepresentationInfo getClosureRepresentationInfoForLoop(T loopNode); |
| 40 | 42 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 /// Return true if [variable] has been captured and mutated (all other | 189 /// Return true if [variable] has been captured and mutated (all other |
| 188 /// variables do not require boxing). | 190 /// variables do not require boxing). |
| 189 bool isVariableBoxed(Local variable) => false; | 191 bool isVariableBoxed(Local variable) => false; |
| 190 | 192 |
| 191 // TODO(efortuna): Remove this method. The old system was using | 193 // TODO(efortuna): Remove this method. The old system was using |
| 192 // ClosureClassMaps for situations other than closure class maps, and that's | 194 // ClosureClassMaps for situations other than closure class maps, and that's |
| 193 // just confusing. | 195 // just confusing. |
| 194 bool get isClosure => false; | 196 bool get isClosure => false; |
| 195 } | 197 } |
| 196 | 198 |
| 197 class ClosureTask extends CompilerTask implements ClosureClassMaps<Node> { | 199 class ClosureTask extends CompilerTask implements ClosureDataLookup<Node> { |
| 198 Map<Node, ClosureScope> _closureInfoMap = <Node, ClosureScope>{}; | 200 Map<Node, ClosureScope> _closureInfoMap = <Node, ClosureScope>{}; |
| 199 Map<Element, ClosureClassMap> _closureMappingCache = | 201 Map<Element, ClosureClassMap> _closureMappingCache = |
| 200 <Element, ClosureClassMap>{}; | 202 <Element, ClosureClassMap>{}; |
| 201 Compiler compiler; | 203 Compiler compiler; |
| 202 ClosureTask(Compiler compiler) | 204 ClosureTask(Compiler compiler) |
| 203 : compiler = compiler, | 205 : compiler = compiler, |
| 204 super(compiler.measurer); | 206 super(compiler.measurer); |
| 205 | 207 |
| 206 String get name => "Closure Simplifier"; | 208 String get name => "Closure Simplifier"; |
| 207 | 209 |
| (...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1444 /// | 1446 /// |
| 1445 /// Move the below classes to a JS model eventually. | 1447 /// Move the below classes to a JS model eventually. |
| 1446 /// | 1448 /// |
| 1447 abstract class JSEntity implements MemberEntity { | 1449 abstract class JSEntity implements MemberEntity { |
| 1448 Local get declaredEntity; | 1450 Local get declaredEntity; |
| 1449 } | 1451 } |
| 1450 | 1452 |
| 1451 abstract class PrivatelyNamedJSEntity implements JSEntity { | 1453 abstract class PrivatelyNamedJSEntity implements JSEntity { |
| 1452 Entity get rootOfScope; | 1454 Entity get rootOfScope; |
| 1453 } | 1455 } |
| OLD | NEW |