Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library code_generator; | 5 library code_generator; |
| 6 | 6 |
| 7 import 'glue.dart'; | 7 import 'glue.dart'; |
| 8 | 8 |
| 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; | 9 import '../../tree_ir/tree_ir_nodes.dart' as tree_ir; |
| 10 import '../../js/js.dart' as js; | 10 import '../../js/js.dart' as js; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 | 164 |
| 165 js.Expression compileConstant(ParameterElement parameter) { | 165 js.Expression compileConstant(ParameterElement parameter) { |
| 166 return buildConstant(glue.getConstantForVariable(parameter).value); | 166 return buildConstant(glue.getConstantForVariable(parameter).value); |
| 167 } | 167 } |
| 168 | 168 |
| 169 js.Expression buildStaticInvoke(Selector selector, | 169 js.Expression buildStaticInvoke(Selector selector, |
| 170 Element target, | 170 Element target, |
| 171 List<js.Expression> arguments) { | 171 List<js.Expression> arguments) { |
| 172 registry.registerStaticInvocation(target.declaration); | 172 registry.registerStaticInvocation(target.declaration); |
| 173 | 173 |
| 174 js.Expression elementAccess = glue.elementAccess(target); | 174 js.Expression elementAccess = glue.globalPropertyAccess(target); |
|
floitsch
2014/12/03 17:02:24
ditto: staticFunctionAccess
zarah
2014/12/05 08:22:49
Done.
| |
| 175 List<js.Expression> compiledArguments = | 175 List<js.Expression> compiledArguments = |
| 176 selector.makeArgumentsList(target.implementation, | 176 selector.makeArgumentsList(target.implementation, |
| 177 arguments, | 177 arguments, |
| 178 compileConstant); | 178 compileConstant); |
| 179 return new js.Call(elementAccess, compiledArguments); | 179 return new js.Call(elementAccess, compiledArguments); |
| 180 } | 180 } |
| 181 | 181 |
| 182 @override | 182 @override |
| 183 js.Expression visitInvokeConstructor(tree_ir.InvokeConstructor node) { | 183 js.Expression visitInvokeConstructor(tree_ir.InvokeConstructor node) { |
| 184 if (node.constant != null) return giveup(node); | 184 if (node.constant != null) return giveup(node); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 410 accumulator.add( | 410 accumulator.add( |
| 411 buildWhile(new js.LiteralBool(true), node.body, node.label, node)); | 411 buildWhile(new js.LiteralBool(true), node.body, node.label, node)); |
| 412 } | 412 } |
| 413 | 413 |
| 414 @override | 414 @override |
| 415 void visitReturn(tree_ir.Return node) { | 415 void visitReturn(tree_ir.Return node) { |
| 416 accumulator.add(new js.Return(visitExpression(node.value))); | 416 accumulator.add(new js.Return(visitExpression(node.value))); |
| 417 } | 417 } |
| 418 | 418 |
| 419 } | 419 } |
| OLD | NEW |