Chromium Code Reviews| 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 1eb0c335da60e8462b3e20fdedee90275718a7ab..6e1365db4709c33c5fb48915664e2198ca703af9 100644 |
| --- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart |
| +++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart |
| @@ -162,10 +162,28 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> { |
| // TODO: implement visitFunctionExpression |
| } |
| + js.Expression buildStaticInvoke(Selector selector, |
| + Element target, |
| + List<tree_ir.Expression> arguments) { |
| + |
|
karlklose
2014/11/26 14:27:29
Remove line.
sigurdm
2014/11/26 14:49:52
Done.
|
| + registry.registerStaticInvocation(target.declaration); |
| + |
| + js.Expression compileConstant(ParameterElement parameter) { |
|
karlklose
2014/11/26 14:27:29
Make that a member? It is currently only used here
sigurdm
2014/11/26 14:49:52
Done.
|
| + return buildConstant(glue.getConstantForVariable(parameter).value); |
| + } |
| + |
| + js.Expression elementAccess = glue.elementAccess(target); |
| + List<js.Expression> compiledArguments = |
| + selector.makeArgumentsList(arguments, target.implementation, |
|
karlklose
2014/11/26 14:27:29
I think this should also have four spaces indentat
sigurdm
2014/11/26 14:49:52
Done.
|
| + visitExpression, |
| + compileConstant); |
| + return new js.Call(elementAccess, compiledArguments); |
| + } |
| + |
| @override |
| js.Expression visitInvokeConstructor(tree_ir.InvokeConstructor node) { |
| - return giveup(node); |
| - // TODO: implement visitInvokeConstructor |
| + if (node.constant != null) return giveup(node); |
| + return buildStaticInvoke(node.selector, node.target, node.arguments); |
|
karlklose
2014/11/26 14:27:29
Is there a common superclass of InvokeConstructor
sigurdm
2014/11/26 14:49:52
There is `Invoke` but it is also common with Invok
|
| } |
| @override |
| @@ -176,20 +194,7 @@ class CodeGenerator extends tree_ir.Visitor<dynamic, js.Expression> { |
| @override |
| js.Expression visitInvokeStatic(tree_ir.InvokeStatic node) { |
| - Element element = node.target; |
| - |
| - registry.registerStaticInvocation(element.declaration); |
| - |
| - js.Expression compileConstant(ParameterElement parameter) { |
| - return buildConstant(glue.getConstantForVariable(parameter).value); |
| - } |
| - |
| - js.Expression elementAccess = glue.elementAccess(node.target); |
| - List<js.Expression> arguments = |
| - node.selector.makeArgumentsList(node.arguments, element.implementation, |
| - visitExpression, |
| - compileConstant); |
| - return new js.Call(elementAccess, arguments); |
| + return buildStaticInvoke(node.selector, node.target, node.arguments); |
| } |
| @override |