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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 _addStatement(node); | 126 _addStatement(node); |
127 visitStatement(node.body); | 127 visitStatement(node.body); |
128 } | 128 } |
129 | 129 |
130 visitFor(For node) { | 130 visitFor(For node) { |
131 Block whileBlock = new Block(); | 131 Block whileBlock = new Block(); |
132 _addGotoStatement(whileBlock); | 132 _addGotoStatement(whileBlock); |
133 | 133 |
134 _addBlock(whileBlock); | 134 _addBlock(whileBlock); |
135 _addStatement(node); | 135 _addStatement(node); |
136 whileBlock.statements.add(node); | |
asgerf
2015/09/16 15:25:09
Drive-by bugfix
| |
137 blocks.last.addEdgeTo(whileBlock); | 136 blocks.last.addEdgeTo(whileBlock); |
138 | 137 |
139 Block bodyBlock = new Block(); | 138 Block bodyBlock = new Block(); |
140 Block nextBlock = new Block(); | 139 Block nextBlock = new Block(); |
141 whileBlock.addEdgeTo(bodyBlock); | 140 whileBlock.addEdgeTo(bodyBlock); |
142 whileBlock.addEdgeTo(nextBlock); | 141 whileBlock.addEdgeTo(nextBlock); |
143 | 142 |
144 continueTargets[node.label] = bodyBlock; | 143 continueTargets[node.label] = bodyBlock; |
145 _addBlock(bodyBlock); | 144 _addBlock(bodyBlock); |
146 visitStatement(node.body); | 145 visitStatement(node.body); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 588 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
590 while (name == null || _usedNames.contains(name)) { | 589 while (name == null || _usedNames.contains(name)) { |
591 name = "$prefix${_counter++}"; | 590 name = "$prefix${_counter++}"; |
592 } | 591 } |
593 _names[v] = name; | 592 _names[v] = name; |
594 _usedNames.add(name); | 593 _usedNames.add(name); |
595 } | 594 } |
596 return name; | 595 return name; |
597 } | 596 } |
598 } | 597 } |
OLD | NEW |