Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| index 91b0977e722bdb92b70739138ee4b321fb4c70bb..64b12f499cc29cccdbc5048ee929075209210ed6 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| @@ -1616,9 +1616,31 @@ class SsaBuilder extends ResolvedVisitor { |
| */ |
| void potentiallyCheckInlinedParameterTypes(FunctionElement function) { |
|
floitsch
2014/04/23 17:43:34
Should we bail out immediately if checked mode is
Johnni Winther
2014/04/24 08:32:28
Done.
|
| FunctionSignature signature = function.functionSignature; |
| + |
| + InterfaceType contextType; |
| + if (function.isSynthesized && function.isGenerativeConstructor()) { |
| + // Synthesized constructors reuse the parameters from the |
| + // [targetConstructor]. In face of generic types, the type variables |
| + // occurring in the parameter types must be substituted by the type |
| + // arguments of the enclosing class. |
| + FunctionElement target = function; |
| + while (target.targetConstructor != null) { |
| + target = target.targetConstructor; |
| + } |
| + if (target != function) { |
| + ClassElement functionClass = function.getEnclosingClass(); |
| + ClassElement targetClass = target.getEnclosingClass(); |
| + contextType = functionClass.thisType.asInstanceOf(targetClass); |
| + } |
| + } |
| + |
| signature.orderedForEachParameter((ParameterElement parameter) { |
| HInstruction argument = localsHandler.readLocal(parameter); |
| - potentiallyCheckType(argument, parameter.type); |
| + DartType parameterType = parameter.type; |
| + if (contextType != null) { |
| + parameterType = parameterType.substByContext(contextType); |
| + } |
| + potentiallyCheckType(argument, parameterType); |
| }); |
| } |