Index: pkg/compiler/lib/src/js_emitter/native_emitter.dart |
diff --git a/pkg/compiler/lib/src/js_emitter/native_emitter.dart b/pkg/compiler/lib/src/js_emitter/native_emitter.dart |
index 0d90d2f7908ac69aded0268405d0e6fb0c8d99c0..69939a5e368cae66a09d88d90323a4e052cfd9c6 100644 |
--- a/pkg/compiler/lib/src/js_emitter/native_emitter.dart |
+++ b/pkg/compiler/lib/src/js_emitter/native_emitter.dart |
@@ -134,8 +134,9 @@ class NativeEmitter { |
} else if (extensionPoints.containsKey(cls)) { |
needed = true; |
} |
- if (cls.isNative && |
- native.nativeTagsForcedNonLeaf(classElement)) { |
+ if (classElement.isJsInterop) { |
+ needed = true; // TODO(jacobr): we don't need all interop classes. |
Siggi Cherem (dart-lang)
2015/09/18 20:34:10
what are your thoughts on determining what is need
Jacob
2015/10/01 00:47:33
types allocated from Dart isn't adequate
types ret
|
+ } else if (cls.isNative && native.nativeTagsForcedNonLeaf(classElement)) { |
needed = true; |
nonLeafClasses.add(cls); |
} |
@@ -154,6 +155,7 @@ class NativeEmitter { |
for (Class cls in classes) { |
if (!cls.isNative) continue; |
+ if (cls.element.isJsInterop) continue; |
List<String> nativeTags = native.nativeTagsOfClass(cls.element); |
if (nonLeafClasses.contains(cls) || |
@@ -294,7 +296,7 @@ class NativeEmitter { |
// The target JS function may check arguments.length so we need to |
// make sure not to pass any unspecified optional arguments to it. |
// For example, for the following Dart method: |
- // foo([x, y, z]); |
+ // foo({x, y, z}); |
// The call: |
// foo(y: 1) |
// must be turned into a JS call to: |
@@ -319,9 +321,17 @@ class NativeEmitter { |
} else { |
// Native methods that are not intercepted must be static. |
assert(invariant(member, member.isStatic)); |
- receiver = js('this'); |
arguments = argumentsBuffer.sublist(0, |
indexOfLastOptionalArgumentInParameters + 1); |
+ if (member.isJsInterop) { |
+ // target is allowed to have the form foo.bar.baz for interop. |
+ // TODO(jacobr): replace js(target) with a version that doesn't cache. |
+ statements.add( |
+ js.statement('return #(#)', [js(target), arguments])); |
Siggi Cherem (dart-lang)
2015/09/18 20:34:10
style nit: might be nice to keep the statements.ad
Jacob
2015/10/01 00:47:33
yeah this code was ugly. done.
|
+ return statements; |
+ } else { |
+ receiver = js('this'); |
+ } |
} |
statements.add( |
js.statement('return #.#(#)', [receiver, target, arguments])); |