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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 printStatement(null, '$object.$field = $value'); | 322 printStatement(null, '$object.$field = $value'); |
323 } | 323 } |
324 | 324 |
325 String expr(Expression e) { | 325 String expr(Expression e) { |
326 return e.accept(new SubexpressionVisitor(names)); | 326 return e.accept(new SubexpressionVisitor(names)); |
327 } | 327 } |
328 | 328 |
329 @override | 329 @override |
330 visitForeignStatement(ForeignStatement node) { | 330 visitForeignStatement(ForeignStatement node) { |
331 printStatement(null, 'foreign'); | 331 printStatement(null, 'foreign ${node.codeTemplate.source}'); |
332 } | 332 } |
333 } | 333 } |
334 | 334 |
335 class SubexpressionVisitor extends ExpressionVisitor<String> { | 335 class SubexpressionVisitor extends ExpressionVisitor<String> { |
336 Names names; | 336 Names names; |
337 | 337 |
338 SubexpressionVisitor(this.names); | 338 SubexpressionVisitor(this.names); |
339 | 339 |
340 String visitVariableUse(VariableUse node) { | 340 String visitVariableUse(VariableUse node) { |
341 return names.varName(node.variable); | 341 return names.varName(node.variable); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 } | 515 } |
516 | 516 |
517 @override | 517 @override |
518 String visitInterceptor(Interceptor node) { | 518 String visitInterceptor(Interceptor node) { |
519 return 'Interceptor(${visitExpression(node.input)})'; | 519 return 'Interceptor(${visitExpression(node.input)})'; |
520 } | 520 } |
521 | 521 |
522 @override | 522 @override |
523 String visitForeignExpression(ForeignExpression node) { | 523 String visitForeignExpression(ForeignExpression node) { |
524 String arguments = node.arguments.map(visitExpression).join(', '); | 524 String arguments = node.arguments.map(visitExpression).join(', '); |
525 return 'Foreign "${node.codeTemplate}"($arguments)'; | 525 return 'Foreign "${node.codeTemplate.source}"($arguments)'; |
526 } | 526 } |
527 | 527 |
528 @override | 528 @override |
529 String visitApplyBuiltinOperator(ApplyBuiltinOperator node) { | 529 String visitApplyBuiltinOperator(ApplyBuiltinOperator node) { |
530 String args = node.arguments.map(visitExpression).join(', '); | 530 String args = node.arguments.map(visitExpression).join(', '); |
531 return 'ApplyBuiltinOperator ${node.operator} ($args)'; | 531 return 'ApplyBuiltinOperator ${node.operator} ($args)'; |
532 } | 532 } |
533 } | 533 } |
534 | 534 |
535 /** | 535 /** |
(...skipping 14 matching lines...) Expand all Loading... |
550 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 550 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
551 while (name == null || _usedNames.contains(name)) { | 551 while (name == null || _usedNames.contains(name)) { |
552 name = "$prefix${_counter++}"; | 552 name = "$prefix${_counter++}"; |
553 } | 553 } |
554 _names[v] = name; | 554 _names[v] = name; |
555 _usedNames.add(name); | 555 _usedNames.add(name); |
556 } | 556 } |
557 return name; | 557 return name; |
558 } | 558 } |
559 } | 559 } |
OLD | NEW |