| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 '../closure.dart'; | 5 import '../closure.dart'; |
| 6 import '../common.dart'; | 6 import '../common.dart'; |
| 7 import '../elements/elements.dart'; | 7 import '../elements/elements.dart'; |
| 8 import '../elements/entities.dart'; | 8 import '../elements/entities.dart'; |
| 9 import '../elements/types.dart'; | 9 import '../elements/types.dart'; |
| 10 import '../io/source_information.dart'; | 10 import '../io/source_information.dart'; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 builder.add(box); | 133 builder.add(box); |
| 134 return box; | 134 return box; |
| 135 } | 135 } |
| 136 | 136 |
| 137 /// If the scope (function or loop) [node] has captured variables then this | 137 /// If the scope (function or loop) [node] has captured variables then this |
| 138 /// method creates a box and sets up the redirections. | 138 /// method creates a box and sets up the redirections. |
| 139 void enterScope(ClosureAnalysisInfo closureInfo, | 139 void enterScope(ClosureAnalysisInfo closureInfo, |
| 140 {bool forGenerativeConstructorBody: false}) { | 140 {bool forGenerativeConstructorBody: false}) { |
| 141 // See if any variable in the top-scope of the function is captured. If yes | 141 // See if any variable in the top-scope of the function is captured. If yes |
| 142 // we need to create a box-object. | 142 // we need to create a box-object. |
| 143 if (!closureInfo.requiresContextBox()) return; | 143 if (!closureInfo.requiresContextBox) return; |
| 144 HInstruction box; | 144 HInstruction box; |
| 145 // The scope has captured variables. | 145 // The scope has captured variables. |
| 146 if (forGenerativeConstructorBody) { | 146 if (forGenerativeConstructorBody) { |
| 147 // The box is passed as a parameter to a generative | 147 // The box is passed as a parameter to a generative |
| 148 // constructor body. | 148 // constructor body. |
| 149 box = builder.addParameter(closureInfo.context, commonMasks.nonNullType); | 149 box = builder.addParameter(closureInfo.context, commonMasks.nonNullType); |
| 150 } else { | 150 } else { |
| 151 box = createBox(); | 151 box = createBox(); |
| 152 } | 152 } |
| 153 // Add the box to the known locals. | 153 // Add the box to the known locals. |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 final MemberEntity memberContext; | 673 final MemberEntity memberContext; |
| 674 | 674 |
| 675 // Avoid slow Object.hashCode. | 675 // Avoid slow Object.hashCode. |
| 676 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); | 676 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); |
| 677 static int _nextHashCode = 0; | 677 static int _nextHashCode = 0; |
| 678 | 678 |
| 679 SyntheticLocal(this.name, this.executableContext, this.memberContext); | 679 SyntheticLocal(this.name, this.executableContext, this.memberContext); |
| 680 | 680 |
| 681 toString() => 'SyntheticLocal($name)'; | 681 toString() => 'SyntheticLocal($name)'; |
| 682 } | 682 } |
| OLD | NEW |