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 tree_ir_tracer; | 5 library tree_ir_tracer; |
6 | 6 |
7 import 'dart:async' show EventSink; | 7 import 'dart:async' show EventSink; |
8 import '../tracer.dart'; | 8 import '../tracer.dart'; |
9 import 'tree_ir_nodes.dart'; | 9 import 'tree_ir_nodes.dart'; |
10 | 10 |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 String name = node.selector.name; | 407 String name = node.selector.name; |
408 String args = formatArguments(node); | 408 String args = formatArguments(node); |
409 return "oneshot $name($args)"; | 409 return "oneshot $name($args)"; |
410 } | 410 } |
411 | 411 |
412 String visitLiteralList(LiteralList node) { | 412 String visitLiteralList(LiteralList node) { |
413 String values = node.values.map(visitExpression).join(', '); | 413 String values = node.values.map(visitExpression).join(', '); |
414 return "list [$values]"; | 414 return "list [$values]"; |
415 } | 415 } |
416 | 416 |
417 String visitLiteralMap(LiteralMap node) { | |
418 List<String> entries = new List<String>(); | |
419 node.entries.forEach((LiteralMapEntry entry) { | |
420 String key = visitExpression(entry.key); | |
421 String value = visitExpression(entry.value); | |
422 entries.add("$key: $value"); | |
423 }); | |
424 return "map [${entries.join(', ')}]"; | |
425 } | |
426 | |
427 String visitConstant(Constant node) { | 417 String visitConstant(Constant node) { |
428 return "${node.value.toStructuredString()}"; | 418 return "${node.value.toStructuredString()}"; |
429 } | 419 } |
430 | 420 |
431 String visitThis(This node) { | 421 String visitThis(This node) { |
432 return "this"; | 422 return "this"; |
433 } | 423 } |
434 | 424 |
435 static bool usesInfixNotation(Expression node) { | 425 static bool usesInfixNotation(Expression node) { |
436 return node is Conditional || | 426 return node is Conditional || |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 608 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
619 while (name == null || _usedNames.contains(name)) { | 609 while (name == null || _usedNames.contains(name)) { |
620 name = "$prefix${_counter++}"; | 610 name = "$prefix${_counter++}"; |
621 } | 611 } |
622 _names[v] = name; | 612 _names[v] = name; |
623 _usedNames.add(name); | 613 _usedNames.add(name); |
624 } | 614 } |
625 return name; | 615 return name; |
626 } | 616 } |
627 } | 617 } |
OLD | NEW |