| 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("closureToClassMapper"); |
| 6 | 6 |
| 7 #import("elements/elements.dart"); | 7 #import("elements/elements.dart"); |
| 8 #import("leg.dart"); | 8 #import("leg.dart"); |
| 9 #import("scanner/scannerlib.dart"); | 9 #import("scanner/scannerlib.dart"); |
| 10 #import("tree/tree.dart"); | 10 #import("tree/tree.dart"); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 } | 396 } |
| 397 scopeData.boxedLoopVariables = result; | 397 scopeData.boxedLoopVariables = result; |
| 398 } | 398 } |
| 399 | 399 |
| 400 ClosureClassMap globalizeClosure(FunctionExpression node, Element element) { | 400 ClosureClassMap globalizeClosure(FunctionExpression node, Element element) { |
| 401 SourceString closureName = | 401 SourceString closureName = |
| 402 new SourceString(compiler.namer.closureName(element)); | 402 new SourceString(compiler.namer.closureName(element)); |
| 403 ClassElement globalizedElement = new ClosureClassElement( | 403 ClassElement globalizedElement = new ClosureClassElement( |
| 404 closureName, compiler, element.getCompilationUnit()); | 404 closureName, compiler, element.getCompilationUnit()); |
| 405 FunctionElement callElement = | 405 FunctionElement callElement = |
| 406 new FunctionElement.from(compiler.namer.CLOSURE_INVOCATION_NAME, | 406 new FunctionElement.from(Namer.CLOSURE_INVOCATION_NAME, |
| 407 element, | 407 element, |
| 408 globalizedElement); | 408 globalizedElement); |
| 409 globalizedElement.backendMembers = | 409 globalizedElement.backendMembers = |
| 410 const EmptyLink<Element>().prepend(callElement); | 410 const EmptyLink<Element>().prepend(callElement); |
| 411 // The nested function's 'this' is the same as the one for the outer | 411 // The nested function's 'this' is the same as the one for the outer |
| 412 // function. It could be [null] if we are inside a static method. | 412 // function. It could be [null] if we are inside a static method. |
| 413 Element thisElement = closureData.thisElement; | 413 Element thisElement = closureData.thisElement; |
| 414 return new ClosureClassMap(element, globalizedElement, | 414 return new ClosureClassMap(element, globalizedElement, |
| 415 callElement, thisElement); | 415 callElement, thisElement); |
| 416 } | 416 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } | 505 } |
| 506 | 506 |
| 507 visitTryStatement(TryStatement node) { | 507 visitTryStatement(TryStatement node) { |
| 508 // TODO(ngeoffray): implement finer grain state. | 508 // TODO(ngeoffray): implement finer grain state. |
| 509 bool oldInTryStatement = inTryStatement; | 509 bool oldInTryStatement = inTryStatement; |
| 510 inTryStatement = true; | 510 inTryStatement = true; |
| 511 node.visitChildren(this); | 511 node.visitChildren(this); |
| 512 inTryStatement = oldInTryStatement; | 512 inTryStatement = oldInTryStatement; |
| 513 } | 513 } |
| 514 } | 514 } |
| OLD | NEW |