| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 String expr(Expression e) { | 296 String expr(Expression e) { |
| 297 return e.accept(new SubexpressionVisitor(names)); | 297 return e.accept(new SubexpressionVisitor(names)); |
| 298 } | 298 } |
| 299 } | 299 } |
| 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 visitVariableUse(VariableUse node) { |
| 307 return names.varName(node); | 307 return names.varName(node.variable); |
| 308 } | 308 } |
| 309 | 309 |
| 310 String formatArguments(Invoke node) { | 310 String formatArguments(Invoke node) { |
| 311 List<String> args = new List<String>(); | 311 List<String> args = new List<String>(); |
| 312 int positionalArgumentCount = node.selector.positionalArgumentCount; | 312 int positionalArgumentCount = node.selector.positionalArgumentCount; |
| 313 for (int i = 0; i < positionalArgumentCount; ++i) { | 313 for (int i = 0; i < positionalArgumentCount; ++i) { |
| 314 args.add(node.arguments[i].accept(this)); | 314 args.add(node.arguments[i].accept(this)); |
| 315 } | 315 } |
| 316 for (int i = 0; i < node.selector.namedArgumentCount; ++i) { | 316 for (int i = 0; i < node.selector.namedArgumentCount; ++i) { |
| 317 String name = node.selector.namedArguments[i]; | 317 String name = node.selector.namedArguments[i]; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 474 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
| 475 while (name == null || _usedNames.contains(name)) { | 475 while (name == null || _usedNames.contains(name)) { |
| 476 name = "$prefix${_counter++}"; | 476 name = "$prefix${_counter++}"; |
| 477 } | 477 } |
| 478 _names[v] = name; | 478 _names[v] = name; |
| 479 _usedNames.add(name); | 479 _usedNames.add(name); |
| 480 } | 480 } |
| 481 return name; | 481 return name; |
| 482 } | 482 } |
| 483 } | 483 } |
| OLD | NEW |