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 | 9 |
10 /// Generate a Lisp-like S-expression representation of an IR node as a string. | 10 /// Generate a Lisp-like S-expression representation of an IR node as a string. |
(...skipping 14 matching lines...) Expand all Loading... |
25 String name = p.hint.name; | 25 String name = p.hint.name; |
26 names[p] = name; | 26 names[p] = name; |
27 return name; | 27 return name; |
28 }) | 28 }) |
29 .join(' '); | 29 .join(' '); |
30 String body = indentBlock(() => visit(node.body)); | 30 String body = indentBlock(() => visit(node.body)); |
31 return '$indentation(FunctionDefinition $name ($parameters return)\n' | 31 return '$indentation(FunctionDefinition $name ($parameters return)\n' |
32 '$body)'; | 32 '$body)'; |
33 } | 33 } |
34 | 34 |
| 35 String visitFieldDefinition(FieldDefinition node) { |
| 36 String name = node.element.name; |
| 37 names[node.returnContinuation] = 'return'; |
| 38 String body = indentBlock(() => visit(node.body)); |
| 39 return '$indentation(FieldDefinition $name (return)\n' |
| 40 '$body)'; |
| 41 } |
| 42 |
35 String visitLetPrim(LetPrim node) { | 43 String visitLetPrim(LetPrim node) { |
36 String name = newValueName(); | 44 String name = newValueName(); |
37 names[node.primitive] = name; | 45 names[node.primitive] = name; |
38 String value = visit(node.primitive); | 46 String value = visit(node.primitive); |
39 String body = visit(node.body); | 47 String body = visit(node.body); |
40 return '$indentation(LetPrim $name $value)\n$body'; | 48 return '$indentation(LetPrim $name $value)\n$body'; |
41 } | 49 } |
42 | 50 |
43 String visitLetCont(LetCont node) { | 51 String visitLetCont(LetCont node) { |
44 String cont = newContinuationName(); | 52 String cont = newContinuationName(); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 return '$indentation(DeclareFunction ${node.variable.name} =\n' | 197 return '$indentation(DeclareFunction ${node.variable.name} =\n' |
190 '$function in\n' | 198 '$function in\n' |
191 '$body)'; | 199 '$body)'; |
192 } | 200 } |
193 | 201 |
194 String visitIsTrue(IsTrue node) { | 202 String visitIsTrue(IsTrue node) { |
195 String value = names[node.value.definition]; | 203 String value = names[node.value.definition]; |
196 return '(IsTrue $value)'; | 204 return '(IsTrue $value)'; |
197 } | 205 } |
198 } | 206 } |
OLD | NEW |