| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 for (Element element in scopeVariables) { | 234 for (Element element in scopeVariables) { |
| 235 if (capturedVariableMapping.containsKey(element)) { | 235 if (capturedVariableMapping.containsKey(element)) { |
| 236 if (box == null) { | 236 if (box == null) { |
| 237 // TODO(floitsch): construct better box names. | 237 // TODO(floitsch): construct better box names. |
| 238 SourceString boxName = new SourceString("box${boxCounter++}"); | 238 SourceString boxName = new SourceString("box${boxCounter++}"); |
| 239 box = new Element(boxName, | 239 box = new Element(boxName, |
| 240 ElementKind.VARIABLE, | 240 ElementKind.VARIABLE, |
| 241 currentFunctionElement); | 241 currentFunctionElement); |
| 242 } | 242 } |
| 243 // TODO(floitsch): construct better boxed names. | 243 // TODO(floitsch): construct better boxed names. |
| 244 String elementName = element.name.toString(); | 244 String elementName = element.name.slowToString(); |
| 245 // We are currently using the name in an HForeign which could replace | 245 // We are currently using the name in an HForeign which could replace |
| 246 // "$X" with something else. | 246 // "$X" with something else. |
| 247 String escaped = elementName.replaceAll("\$", "_"); | 247 String escaped = elementName.replaceAll("\$", "_"); |
| 248 SourceString boxedName = new SourceString("${escaped}_${boxCounter++}"); | 248 SourceString boxedName = new SourceString("${escaped}_${boxCounter++}"); |
| 249 Element boxed = new Element(boxedName, ElementKind.FIELD, box); | 249 Element boxed = new Element(boxedName, ElementKind.FIELD, box); |
| 250 scopeMapping[element] = boxed; | 250 scopeMapping[element] = boxed; |
| 251 capturedVariableMapping[element] = boxed; | 251 capturedVariableMapping[element] = boxed; |
| 252 } | 252 } |
| 253 } | 253 } |
| 254 if (!scopeMapping.isEmpty()) { | 254 if (!scopeMapping.isEmpty()) { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 } | 396 } |
| 397 } | 397 } |
| 398 | 398 |
| 399 visitTryStatement(TryStatement node) { | 399 visitTryStatement(TryStatement node) { |
| 400 // TODO(ngeoffray): implement finer grain state. | 400 // TODO(ngeoffray): implement finer grain state. |
| 401 inTryCatchOrFinally = true; | 401 inTryCatchOrFinally = true; |
| 402 node.visitChildren(this); | 402 node.visitChildren(this); |
| 403 inTryCatchOrFinally = false; | 403 inTryCatchOrFinally = false; |
| 404 } | 404 } |
| 405 } | 405 } |
| OLD | NEW |