Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
| =================================================================== |
| --- sdk/lib/_internal/compiler/implementation/ssa/builder.dart (revision 27512) |
| +++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy) |
| @@ -4183,8 +4183,34 @@ |
| } |
| HInstruction value; |
| if (node.isRedirectingFactoryBody) { |
|
karlklose
2013/09/17 09:12:51
Please add a TODO for me that this implementation
ngeoffray
2013/09/17 12:02:24
I've implemented it instead.
|
| - // 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(); |
| + cls.typeVariables.forEach((TypeVariableType typeVariable) { |
| + inputs.add(localsHandler.readLocal(typeVariable.element)); |
| + }); |
| + } |
| + pushInvokeStatic(node, element, inputs); |
| + value = pop(); |
| } else if (node.expression == null) { |
| value = graph.addConstantNull(compiler); |
| } else { |