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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 printStatement(null, "if $condition then $thenTarget else $elseTarget"); | 293 printStatement(null, "if $condition then $thenTarget else $elseTarget"); |
294 } | 294 } |
295 | 295 |
296 visitWhileTrue(WhileTrue node) { | 296 visitWhileTrue(WhileTrue node) { |
297 printStatement(null, "while true do"); | 297 printStatement(null, "while true do"); |
298 } | 298 } |
299 | 299 |
300 visitWhileCondition(WhileCondition node) { | 300 visitWhileCondition(WhileCondition node) { |
301 String bodyTarget = collector.substatements[node.body].name; | 301 String bodyTarget = collector.substatements[node.body].name; |
302 String nextTarget = collector.substatements[node.next].name; | 302 String nextTarget = collector.substatements[node.next].name; |
| 303 String updates = node.updates.map(expr).join(', '); |
303 printStatement(null, "while ${expr(node.condition)}"); | 304 printStatement(null, "while ${expr(node.condition)}"); |
304 printStatement(null, "do $bodyTarget"); | 305 printStatement(null, "do $bodyTarget"); |
| 306 printStatement(null, "updates ($updates)"); |
305 printStatement(null, "then $nextTarget" ); | 307 printStatement(null, "then $nextTarget" ); |
306 } | 308 } |
307 | 309 |
308 visitTry(Try node) { | 310 visitTry(Try node) { |
309 String tryTarget = collector.substatements[node.tryBody].name; | 311 String tryTarget = collector.substatements[node.tryBody].name; |
310 String catchParams = node.catchParameters.map(names.varName).join(','); | 312 String catchParams = node.catchParameters.map(names.varName).join(','); |
311 String catchTarget = collector.substatements[node.catchBody].name; | 313 String catchTarget = collector.substatements[node.catchBody].name; |
312 printStatement(null, 'try $tryTarget catch($catchParams) $catchTarget'); | 314 printStatement(null, 'try $tryTarget catch($catchParams) $catchTarget'); |
313 } | 315 } |
314 | 316 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 589 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
588 while (name == null || _usedNames.contains(name)) { | 590 while (name == null || _usedNames.contains(name)) { |
589 name = "$prefix${_counter++}"; | 591 name = "$prefix${_counter++}"; |
590 } | 592 } |
591 _names[v] = name; | 593 _names[v] = name; |
592 _usedNames.add(name); | 594 _usedNames.add(name); |
593 } | 595 } |
594 return name; | 596 return name; |
595 } | 597 } |
596 } | 598 } |
OLD | NEW |