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

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

Issue 23450040: Implement redirecting factories in mirrors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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/lib/lib.status » ('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
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/builder.dart (revision 27560)
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy)
@@ -3571,12 +3571,7 @@
inputs.add(analyzeTypeArgument(argument));
typeVariable = typeVariable.tail;
});
- // Also add null to non-provided type variables to call the
- // constructor with the right number of arguments.
- while (!typeVariable.isEmpty) {
- inputs.add(graph.addConstantNull(compiler));
- typeVariable = typeVariable.tail;
- }
+ assert(typeVariable.isEmpty);
}
if (constructor.isFactoryConstructor() && !type.typeArguments.isEmpty) {
@@ -4187,8 +4182,38 @@
}
HInstruction value;
if (node.isRedirectingFactoryBody) {
- // TODO(ahe): This is only for reflection, and it is not correct yet.
- value = graph.addConstantNull(compiler);
+ FunctionElement element = elements[node.expression];
+ FunctionElement function = currentElement;
+ List<HInstruction> inputs = <HInstruction>[];
+ FunctionSignature calleeSignature = element.functionSignature;
+ FunctionSignature callerSignature = function.functionSignature;
+ callerSignature.forEachRequiredParameter((Element element) {
+ inputs.add(localsHandler.readLocal(element));
+ });
+ List<Element> calleeOptionals =
+ calleeSignature.orderedOptionalParameters;
+ List<Element> callerOptionals =
+ callerSignature.orderedOptionalParameters;
+ int i = 0;
+ for (; i < callerOptionals.length; i++) {
+ inputs.add(localsHandler.readLocal(callerOptionals[i]));
+ }
+ for (; i < calleeOptionals.length; i++) {
+ inputs.add(handleConstantForOptionalParameter(calleeOptionals[i]));
+ }
+
+ if (backend.classNeedsRti(element.getEnclosingClass())) {
+ ClassElement cls = function.getEnclosingClass();
+ Link<DartType> typeVariable = cls.typeVariables;
+ DartType type = elements.getType(node.expression);
+ type.typeArguments.forEach((DartType argument) {
+ inputs.add(analyzeTypeArgument(argument));
+ typeVariable = typeVariable.tail;
+ });
+ assert(typeVariable.isEmpty);
+ }
+ pushInvokeStatic(node, element, inputs);
+ value = pop();
} else if (node.expression == null) {
value = graph.addConstantNull(compiler);
} else {
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698