Index: pkg/compiler/lib/src/js_backend/codegen/unsugar.dart |
diff --git a/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart b/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart |
index 0bcc9df4e7306a36a7030bf8a3cf8678404b6d31..56073c35e04e4af69dcccfe8495e7a6b04d81ddf 100644 |
--- a/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart |
+++ b/pkg/compiler/lib/src/js_backend/codegen/unsugar.dart |
@@ -43,8 +43,6 @@ class UnsugarVisitor extends RecursiveVisitor { |
Parameter thisParameter; |
Parameter explicitReceiverParameter; |
- Map<Primitive, Interceptor> interceptors = <Primitive, Interceptor>{}; |
- |
// In a catch block, rethrow implicitly throws the block's exception |
// parameter. This is the exception parameter when nested in a catch |
// block and null otherwise. |
@@ -226,34 +224,6 @@ class UnsugarVisitor extends RecursiveVisitor { |
// worry about unlinking. |
} |
- /// Returns an interceptor for the given value, capable of responding to |
- /// [selector]. |
- /// |
- /// A single getInterceptor call will be created per primitive, bound |
- /// immediately after the primitive is bound. |
- /// |
- /// The type propagation pass will later narrow the set of interceptors |
- /// based on the input type, and the let sinking pass will propagate the |
- /// getInterceptor call closer to its use when this is profitable. |
- Interceptor getInterceptorFor(Primitive prim, Selector selector, |
- SourceInformation sourceInformation) { |
- assert(prim is! Interceptor); |
- Interceptor interceptor = interceptors[prim]; |
- if (interceptor == null) { |
- interceptor = new Interceptor(prim, sourceInformation); |
- interceptors[prim] = interceptor; |
- InteriorNode parent = prim.parent; |
- insertLetPrim(interceptor, parent.body); |
- if (prim.hint != null) { |
- interceptor.hint = new InterceptorEntity(prim.hint); |
- } |
- } |
- // Add the interceptor classes that can respond to the given selector. |
- interceptor.interceptedClasses.addAll( |
- _glue.getInterceptedClassesOn(selector)); |
- return interceptor; |
- } |
- |
processInvokeMethod(InvokeMethod node) { |
Selector selector = node.selector; |
if (!_glue.isInterceptedSelector(selector)) return; |
@@ -267,8 +237,13 @@ class UnsugarVisitor extends RecursiveVisitor { |
// Change 'receiver.foo()' to 'this.foo(receiver)'. |
newReceiver = thisParameter; |
} else { |
- newReceiver = getInterceptorFor( |
- receiver, node.selector, node.sourceInformation); |
+ LetCont contBinding = node.parent; |
+ newReceiver = new Interceptor(receiver, node.sourceInformation) |
+ ..interceptedClasses.addAll(_glue.getInterceptedClassesOn(selector)); |
+ if (receiver.hint != null) { |
+ newReceiver.hint = new InterceptorEntity(receiver.hint); |
+ } |
+ insertLetPrim(newReceiver, contBinding); |
} |
node.arguments.insert(0, node.receiver); |