Chromium Code Reviews| 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..c2d3f3665c4c7982422e261ca86d3e1b561fe67f 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. |
| + } 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,15 @@ 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) { |
| + // fixedBackendReceiver is allowed to have the form foo.bar.baz for |
| + // interop. |
| + receiver = js(member.fixedBackendReceiver); |
|
sra1
2015/10/01 20:55:28
Use uncached version.
Jacob
2015/10/02 20:08:15
Done.
|
| + } else { |
| + receiver = js('this'); |
| + } |
| } |
| statements.add( |
| js.statement('return #.#(#)', [receiver, target, arguments])); |