| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 String expr(Expression e) { | 306 String expr(Expression e) { |
| 307 return e.accept(new SubexpressionVisitor(names)); | 307 return e.accept(new SubexpressionVisitor(names)); |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 class SubexpressionVisitor extends ExpressionVisitor<String> { | 311 class SubexpressionVisitor extends ExpressionVisitor<String> { |
| 312 Names names; | 312 Names names; |
| 313 | 313 |
| 314 SubexpressionVisitor(this.names); | 314 SubexpressionVisitor(this.names); |
| 315 | 315 |
| 316 String visitVariable(Variable node) { | 316 String visitVariableUse(VariableUse node) { |
| 317 return names.varName(node); | 317 return names.varName(node.variable); |
| 318 } | 318 } |
| 319 | 319 |
| 320 String formatArguments(Invoke node) { | 320 String formatArguments(Invoke node) { |
| 321 List<String> args = new List<String>(); | 321 List<String> args = new List<String>(); |
| 322 int positionalArgumentCount = node.selector.positionalArgumentCount; | 322 int positionalArgumentCount = node.selector.positionalArgumentCount; |
| 323 for (int i = 0; i < positionalArgumentCount; ++i) { | 323 for (int i = 0; i < positionalArgumentCount; ++i) { |
| 324 args.add(node.arguments[i].accept(this)); | 324 args.add(node.arguments[i].accept(this)); |
| 325 } | 325 } |
| 326 for (int i = 0; i < node.selector.namedArgumentCount; ++i) { | 326 for (int i = 0; i < node.selector.namedArgumentCount; ++i) { |
| 327 String name = node.selector.namedArguments[i]; | 327 String name = node.selector.namedArguments[i]; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 484 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
| 485 while (name == null || _usedNames.contains(name)) { | 485 while (name == null || _usedNames.contains(name)) { |
| 486 name = "$prefix${_counter++}"; | 486 name = "$prefix${_counter++}"; |
| 487 } | 487 } |
| 488 _names[v] = name; | 488 _names[v] = name; |
| 489 _usedNames.add(name); | 489 _usedNames.add(name); |
| 490 } | 490 } |
| 491 return name; | 491 return name; |
| 492 } | 492 } |
| 493 } | 493 } |
| OLD | NEW |