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 'constants/expressions.dart'; | 7 import 'constants/expressions.dart'; |
8 import 'dart2jslib.dart'; | 8 import 'dart2jslib.dart'; |
9 import 'dart_types.dart'; | 9 import 'dart_types.dart'; |
10 import 'elements/elements.dart'; | 10 import 'elements/elements.dart'; |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 variable.executableContext == executableContext; | 644 variable.executableContext == executableContext; |
645 } | 645 } |
646 | 646 |
647 if (insideClosure && !inCurrentContext(variable)) { | 647 if (insideClosure && !inCurrentContext(variable)) { |
648 closureData.addFreeVariable(variable); | 648 closureData.addFreeVariable(variable); |
649 } else if (inTryStatement) { | 649 } else if (inTryStatement) { |
650 // Don't mark the this-element or a self-reference. This would complicate | 650 // Don't mark the this-element or a self-reference. This would complicate |
651 // things in the builder. | 651 // things in the builder. |
652 // Note that nested (named) functions are immutable. | 652 // Note that nested (named) functions are immutable. |
653 if (variable != closureData.thisLocal && | 653 if (variable != closureData.thisLocal && |
654 variable != closureData.closureElement) { | 654 variable != closureData.closureElement && |
| 655 variable is! TypeVariableLocal) { |
655 closureData.variablesUsedInTryOrGenerator.add(variable); | 656 closureData.variablesUsedInTryOrGenerator.add(variable); |
656 } | 657 } |
657 } else if (variable is LocalParameterElement && | 658 } else if (variable is LocalParameterElement && |
658 variable.functionDeclaration.asyncMarker == AsyncMarker.SYNC_STAR) { | 659 variable.functionDeclaration.asyncMarker == AsyncMarker.SYNC_STAR) { |
659 // Parameters in a sync* function are shared between each Iterator created | 660 // Parameters in a sync* function are shared between each Iterator created |
660 // by the Iterable returned by the function, therefore they must be boxed. | 661 // by the Iterable returned by the function, therefore they must be boxed. |
661 closureData.variablesUsedInTryOrGenerator.add(variable); | 662 closureData.variablesUsedInTryOrGenerator.add(variable); |
662 } | 663 } |
663 } | 664 } |
664 | 665 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1111 | 1112 |
1112 String get name => typeVariable.name; | 1113 String get name => typeVariable.name; |
1113 | 1114 |
1114 int get hashCode => typeVariable.hashCode; | 1115 int get hashCode => typeVariable.hashCode; |
1115 | 1116 |
1116 bool operator ==(other) { | 1117 bool operator ==(other) { |
1117 if (other is! TypeVariableLocal) return false; | 1118 if (other is! TypeVariableLocal) return false; |
1118 return typeVariable == other.typeVariable; | 1119 return typeVariable == other.typeVariable; |
1119 } | 1120 } |
1120 } | 1121 } |
OLD | NEW |