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 'common.dart'; | 7 import 'common.dart'; |
8 import 'common/names.dart' show | 8 import 'common/names.dart' show |
9 Identifiers; | 9 Identifiers; |
10 import 'common/resolution.dart' show | 10 import 'common/resolution.dart' show |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 return sb.toString(); | 991 return sb.toString(); |
992 } | 992 } |
993 | 993 |
994 JavaScriptBackend get backend => compiler.backend; | 994 JavaScriptBackend get backend => compiler.backend; |
995 | 995 |
996 ClosureClassMap globalizeClosure(FunctionExpression node, | 996 ClosureClassMap globalizeClosure(FunctionExpression node, |
997 LocalFunctionElement element) { | 997 LocalFunctionElement element) { |
998 String closureName = computeClosureName(element); | 998 String closureName = computeClosureName(element); |
999 ClosureClassElement globalizedElement = new ClosureClassElement( | 999 ClosureClassElement globalizedElement = new ClosureClassElement( |
1000 node, closureName, compiler, element); | 1000 node, closureName, compiler, element); |
| 1001 // Extend [globalizedElement] as an instantiated class in the closed world. |
| 1002 compiler.world.registerClass( |
| 1003 globalizedElement, isDirectlyInstantiated: true); |
1001 FunctionElement callElement = | 1004 FunctionElement callElement = |
1002 new SynthesizedCallMethodElementX(Identifiers.call, | 1005 new SynthesizedCallMethodElementX(Identifiers.call, |
1003 element, | 1006 element, |
1004 globalizedElement); | 1007 globalizedElement); |
1005 backend.maybeMarkClosureAsNeededForReflection( | 1008 backend.maybeMarkClosureAsNeededForReflection( |
1006 globalizedElement, callElement, element); | 1009 globalizedElement, callElement, element); |
1007 MemberElement enclosing = element.memberContext; | 1010 MemberElement enclosing = element.memberContext; |
1008 enclosing.nestedClosures.add(callElement); | 1011 enclosing.nestedClosures.add(callElement); |
1009 globalizedElement.addMember(callElement, reporter); | 1012 globalizedElement.addMember(callElement, reporter); |
1010 globalizedElement.computeAllClassMembers(compiler); | 1013 globalizedElement.computeAllClassMembers(compiler); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 | 1130 |
1128 String get name => typeVariable.name; | 1131 String get name => typeVariable.name; |
1129 | 1132 |
1130 int get hashCode => typeVariable.hashCode; | 1133 int get hashCode => typeVariable.hashCode; |
1131 | 1134 |
1132 bool operator ==(other) { | 1135 bool operator ==(other) { |
1133 if (other is! TypeVariableLocal) return false; | 1136 if (other is! TypeVariableLocal) return false; |
1134 return typeVariable == other.typeVariable; | 1137 return typeVariable == other.typeVariable; |
1135 } | 1138 } |
1136 } | 1139 } |
OLD | NEW |