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 } | |
355 } | 347 } |
356 | 348 |
357 class ConstantStringifier extends ConstantValueVisitor<String, Null> { | 349 class ConstantStringifier extends ConstantValueVisitor<String, Null> { |
358 // Some of these methods are unimplemented because we haven't had a need | 350 // Some of these methods are unimplemented because we haven't had a need |
359 // to print such constants. When printing is implemented, the corresponding | 351 // to print such constants. When printing is implemented, the corresponding |
360 // parsing support should be added to SExpressionUnstringifier.parseConstant | 352 // parsing support should be added to SExpressionUnstringifier.parseConstant |
361 // in the dart2js tests (currently in the file | 353 // in the dart2js tests (currently in the file |
362 // tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart). | 354 // tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart). |
363 | 355 |
364 String _failWith(ConstantValue constant) { | 356 String _failWith(ConstantValue constant) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 void setReturnContinuation(Continuation node) { | 451 void setReturnContinuation(Continuation node) { |
460 assert(!_names.containsKey(node) || _names[node] == 'return'); | 452 assert(!_names.containsKey(node) || _names[node] == 'return'); |
461 _names[node] = 'return'; | 453 _names[node] = 'return'; |
462 } | 454 } |
463 | 455 |
464 String getName(Node node) { | 456 String getName(Node node) { |
465 if (!_names.containsKey(node)) return 'MISSING_NAME'; | 457 if (!_names.containsKey(node)) return 'MISSING_NAME'; |
466 return _names[node]; | 458 return _names[node]; |
467 } | 459 } |
468 } | 460 } |
OLD | NEW |