Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
=================================================================== |
--- sdk/lib/_internal/compiler/implementation/ssa/builder.dart (revision 15149) |
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy) |
@@ -2454,13 +2454,6 @@ |
// interceptor. |
instruction.inputs.add(receiver); |
pushWithPosition(instruction, send); |
- } else if (elements[send] == null && interceptor != null) { |
- // Use the old, deprecated interceptor mechanism. |
- HStatic target = new HStatic(interceptor); |
- add(target); |
- List<HInstruction> inputs = <HInstruction>[target, receiver]; |
- pushWithPosition(new HInvokeInterceptor(selector, inputs, !hasGetter), |
- send); |
} else { |
pushWithPosition( |
new HInvokeDynamicGetter(selector, null, receiver, !hasGetter), send); |
@@ -2516,13 +2509,25 @@ |
Element interceptor = getInterceptor(send, selector); |
bool hasSetter = compiler.world.hasAnyUserDefinedSetter(selector); |
if (interceptor != null && interceptor == backend.getInterceptorMethod) { |
- compiler.internalError( |
- 'Unimplemented intercepted setter call with interceptor classes'); |
- } else if (interceptor != null && elements[send] == null) { |
- HStatic target = new HStatic(interceptor); |
- add(target); |
- List<HInstruction> inputs = <HInstruction>[target, receiver, value]; |
- addWithPosition(new HInvokeInterceptor(selector, inputs), send); |
+ // If we're using an interceptor class, emit a call to the |
+ // interceptor method and then the actual dynamic call on the |
+ // interceptor object. |
+ HInstruction instruction; |
+ if (backend.isInterceptorClass(currentElement.getEnclosingClass()) |
+ && send.receiver == null) { |
+ instruction = thisInstruction; |
+ } else { |
+ HStatic target = new HStatic(interceptor); |
+ add(target); |
+ instruction = new HInvokeStatic(<HInstruction>[target, receiver]); |
+ add(instruction); |
+ } |
+ instruction = new HInvokeDynamicSetter( |
+ selector, null, instruction, receiver, !hasSetter); |
+ // Add the value as an argument to the setter call on the |
+ // interceptor. |
+ instruction.inputs.add(value); |
+ addWithPosition(instruction, send); |
} else { |
addWithPosition( |
new HInvokeDynamicSetter(selector, null, receiver, value, !hasSetter), |
@@ -2808,15 +2813,6 @@ |
HInstruction instruction = new HInvokeDynamicMethod(selector, inputs); |
pushWithPosition(instruction, node); |
return; |
- } else if (elements[node] == null) { |
- HStatic target = new HStatic(interceptor); |
- add(target); |
- inputs.add(target); |
- visit(node.receiver); |
- inputs.add(pop()); |
- addGenericSendArgumentsToList(node.arguments, inputs); |
- pushWithPosition(new HInvokeInterceptor(selector, inputs), node); |
- return; |
} |
} |