OLD | NEW |
1 library dart2js.unsugar_cps; | 1 library dart2js.unsugar_cps; |
2 | 2 |
3 import '../../cps_ir/cps_ir_nodes.dart'; | 3 import '../../cps_ir/cps_ir_nodes.dart'; |
4 | 4 |
5 import '../../cps_ir/optimizers.dart' show ParentVisitor; | 5 import '../../cps_ir/optimizers.dart' show ParentVisitor; |
6 import '../../constants/values.dart'; | 6 import '../../constants/values.dart'; |
7 import '../../elements/elements.dart'; | 7 import '../../elements/elements.dart'; |
8 import '../../io/source_information.dart'; | 8 import '../../io/source_information.dart'; |
9 import '../../js_backend/codegen/glue.dart'; | 9 import '../../js_backend/codegen/glue.dart'; |
10 import '../../universe/universe.dart' show Selector; | 10 import '../../universe/selector.dart' show Selector; |
11 import '../../cps_ir/cps_ir_builder.dart' show ThisParameterLocal; | 11 import '../../cps_ir/cps_ir_builder.dart' show ThisParameterLocal; |
12 | 12 |
13 class ExplicitReceiverParameterEntity implements Local { | 13 class ExplicitReceiverParameterEntity implements Local { |
14 String get name => 'receiver'; | 14 String get name => 'receiver'; |
15 final ExecutableElement executableContext; | 15 final ExecutableElement executableContext; |
16 ExplicitReceiverParameterEntity(this.executableContext); | 16 ExplicitReceiverParameterEntity(this.executableContext); |
17 toString() => 'ExplicitReceiverParameterEntity($executableContext)'; | 17 toString() => 'ExplicitReceiverParameterEntity($executableContext)'; |
18 } | 18 } |
19 | 19 |
20 /// Suggested name for an interceptor. | 20 /// Suggested name for an interceptor. |
(...skipping 24 matching lines...) Expand all Loading... |
45 // In a catch block, rethrow implicitly throws the block's exception | 45 // In a catch block, rethrow implicitly throws the block's exception |
46 // parameter. This is the exception parameter when nested in a catch | 46 // parameter. This is the exception parameter when nested in a catch |
47 // block and null otherwise. | 47 // block and null otherwise. |
48 Parameter _exceptionParameter = null; | 48 Parameter _exceptionParameter = null; |
49 | 49 |
50 UnsugarVisitor(this._glue); | 50 UnsugarVisitor(this._glue); |
51 | 51 |
52 bool methodUsesReceiverArgument(FunctionElement function) { | 52 bool methodUsesReceiverArgument(FunctionElement function) { |
53 assert(_glue.isInterceptedMethod(function)); | 53 assert(_glue.isInterceptedMethod(function)); |
54 ClassElement clazz = function.enclosingClass.declaration; | 54 ClassElement clazz = function.enclosingClass.declaration; |
55 return _glue.isInterceptorClass(clazz) || | 55 return _glue.isInterceptorClass(clazz) || |
56 _glue.isUsedAsMixin(clazz); | 56 _glue.isUsedAsMixin(clazz); |
57 } | 57 } |
58 | 58 |
59 void rewrite(FunctionDefinition function) { | 59 void rewrite(FunctionDefinition function) { |
60 thisParameter = function.thisParameter; | 60 thisParameter = function.thisParameter; |
61 bool inInterceptedMethod = _glue.isInterceptedMethod(function.element); | 61 bool inInterceptedMethod = _glue.isInterceptedMethod(function.element); |
62 | 62 |
63 if (function.element.name == '==' && | 63 if (function.element.name == '==' && |
64 function.parameters.length == 1 && | 64 function.parameters.length == 1 && |
65 !_glue.operatorEqHandlesNullArgument(function.element)) { | 65 !_glue.operatorEqHandlesNullArgument(function.element)) { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 insertLetPrim(newReceiver, contBinding); | 275 insertLetPrim(newReceiver, contBinding); |
276 } | 276 } |
277 node.arguments.insert(0, node.receiver); | 277 node.arguments.insert(0, node.receiver); |
278 node.receiver = new Reference<Primitive>(newReceiver); | 278 node.receiver = new Reference<Primitive>(newReceiver); |
279 } | 279 } |
280 | 280 |
281 processInterceptor(Interceptor node) { | 281 processInterceptor(Interceptor node) { |
282 _glue.registerSpecializedGetInterceptor(node.interceptedClasses); | 282 _glue.registerSpecializedGetInterceptor(node.interceptedClasses); |
283 } | 283 } |
284 } | 284 } |
OLD | NEW |