Index: pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart |
diff --git a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart |
index 1da1a032e8a139e1038df5c229835bf24c900560..886d3ede86a3d1dc104554205eee72fe65f34e44 100644 |
--- a/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart |
+++ b/pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart |
@@ -140,10 +140,14 @@ class InterceptorStubGenerator { |
if (hasNative) { |
statements.add(js.statement(r'''{ |
- if (typeof receiver != "object") return receiver; |
+ if (typeof receiver != "object") { |
+ if (typeof receiver == "function" ) return #; |
+ return receiver; |
+ } |
if (receiver instanceof #) return receiver; |
return #(receiver); |
}''', [ |
+ interceptorFor(backend.jsJavaScriptFunctionClass), |
backend.emitter.constructorAccess(compiler.objectClass), |
backend.emitter |
.staticFunctionAccess(backend.getNativeInterceptorMethod)])); |