Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: pkg/compiler/lib/src/js_emitter/interceptor_stub_generator.dart

Issue 1318043005: Support user generated custom native JS classes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: about to land Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)]));

Powered by Google App Engine
This is Rietveld 408576698