Chromium Code Reviews| Index: pkg/compiler/lib/src/native/behavior.dart |
| diff --git a/pkg/compiler/lib/src/native/behavior.dart b/pkg/compiler/lib/src/native/behavior.dart |
| index 7dbab30fe5e6f1e7f29b4a3b0715474e6abca661..3bee9aa5245e08835f64d8159ee189d09b5c6d9f 100644 |
| --- a/pkg/compiler/lib/src/native/behavior.dart |
| +++ b/pkg/compiler/lib/src/native/behavior.dart |
| @@ -646,6 +646,17 @@ class NativeBehavior { |
| FunctionType type = method.computeType(compiler.resolution); |
| var behavior = new NativeBehavior(); |
| behavior.typesReturned.add(type.returnType); |
| + JavaScriptBackend backend = compiler.backend; |
| + // Note: For dart:html and other internal libraries, we trust the return |
| + // type and use it to limit what we enqueue. We are more conservative about |
| + // JS interop types and assume any other JS interop type can be returned |
| + // from an interop call or getter. |
| + if (backend.isJsInterop(method)) { |
| + behavior.typesReturned.add( |
| + backend.helpers.jsJavaScriptObjectClass.thisType); |
|
sra1
2015/11/20 19:06:24
It does seem crazy to do this for 'int'.
Perhaps
Siggi Cherem (dart-lang)
2015/11/25 21:15:25
Agree - I can't do anything for int to be sound, b
|
| + behavior.typesInstantiated.add( |
| + backend.helpers.jsJavaScriptObjectClass.thisType); |
| + } |
| if (!type.returnType.isVoid) { |
| // Declared types are nullable. |
| behavior.typesReturned.add(compiler.coreTypes.nullType); |
| @@ -669,6 +680,14 @@ class NativeBehavior { |
| DartType type = field.computeType(resolution); |
| var behavior = new NativeBehavior(); |
| behavior.typesReturned.add(type); |
| + JavaScriptBackend backend = compiler.backend; |
| + // See comment above on ofMethod |
| + if (backend.isJsInterop(field)) { |
| + behavior.typesReturned.add( |
| + backend.helpers.jsJavaScriptObjectClass.thisType); |
| + behavior.typesInstantiated.add( |
| + backend.helpers.jsJavaScriptObjectClass.thisType); |
| + } |
| // Declared types are nullable. |
| behavior.typesReturned.add(resolution.coreTypes.nullType); |
| behavior._capture(type, resolution); |