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

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

Issue 742023002: Handle named and optional arguments in cps-ir. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix syntax Created 6 years, 1 month 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
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 ff7a0933e1e8fede8305e9ab84fbde170c470017..4bef84cff414bbdb6052a757293ebe63698dec34 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -142,14 +142,17 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
visit(node.elseExpression));
}
- @override
- js.Expression visitConstant(tree_ir.Constant node) {
- ConstantValue constant = node.expression.value;
+ js.Expression buildConstant(ConstantValue constant) {
registry.registerCompileTimeConstant(constant);
return glue.constantReference(constant);
}
@override
+ js.Expression visitConstant(tree_ir.Constant node) {
+ return buildConstant(node.expression.value);
+ }
+
+ @override
js.Expression visitFunctionExpression(tree_ir.FunctionExpression node) {
return giveup(node);
// TODO: implement visitFunctionExpression
@@ -171,10 +174,18 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> {
js.Expression visitInvokeStatic(tree_ir.InvokeStatic node) {
Element element = node.target;
- registry.registerStaticInvocation(element);
+ registry.registerStaticInvocation(element.declaration);
+
+ js.Expression compileConstant(ParameterElement parameter) {
+ return buildConstant(glue.getConstantForVariable(parameter).value);
+ }
js.Expression elementAccess = glue.elementAccess(node.target);
- return new js.Call(elementAccess, visitArguments(node.arguments));
+ List<js.Expression> arguments =
+ node.selector.makeArgumentsList(node.arguments, element.implementation,
+ visitExpression,
+ compileConstant);
+ return new js.Call(elementAccess, arguments);
}
@override

Powered by Google App Engine
This is Rietveld 408576698