| 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 "dart2jslib.dart"; | 8 import "dart2jslib.dart"; |
| 9 import "dart_types.dart"; | 9 import "dart_types.dart"; |
| 10 import "scanner/scannerlib.dart" show Token; | 10 import "scanner/scannerlib.dart" show Token; |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 useLocal(type.element); | 440 useLocal(type.element); |
| 441 } else if (type is InterfaceType) { | 441 } else if (type is InterfaceType) { |
| 442 InterfaceType ifcType = type; | 442 InterfaceType ifcType = type; |
| 443 for (DartType argument in ifcType.typeArguments) { | 443 for (DartType argument in ifcType.typeArguments) { |
| 444 analyzeTypeVariables(argument); | 444 analyzeTypeVariables(argument); |
| 445 } | 445 } |
| 446 } | 446 } |
| 447 } | 447 } |
| 448 if (outermostElement.isMember() && | 448 if (outermostElement.isMember() && |
| 449 compiler.world.needsRti(outermostElement.getEnclosingClass())) { | 449 compiler.world.needsRti(outermostElement.getEnclosingClass())) { |
| 450 if (outermostElement.isInstanceMember() | 450 if (outermostElement.isConstructor()) { |
| 451 || outermostElement.isGenerativeConstructor()) { | 451 analyzeTypeVariables(type); |
| 452 } else if (outermostElement.isInstanceMember()) { |
| 452 if (hasTypeVariable(type)) useLocal(closureData.thisElement); | 453 if (hasTypeVariable(type)) useLocal(closureData.thisElement); |
| 453 } else if (outermostElement.isFactoryConstructor()) { | |
| 454 analyzeTypeVariables(type); | |
| 455 } | 454 } |
| 456 } | 455 } |
| 457 | 456 |
| 458 node.visitChildren(this); | 457 node.visitChildren(this); |
| 459 } | 458 } |
| 460 | 459 |
| 461 // If variables that are declared in the [node] scope are captured and need | 460 // If variables that are declared in the [node] scope are captured and need |
| 462 // to be boxed create a box-element and update the [capturingScopes] in the | 461 // to be boxed create a box-element and update the [capturingScopes] in the |
| 463 // current [closureData]. | 462 // current [closureData]. |
| 464 // The boxed variables are updated in the [capturedVariableMapping]. | 463 // The boxed variables are updated in the [capturedVariableMapping]. |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 } | 669 } |
| 671 | 670 |
| 672 visitTryStatement(TryStatement node) { | 671 visitTryStatement(TryStatement node) { |
| 673 // TODO(ngeoffray): implement finer grain state. | 672 // TODO(ngeoffray): implement finer grain state. |
| 674 bool oldInTryStatement = inTryStatement; | 673 bool oldInTryStatement = inTryStatement; |
| 675 inTryStatement = true; | 674 inTryStatement = true; |
| 676 node.visitChildren(this); | 675 node.visitChildren(this); |
| 677 inTryStatement = oldInTryStatement; | 676 inTryStatement = oldInTryStatement; |
| 678 } | 677 } |
| 679 } | 678 } |
| OLD | NEW |