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/names.dart' show |
| 8 Identifiers; |
7 import 'common/tasks.dart' show | 9 import 'common/tasks.dart' show |
8 CompilerTask; | 10 CompilerTask; |
9 import 'compiler.dart' show | 11 import 'compiler.dart' show |
10 Compiler; | 12 Compiler; |
11 import 'constants/expressions.dart'; | 13 import 'constants/expressions.dart'; |
12 import 'dart_types.dart'; | 14 import 'dart_types.dart'; |
13 import 'diagnostics/diagnostic_listener.dart'; | 15 import 'diagnostics/diagnostic_listener.dart'; |
14 import 'diagnostics/spannable.dart' show | 16 import 'diagnostics/spannable.dart' show |
15 SpannableAssertionFailure; | 17 SpannableAssertionFailure; |
16 import 'elements/elements.dart'; | 18 import 'elements/elements.dart'; |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 } | 987 } |
986 | 988 |
987 JavaScriptBackend get backend => compiler.backend; | 989 JavaScriptBackend get backend => compiler.backend; |
988 | 990 |
989 ClosureClassMap globalizeClosure(FunctionExpression node, | 991 ClosureClassMap globalizeClosure(FunctionExpression node, |
990 LocalFunctionElement element) { | 992 LocalFunctionElement element) { |
991 String closureName = computeClosureName(element); | 993 String closureName = computeClosureName(element); |
992 ClosureClassElement globalizedElement = new ClosureClassElement( | 994 ClosureClassElement globalizedElement = new ClosureClassElement( |
993 node, closureName, compiler, element); | 995 node, closureName, compiler, element); |
994 FunctionElement callElement = | 996 FunctionElement callElement = |
995 new SynthesizedCallMethodElementX(Compiler.CALL_OPERATOR_NAME, | 997 new SynthesizedCallMethodElementX(Identifiers.call, |
996 element, | 998 element, |
997 globalizedElement); | 999 globalizedElement); |
998 backend.maybeMarkClosureAsNeededForReflection(globalizedElement, callElement
, element); | 1000 backend.maybeMarkClosureAsNeededForReflection( |
| 1001 globalizedElement, callElement, element); |
999 MemberElement enclosing = element.memberContext; | 1002 MemberElement enclosing = element.memberContext; |
1000 enclosing.nestedClosures.add(callElement); | 1003 enclosing.nestedClosures.add(callElement); |
1001 globalizedElement.addMember(callElement, compiler); | 1004 globalizedElement.addMember(callElement, compiler); |
1002 globalizedElement.computeAllClassMembers(compiler); | 1005 globalizedElement.computeAllClassMembers(compiler); |
1003 // The nested function's 'this' is the same as the one for the outer | 1006 // The nested function's 'this' is the same as the one for the outer |
1004 // function. It could be [null] if we are inside a static method. | 1007 // function. It could be [null] if we are inside a static method. |
1005 ThisLocal thisElement = closureData.thisLocal; | 1008 ThisLocal thisElement = closureData.thisLocal; |
1006 | 1009 |
1007 return new ClosureClassMap(element, globalizedElement, | 1010 return new ClosureClassMap(element, globalizedElement, |
1008 callElement, thisElement); | 1011 callElement, thisElement); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 | 1122 |
1120 String get name => typeVariable.name; | 1123 String get name => typeVariable.name; |
1121 | 1124 |
1122 int get hashCode => typeVariable.hashCode; | 1125 int get hashCode => typeVariable.hashCode; |
1123 | 1126 |
1124 bool operator ==(other) { | 1127 bool operator ==(other) { |
1125 if (other is! TypeVariableLocal) return false; | 1128 if (other is! TypeVariableLocal) return false; |
1126 return typeVariable == other.typeVariable; | 1129 return typeVariable == other.typeVariable; |
1127 } | 1130 } |
1128 } | 1131 } |
OLD | NEW |