| 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 import 'optimization/optimization.dart'; | 10 import 'optimization/optimization.dart'; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 class SubexpressionVisitor extends ExpressionVisitor<String> { | 301 class SubexpressionVisitor extends ExpressionVisitor<String> { |
| 302 Names names; | 302 Names names; |
| 303 | 303 |
| 304 SubexpressionVisitor(this.names); | 304 SubexpressionVisitor(this.names); |
| 305 | 305 |
| 306 String visitVariable(Variable node) { | 306 String visitVariable(Variable node) { |
| 307 return names.varName(node); | 307 return names.varName(node); |
| 308 } | 308 } |
| 309 | 309 |
| 310 String visitVariableUse(VariableUse node) { |
| 311 return visitVariable(node.variable); |
| 312 } |
| 313 |
| 310 String formatArguments(Invoke node) { | 314 String formatArguments(Invoke node) { |
| 311 List<String> args = new List<String>(); | 315 List<String> args = new List<String>(); |
| 312 int positionalArgumentCount = node.selector.positionalArgumentCount; | 316 int positionalArgumentCount = node.selector.positionalArgumentCount; |
| 313 for (int i = 0; i < positionalArgumentCount; ++i) { | 317 for (int i = 0; i < positionalArgumentCount; ++i) { |
| 314 args.add(node.arguments[i].accept(this)); | 318 args.add(node.arguments[i].accept(this)); |
| 315 } | 319 } |
| 316 for (int i = 0; i < node.selector.namedArgumentCount; ++i) { | 320 for (int i = 0; i < node.selector.namedArgumentCount; ++i) { |
| 317 String name = node.selector.namedArguments[i]; | 321 String name = node.selector.namedArguments[i]; |
| 318 String arg = node.arguments[positionalArgumentCount + i].accept(this); | 322 String arg = node.arguments[positionalArgumentCount + i].accept(this); |
| 319 args.add("$name: $arg"); | 323 args.add("$name: $arg"); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 478 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
| 475 while (name == null || _usedNames.contains(name)) { | 479 while (name == null || _usedNames.contains(name)) { |
| 476 name = "$prefix${_counter++}"; | 480 name = "$prefix${_counter++}"; |
| 477 } | 481 } |
| 478 _names[v] = name; | 482 _names[v] = name; |
| 479 _usedNames.add(name); | 483 _usedNames.add(name); |
| 480 } | 484 } |
| 481 return name; | 485 return name; |
| 482 } | 486 } |
| 483 } | 487 } |
| OLD | NEW |