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 3668109ef34cf1720a21eaaf3ebf059d00f71f44..e1a9d20ef94853ce1e9cf681df424da5785ed68f 100644 |
| --- a/pkg/compiler/lib/src/ssa/builder.dart |
| +++ b/pkg/compiler/lib/src/ssa/builder.dart |
| @@ -5134,15 +5134,17 @@ class SsaBuilder extends ast.Visitor |
| stack.add(graph.addConstantNull(compiler)); |
| return; |
| } |
| + |
| if (checkTypeVariableBounds(node, type)) return; |
|
sra1
2015/12/04 00:22:23
TODO (later): in checked mode, does the type varia
|
| - var inputs = <HInstruction>[]; |
| - if (constructor.isGenerativeConstructor && |
| - backend.isNativeOrExtendsNative(constructor.enclosingClass) && |
| - !backend.isJsInterop(constructor)) { |
| - // Native class generative constructors take a pre-constructed object. |
| - inputs.add(graph.addConstantNull(compiler)); |
| + // Abstract class instantiation error takes precedence over argument |
| + // mismatch. |
| + ClassElement cls = constructor.enclosingClass; |
| + if (cls.isAbstract && constructor.isGenerativeConstructor) { |
| + generateAbstractClassInstantiationError(send, cls.name); |
| + return; |
| } |
| + |
| // TODO(5347): Try to avoid the need for calling [implementation] before |
| // calling [makeStaticArgumentList]. |
| constructorImplementation = constructor.implementation; |
| @@ -5152,6 +5154,14 @@ class SsaBuilder extends ast.Visitor |
| generateWrongArgumentCountError(send, constructor, send.arguments); |
| return; |
| } |
| + |
| + var inputs = <HInstruction>[]; |
| + if (constructor.isGenerativeConstructor && |
| + backend.isNativeOrExtendsNative(constructor.enclosingClass) && |
| + !backend.isJsInterop(constructor)) { |
| + // Native class generative constructors take a pre-constructed object. |
| + inputs.add(graph.addConstantNull(compiler)); |
| + } |
| inputs.addAll(makeStaticArgumentList(callStructure, |
| send.arguments, |
| constructorImplementation)); |
| @@ -5198,13 +5208,7 @@ class SsaBuilder extends ast.Visitor |
| } else { |
| SourceInformation sourceInformation = |
| sourceInformationBuilder.buildNew(send); |
| - ClassElement cls = constructor.enclosingClass; |
| - if (cls.isAbstract && constructor.isGenerativeConstructor) { |
| - generateAbstractClassInstantiationError(send, cls.name); |
| - return; |
| - } |
| potentiallyAddTypeArguments(inputs, cls, expectedType); |
| - |
| addInlinedInstantiation(expectedType); |
| pushInvokeStatic(node, constructor, inputs, |
| typeMask: elementType, |