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 dart2js.ir_nodes_sexpr; | 5 library dart2js.ir_nodes_sexpr; |
6 | 6 |
7 import '../constants/values.dart'; | 7 import '../constants/values.dart'; |
8 import '../util/util.dart'; | 8 import '../util/util.dart'; |
9 import 'cps_ir_nodes.dart'; | 9 import 'cps_ir_nodes.dart'; |
10 | 10 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 String selector = node.selector.name; | 337 String selector = node.selector.name; |
338 String args = node.arguments.map(access).join(' '); | 338 String args = node.arguments.map(access).join(' '); |
339 return '(CreateInvocationMirror $selector ($args))'; | 339 return '(CreateInvocationMirror $selector ($args))'; |
340 } | 340 } |
341 | 341 |
342 String visitApplyBuiltinOperator(ApplyBuiltinOperator node) { | 342 String visitApplyBuiltinOperator(ApplyBuiltinOperator node) { |
343 String operator = node.operator.toString(); | 343 String operator = node.operator.toString(); |
344 String args = node.arguments.map(access).join(' '); | 344 String args = node.arguments.map(access).join(' '); |
345 return '(ApplyBuiltinOperator $operator ($args))'; | 345 return '(ApplyBuiltinOperator $operator ($args))'; |
346 } | 346 } |
| 347 |
| 348 @override |
| 349 String visitForeignCode(ForeignCode node) { |
| 350 String arguments = node.arguments.map(access).join(' '); |
| 351 String continuation = node.continuation == null ? '' |
| 352 : ' ${access(node.continuation)}'; |
| 353 return '(JS ${node.type} ${node.codeTemplate} ($arguments)$continuation)'; |
| 354 } |
347 } | 355 } |
348 | 356 |
349 class ConstantStringifier extends ConstantValueVisitor<String, Null> { | 357 class ConstantStringifier extends ConstantValueVisitor<String, Null> { |
350 // Some of these methods are unimplemented because we haven't had a need | 358 // Some of these methods are unimplemented because we haven't had a need |
351 // to print such constants. When printing is implemented, the corresponding | 359 // to print such constants. When printing is implemented, the corresponding |
352 // parsing support should be added to SExpressionUnstringifier.parseConstant | 360 // parsing support should be added to SExpressionUnstringifier.parseConstant |
353 // in the dart2js tests (currently in the file | 361 // in the dart2js tests (currently in the file |
354 // tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart). | 362 // tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart). |
355 | 363 |
356 String _failWith(ConstantValue constant) { | 364 String _failWith(ConstantValue constant) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 void setReturnContinuation(Continuation node) { | 459 void setReturnContinuation(Continuation node) { |
452 assert(!_names.containsKey(node) || _names[node] == 'return'); | 460 assert(!_names.containsKey(node) || _names[node] == 'return'); |
453 _names[node] = 'return'; | 461 _names[node] = 'return'; |
454 } | 462 } |
455 | 463 |
456 String getName(Node node) { | 464 String getName(Node node) { |
457 if (!_names.containsKey(node)) return 'MISSING_NAME'; | 465 if (!_names.containsKey(node)) return 'MISSING_NAME'; |
458 return _names[node]; | 466 return _names[node]; |
459 } | 467 } |
460 } | 468 } |
OLD | NEW |