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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 visitForeignStatement(ForeignStatement node) { | 177 visitForeignStatement(ForeignStatement node) { |
178 _addStatement(node); | 178 _addStatement(node); |
179 } | 179 } |
180 | 180 |
181 visitYield(Yield node) { | 181 visitYield(Yield node) { |
182 _addStatement(node); | 182 _addStatement(node); |
183 visitStatement(node.next); | 183 visitStatement(node.next); |
184 } | 184 } |
| 185 |
| 186 visitNullCheck(NullCheck node) { |
| 187 _addStatement(node); |
| 188 visitStatement(node.next); |
| 189 } |
185 } | 190 } |
186 | 191 |
187 class TreeTracer extends TracerUtil with StatementVisitor { | 192 class TreeTracer extends TracerUtil with StatementVisitor { |
188 String get passName => null; | 193 String get passName => null; |
189 | 194 |
190 final EventSink<String> output; | 195 final EventSink<String> output; |
191 | 196 |
192 TreeTracer(this.output); | 197 TreeTracer(this.output); |
193 | 198 |
194 List<Variable> parameters; | 199 List<Variable> parameters; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 @override | 344 @override |
340 visitForeignStatement(ForeignStatement node) { | 345 visitForeignStatement(ForeignStatement node) { |
341 printStatement(null, 'foreign ${node.codeTemplate.source}'); | 346 printStatement(null, 'foreign ${node.codeTemplate.source}'); |
342 } | 347 } |
343 | 348 |
344 @override | 349 @override |
345 visitYield(Yield node) { | 350 visitYield(Yield node) { |
346 String name = node.hasStar ? 'yield*' : 'yield'; | 351 String name = node.hasStar ? 'yield*' : 'yield'; |
347 printStatement(null, '$name ${expr(node.input)}'); | 352 printStatement(null, '$name ${expr(node.input)}'); |
348 } | 353 } |
| 354 |
| 355 @override |
| 356 visitNullCheck(NullCheck node) { |
| 357 printStatement(null, 'NullCheck ${expr(node.value)}'); |
| 358 } |
349 } | 359 } |
350 | 360 |
351 class SubexpressionVisitor extends ExpressionVisitor<String> { | 361 class SubexpressionVisitor extends ExpressionVisitor<String> { |
352 Names names; | 362 Names names; |
353 | 363 |
354 SubexpressionVisitor(this.names); | 364 SubexpressionVisitor(this.names); |
355 | 365 |
356 String visitVariableUse(VariableUse node) { | 366 String visitVariableUse(VariableUse node) { |
357 return names.varName(node.variable); | 367 return names.varName(node.variable); |
358 } | 368 } |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 620 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
611 while (name == null || _usedNames.contains(name)) { | 621 while (name == null || _usedNames.contains(name)) { |
612 name = "$prefix${_counter++}"; | 622 name = "$prefix${_counter++}"; |
613 } | 623 } |
614 _names[v] = name; | 624 _names[v] = name; |
615 _usedNames.add(name); | 625 _usedNames.add(name); |
616 } | 626 } |
617 return name; | 627 return name; |
618 } | 628 } |
619 } | 629 } |
OLD | NEW |