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 58904818d0e55005fe7d326daa411b915fa5e338..bf8dc353d7f5991be100a95ea29de0f1b55c6286 100644 |
| --- a/pkg/compiler/lib/src/ssa/builder.dart |
| +++ b/pkg/compiler/lib/src/ssa/builder.dart |
| @@ -5631,7 +5631,7 @@ class SsaBuilder extends NewResolvedVisitor { |
| listInputs.add(pop()); |
| } |
| - ConstructorElement constructor; |
| + Element constructor; |
| List<HInstruction> inputs = <HInstruction>[]; |
| if (listInputs.isEmpty) { |
| @@ -5656,12 +5656,27 @@ class SsaBuilder extends NewResolvedVisitor { |
| ClassElement cls = constructor.enclosingClass; |
| if (backend.classNeedsRti(cls)) { |
| + List<HInstruction> typeInputs = <HInstruction>[]; |
| List<DartType> typeVariable = cls.typeVariables; |
| expectedType.typeArguments.forEach((DartType argument) { |
| - inputs.add(analyzeTypeArgument(argument)); |
| + typeInputs.add(analyzeTypeArgument(argument)); |
| }); |
| + if (typeInputs.every((HInstruction input) => input.isNull())) { |
|
herhut
2015/04/14 11:00:14
Can you add a comment about what this is doing, i.
zarah
2015/04/14 11:27:56
Done.
|
| + if (listInputs.isEmpty) { |
| + constructor = backend.mapLiteralUntypedEmptyMaker; |
| + } else { |
| + constructor = backend.mapLiteralUntypedMaker; |
| + } |
| + } else { |
| + inputs.addAll(typeInputs); |
| + } |
| } |
| + // If rti is needed and the map literal has no type parameters, |
| + // 'constructor' is a static function that forwards the call to the factory |
| + // constructor without type parameters. |
| + assert(constructor is ConstructorElement || constructor is FunctionElement); |
| + |
| // The instruction type will always be a subtype of the mapLiteralClass, but |
| // type inference might discover a more specific type, or find nothing (in |
| // dart2js unit tests). |