| 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 class ClosureFieldElement extends Element { | 5 class ClosureFieldElement extends Element { |
| 6 ClosureFieldElement(SourceString name, ClassElement enclosing) | 6 ClosureFieldElement(SourceString name, ClassElement enclosing) |
| 7 : super(name, ElementKind.FIELD, enclosing); | 7 : super(name, ElementKind.FIELD, enclosing); |
| 8 | 8 |
| 9 bool isInstanceMember() => true; | 9 bool isInstanceMember() => true; |
| 10 bool isAssignable() => false; | 10 bool isAssignable() => false; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 FunctionElement currentFunctionElement; | 116 FunctionElement currentFunctionElement; |
| 117 // The closureData of the currentFunctionElement. | 117 // The closureData of the currentFunctionElement. |
| 118 ClosureData closureData; | 118 ClosureData closureData; |
| 119 | 119 |
| 120 bool insideClosure = false; | 120 bool insideClosure = false; |
| 121 | 121 |
| 122 ClosureTranslator(Compiler compiler, this.elements) | 122 ClosureTranslator(Compiler compiler, this.elements) |
| 123 : capturedVariableMapping = new Map<Element, Element>(), | 123 : capturedVariableMapping = new Map<Element, Element>(), |
| 124 closures = <FunctionExpression>[], | 124 closures = <FunctionExpression>[], |
| 125 this.compiler = compiler, | 125 this.compiler = compiler, |
| 126 this.closureDataCache = compiler.builder.closureDataCache; | 126 this.closureDataCache = compiler.backend.builder.closureDataCache; |
| 127 | 127 |
| 128 ClosureData translate(Node node) { | 128 ClosureData translate(Node node) { |
| 129 // Closures have already been analyzed when visiting the surrounding | 129 // Closures have already been analyzed when visiting the surrounding |
| 130 // method/function. This also shortcuts for bailout functions. | 130 // method/function. This also shortcuts for bailout functions. |
| 131 ClosureData cached = closureDataCache[node]; | 131 ClosureData cached = closureDataCache[node]; |
| 132 if (cached !== null) return cached; | 132 if (cached !== null) return cached; |
| 133 | 133 |
| 134 visit(node); | 134 visit(node); |
| 135 // When variables need to be boxed their [capturedVariableMapping] is | 135 // When variables need to be boxed their [capturedVariableMapping] is |
| 136 // updated, but we delay updating the similar freeVariableMapping in the | 136 // updated, but we delay updating the similar freeVariableMapping in the |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 declareLocal(elements[node]); | 429 declareLocal(elements[node]); |
| 430 } | 430 } |
| 431 | 431 |
| 432 visitTryStatement(TryStatement node) { | 432 visitTryStatement(TryStatement node) { |
| 433 // TODO(ngeoffray): implement finer grain state. | 433 // TODO(ngeoffray): implement finer grain state. |
| 434 inTryCatchOrFinally = true; | 434 inTryCatchOrFinally = true; |
| 435 node.visitChildren(this); | 435 node.visitChildren(this); |
| 436 inTryCatchOrFinally = false; | 436 inTryCatchOrFinally = false; |
| 437 } | 437 } |
| 438 } | 438 } |
| OLD | NEW |