Chromium Code Reviews| Index: pkg/compiler/lib/src/ssa/builder.dart |
| diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart |
| index 0945568cfec8ca52f74c4eecf1ca669123a40266..223b688f4a6188de72069acef609c458f8fb22f3 100644 |
| --- a/pkg/compiler/lib/src/ssa/builder.dart |
| +++ b/pkg/compiler/lib/src/ssa/builder.dart |
| @@ -5864,7 +5864,7 @@ class SsaBuilder extends ast.Visitor |
| && params.optionalParametersAreNamed; |
| } |
| - HForeignCode invokeJsInteropFunction(Element element, |
| + HForeignCode invokeJsInteropFunction(FunctionElement element, |
| List<HInstruction> arguments, |
| SourceInformation sourceInformation) { |
| assert(backend.isJsInterop(element)); |
| @@ -5918,13 +5918,13 @@ class SsaBuilder extends ast.Visitor |
| var inputs = <HInstruction>[target]..addAll(arguments); |
| js.Template codeTemplate; |
| + DartType type = element.type.returnType; |
| if (element.isGetter) { |
| codeTemplate = js.js.parseForeignJS("#"); |
| } else if (element.isSetter) { |
| codeTemplate = js.js.parseForeignJS("# = #"); |
| } else { |
| - FunctionElement function = element; |
| - FunctionSignature params = function.functionSignature; |
| + FunctionSignature params = element.functionSignature; |
| var argsStub = <String>[]; |
| for (int i = 0; i < arguments.length; i++) { |
| @@ -5933,17 +5933,22 @@ class SsaBuilder extends ast.Visitor |
| if (element.isConstructor) { |
| codeTemplate = js.js.parseForeignJS("new #(${argsStub.join(",")})"); |
| + type = element.enclosingClass.thisType; |
| } else { |
| codeTemplate = js.js.parseForeignJS("#(${argsStub.join(",")})"); |
| } |
| } |
| + // Note: here we are trusting the declared type by default to keep the |
| + // codegen behavior consistent with the resolution behavior. Currently the |
| + // NativeResolutionEnqueuer will trust the types by default (since this is |
| + // what we always did for native APIs in dart:html). We could change both to |
| + // be more conservative, but that could bring in a lot more code than what |
| + // we want. |
|
Jacob
2015/11/20 00:50:34
I thought in resolution we were treating each of t
Siggi Cherem (dart-lang)
2015/11/20 01:06:17
Good question - we have been debating about this t
Siggi Cherem (dart-lang)
2015/11/20 01:56:15
I made a CL with the alternative approach, I'm sti
|
| var nativeBehavior = new native.NativeBehavior() |
| ..codeTemplate = codeTemplate |
| - ..typesReturned.add( |
| - helpers.jsJavaScriptObjectClass.thisType) |
| - ..typesInstantiated.add( |
| - helpers.jsJavaScriptObjectClass.thisType) |
| + ..typesReturned.add(type) |
| + ..typesInstantiated.add(type) |
| ..sideEffects.setAllSideEffects(); |
| return new HForeignCode( |
| codeTemplate, |