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

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/mirrors/redirecting_factory_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
===================================================================
--- 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 {
« no previous file with comments | « no previous file | tests/lib/mirrors/redirecting_factory_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698