Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 263153002: Fix passing of type arguments in redirecting constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/language/regress_18535_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 75e86d8cfa54e52aa09748b7e1d3a3bed75f1b79..954a95f8d7e4842dc9301da529ced66367e82356 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart
@@ -4801,37 +4801,38 @@ class SsaBuilder extends ResolvedVisitor {
}
HInstruction value;
if (node.isRedirectingFactoryBody) {
- FunctionElement element = elements[node.expression].implementation;
- FunctionElement function = sourceElement;
+ FunctionElement targetConstructor =
+ elements[node.expression].implementation;
+ FunctionElement redirectingConstructor = sourceElement;
List<HInstruction> inputs = <HInstruction>[];
- FunctionSignature calleeSignature = element.functionSignature;
- FunctionSignature callerSignature = function.functionSignature;
- callerSignature.forEachRequiredParameter((Element element) {
+ FunctionSignature targetSignature = targetConstructor.functionSignature;
+ FunctionSignature redirectingSignature =
+ redirectingConstructor.functionSignature;
+ redirectingSignature.forEachRequiredParameter((Element element) {
inputs.add(localsHandler.readLocal(element));
});
- List<Element> calleeOptionals =
- calleeSignature.orderedOptionalParameters;
- List<Element> callerOptionals =
- callerSignature.orderedOptionalParameters;
+ List<Element> targetOptionals =
+ targetSignature.orderedOptionalParameters;
+ List<Element> redirectingOptionals =
+ redirectingSignature.orderedOptionalParameters;
int i = 0;
- for (; i < callerOptionals.length; i++) {
- inputs.add(localsHandler.readLocal(callerOptionals[i]));
+ for (; i < redirectingOptionals.length; i++) {
+ inputs.add(localsHandler.readLocal(redirectingOptionals[i]));
}
- for (; i < calleeOptionals.length; i++) {
- inputs.add(handleConstantForOptionalParameter(calleeOptionals[i]));
+ for (; i < targetOptionals.length; i++) {
+ inputs.add(handleConstantForOptionalParameter(targetOptionals[i]));
}
- if (backend.classNeedsRti(element.getEnclosingClass())) {
- ClassElement cls = function.getEnclosingClass();
- Link<DartType> typeVariable = cls.typeVariables;
- InterfaceType type = elements.getType(node.expression);
- type.typeArguments.forEach((DartType argument) {
+ ClassElement targetClass = targetConstructor.getEnclosingClass();
+ if (backend.classNeedsRti(targetClass)) {
+ ClassElement cls = redirectingConstructor.getEnclosingClass();
+ InterfaceType targetType =
+ redirectingConstructor.computeTargetType(cls.thisType);
+ targetType.typeArguments.forEach((DartType argument) {
inputs.add(analyzeTypeArgument(argument));
- typeVariable = typeVariable.tail;
});
- assert(typeVariable.isEmpty);
}
- pushInvokeStatic(node, element, inputs);
+ pushInvokeStatic(node, targetConstructor, inputs);
value = pop();
} else if (node.expression == null) {
value = graph.addConstantNull(compiler);
« no previous file with comments | « no previous file | tests/language/regress_18535_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698