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); | |
1004 FunctionElement callElement = | 1001 FunctionElement callElement = |
1005 new SynthesizedCallMethodElementX(Identifiers.call, | 1002 new SynthesizedCallMethodElementX(Identifiers.call, |
1006 element, | 1003 element, |
1007 globalizedElement); | 1004 globalizedElement); |
1008 backend.maybeMarkClosureAsNeededForReflection( | 1005 backend.maybeMarkClosureAsNeededForReflection( |
1009 globalizedElement, callElement, element); | 1006 globalizedElement, callElement, element); |
1010 MemberElement enclosing = element.memberContext; | 1007 MemberElement enclosing = element.memberContext; |
1011 enclosing.nestedClosures.add(callElement); | 1008 enclosing.nestedClosures.add(callElement); |
1012 globalizedElement.addMember(callElement, reporter); | 1009 globalizedElement.addMember(callElement, reporter); |
1013 globalizedElement.computeAllClassMembers(compiler); | 1010 globalizedElement.computeAllClassMembers(compiler); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 | 1127 |
1131 String get name => typeVariable.name; | 1128 String get name => typeVariable.name; |
1132 | 1129 |
1133 int get hashCode => typeVariable.hashCode; | 1130 int get hashCode => typeVariable.hashCode; |
1134 | 1131 |
1135 bool operator ==(other) { | 1132 bool operator ==(other) { |
1136 if (other is! TypeVariableLocal) return false; | 1133 if (other is! TypeVariableLocal) return false; |
1137 return typeVariable == other.typeVariable; | 1134 return typeVariable == other.typeVariable; |
1138 } | 1135 } |
1139 } | 1136 } |
OLD | NEW |