| 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 dart_backend.tracer; | 5 library dart_backend.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 'dart_tree.dart'; | 9 import 'dart_tree.dart'; |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 blocks.add(block); | 50 blocks.add(block); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void collect(FunctionDefinition function) { | 53 void collect(FunctionDefinition function) { |
| 54 visitStatement(function.body); | 54 visitStatement(function.body); |
| 55 } | 55 } |
| 56 | 56 |
| 57 visitVariable(Variable node) {} | 57 visitVariable(Variable node) {} |
| 58 visitInvokeStatic(InvokeStatic node) {} | 58 visitInvokeStatic(InvokeStatic node) {} |
| 59 visitInvokeMethod(InvokeMethod node) {} | 59 visitInvokeMethod(InvokeMethod node) {} |
| 60 visitInvokeSuperMethod(InvokeSuperMethod node) {} |
| 60 visitInvokeConstructor(InvokeConstructor node) {} | 61 visitInvokeConstructor(InvokeConstructor node) {} |
| 61 visitConcatenateStrings(ConcatenateStrings node) {} | 62 visitConcatenateStrings(ConcatenateStrings node) {} |
| 62 visitLiteralList(LiteralList node) {} | 63 visitLiteralList(LiteralList node) {} |
| 63 visitLiteralMap(LiteralMap node) {} | 64 visitLiteralMap(LiteralMap node) {} |
| 64 visitConstant(Constant node) {} | 65 visitConstant(Constant node) {} |
| 65 visitThis(This node) {} | 66 visitThis(This node) {} |
| 66 visitConditional(Conditional node) {} | 67 visitConditional(Conditional node) {} |
| 67 visitLogicalOperator(LogicalOperator node) {} | 68 visitLogicalOperator(LogicalOperator node) {} |
| 68 visitNot(Not node) {} | 69 visitNot(Not node) {} |
| 69 | 70 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 return "$head($args)"; | 298 return "$head($args)"; |
| 298 } | 299 } |
| 299 | 300 |
| 300 String visitInvokeMethod(InvokeMethod node) { | 301 String visitInvokeMethod(InvokeMethod node) { |
| 301 String receiver = node.receiver.accept(this); | 302 String receiver = node.receiver.accept(this); |
| 302 String name = node.selector.name; | 303 String name = node.selector.name; |
| 303 String args = formatArguments(node); | 304 String args = formatArguments(node); |
| 304 return "$receiver.$name($args)"; | 305 return "$receiver.$name($args)"; |
| 305 } | 306 } |
| 306 | 307 |
| 308 String visitInvokeSuperMethod(InvokeSuperMethod node) { |
| 309 String receiver = node.receiver.accept(this); |
| 310 String name = node.selector.name; |
| 311 String args = formatArguments(node); |
| 312 return "super.$name($args)"; |
| 313 } |
| 314 |
| 307 String visitInvokeConstructor(InvokeConstructor node) { | 315 String visitInvokeConstructor(InvokeConstructor node) { |
| 308 String callName; | 316 String callName; |
| 309 if (node.target.name.isEmpty) { | 317 if (node.target.name.isEmpty) { |
| 310 callName = '${node.type}'; | 318 callName = '${node.type}'; |
| 311 } else { | 319 } else { |
| 312 callName = '${node.type}.${node.target.name}'; | 320 callName = '${node.type}.${node.target.name}'; |
| 313 } | 321 } |
| 314 String args = formatArguments(node); | 322 String args = formatArguments(node); |
| 315 String keyword = node.constant != null ? 'const' : 'new'; | 323 String keyword = node.constant != null ? 'const' : 'new'; |
| 316 return "$keyword $callName($args)"; | 324 return "$keyword $callName($args)"; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 String prefix = v.element == null ? 'v' : '${v.element.name}_'; | 403 String prefix = v.element == null ? 'v' : '${v.element.name}_'; |
| 396 while (name == null || _usedNames.contains(name)) { | 404 while (name == null || _usedNames.contains(name)) { |
| 397 name = "$prefix${_counter++}"; | 405 name = "$prefix${_counter++}"; |
| 398 } | 406 } |
| 399 _names[v] = name; | 407 _names[v] = name; |
| 400 _usedNames.add(name); | 408 _usedNames.add(name); |
| 401 } | 409 } |
| 402 return name; | 410 return name; |
| 403 } | 411 } |
| 404 } | 412 } |
| OLD | NEW |