Chromium Code Reviews| 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 dart2js.ir_nodes_sexpr; | 5 library dart2js.ir_nodes_sexpr; |
| 6 | 6 |
| 7 import '../util/util.dart'; | 7 import '../util/util.dart'; |
| 8 import 'cps_ir_nodes.dart'; | 8 import 'cps_ir_nodes.dart'; |
| 9 import 'package:compiler/src/js_backend/codegen/unsugar.dart'; | |
|
sigurdm
2014/11/20 12:47:28
package import
| |
| 9 | 10 |
| 10 /// Generate a Lisp-like S-expression representation of an IR node as a string. | 11 /// Generate a Lisp-like S-expression representation of an IR node as a string. |
| 11 class SExpressionStringifier extends Visitor<String> with Indentation { | 12 class SExpressionStringifier extends Visitor<String> with Indentation { |
| 12 final Map<Definition, String> names = <Definition, String>{}; | 13 final Map<Definition, String> names = <Definition, String>{}; |
| 13 | 14 |
| 14 int _valueCounter = 0; | 15 int _valueCounter = 0; |
| 15 int _continuationCounter = 0; | 16 int _continuationCounter = 0; |
| 16 | 17 |
| 17 String newValueName() => 'v${_valueCounter++}'; | 18 String newValueName() => 'v${_valueCounter++}'; |
| 18 String newContinuationName() => 'k${_continuationCounter++}'; | 19 String newContinuationName() => 'k${_continuationCounter++}'; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 return '$indentation(DeclareFunction ${node.variable.name} =\n' | 190 return '$indentation(DeclareFunction ${node.variable.name} =\n' |
| 190 '$function in\n' | 191 '$function in\n' |
| 191 '$body)'; | 192 '$body)'; |
| 192 } | 193 } |
| 193 | 194 |
| 194 String visitIsTrue(IsTrue node) { | 195 String visitIsTrue(IsTrue node) { |
| 195 String value = names[node.value.definition]; | 196 String value = names[node.value.definition]; |
| 196 return '(IsTrue $value)'; | 197 return '(IsTrue $value)'; |
| 197 } | 198 } |
| 198 } | 199 } |
| OLD | NEW |