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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 String visitSetField(SetField node) { | 493 String visitSetField(SetField node) { |
494 String object = visitExpression(node.object); | 494 String object = visitExpression(node.object); |
495 String field = node.field.name; | 495 String field = node.field.name; |
496 if (usesInfixNotation(node.object)) { | 496 if (usesInfixNotation(node.object)) { |
497 object = '($object)'; | 497 object = '($object)'; |
498 } | 498 } |
499 String value = visitExpression(node.value); | 499 String value = visitExpression(node.value); |
500 return '$object.$field = $value'; | 500 return '$object.$field = $value'; |
501 } | 501 } |
502 | 502 |
503 String visitGetStatic(GetStatic node) { | |
504 String element = node.element.name; | |
505 return element; | |
506 } | |
507 | |
508 String visitSetStatic(SetStatic node) { | |
509 String element = node.element.name; | |
510 String value = visitExpression(node.value); | |
511 return '$element = $value'; | |
512 } | |
513 | |
514 String visitCreateBox(CreateBox node) { | 503 String visitCreateBox(CreateBox node) { |
515 return 'CreateBox'; | 504 return 'CreateBox'; |
516 } | 505 } |
517 | 506 |
518 String visitCreateInstance(CreateInstance node) { | 507 String visitCreateInstance(CreateInstance node) { |
519 String className = node.classElement.name; | 508 String className = node.classElement.name; |
520 String arguments = node.arguments.map(visitExpression).join(', '); | 509 String arguments = node.arguments.map(visitExpression).join(', '); |
521 return 'CreateInstance $className($arguments)'; | 510 return 'CreateInstance $className($arguments)'; |
522 } | 511 } |
523 | 512 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 551 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
563 while (name == null || _usedNames.contains(name)) { | 552 while (name == null || _usedNames.contains(name)) { |
564 name = "$prefix${_counter++}"; | 553 name = "$prefix${_counter++}"; |
565 } | 554 } |
566 _names[v] = name; | 555 _names[v] = name; |
567 _usedNames.add(name); | 556 _usedNames.add(name); |
568 } | 557 } |
569 return name; | 558 return name; |
570 } | 559 } |
571 } | 560 } |
OLD | NEW |