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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 890663004: Move matching of arguments/selector against signature out of buildStaticInvoke. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index f930b904228b355f43d9d46b2c0e0a86aba4ac5a..b2eb4926792c473c146999b899094cee18cb02d5 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -166,6 +166,7 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
return buildConstant(glue.getConstantForVariable(parameter).value);
}
+ // TODO(karlklose): get rid of the selector argument.
js.Expression buildStaticInvoke(Selector selector,
Element target,
List<js.Expression> arguments) {
@@ -182,21 +183,29 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
return js.propertyCall(interceptorLibrary, selector.name, arguments);
} else {
js.Expression elementAccess = glue.staticFunctionAccess(target);
- List<js.Expression> compiledArguments =
- selector.makeArgumentsList(target.implementation,
- arguments,
- compileConstant);
- return new js.Call(elementAccess, compiledArguments);
+ return new js.Call(elementAccess, arguments);
}
}
+ List<js.Expression> compileStaticArgumentList(
+ Selector selector,
+ Element target, /* TODO(karlklose): this should be the signature. */
+ List<tree_ir.Expression> arguments) {
+ return selector.makeArgumentsList(
+ target.implementation,
+ visitArguments(arguments),
+ compileConstant);
+ }
+
@override
js.Expression visitInvokeConstructor(tree_ir.InvokeConstructor node) {
if (node.constant != null) return giveup(node);
registry.registerInstantiatedClass(node.target.enclosingClass);
- return buildStaticInvoke(node.selector,
- node.target,
- visitArguments(node.arguments));
+ Selector selector = node.selector;
+ FunctionElement target = node.target;
+ List<js.Expression> arguments =
+ compileStaticArgumentList(selector, target, node.arguments);
+ return buildStaticInvoke(selector, target, arguments);
}
void registerMethodInvoke(tree_ir.InvokeMethod node) {
@@ -229,9 +238,11 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
if (node.target is! FunctionElement) {
giveup(node, 'static getters and setters are not supported.');
}
- return buildStaticInvoke(node.selector,
- node.target,
- visitArguments(node.arguments));
+ Selector selector = node.selector;
+ FunctionElement target = node.target;
+ List<js.Expression> arguments =
+ compileStaticArgumentList(selector, target, node.arguments);
+ return buildStaticInvoke(selector, target, arguments);
}
@override
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698