| 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 /// A [Decorator] is a function used by [SExpressionStringifier] to augment the | 10 /// A [Decorator] is a function used by [SExpressionStringifier] to augment the |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 String visitFunctionDefinition(FunctionDefinition node) { | 37 String visitFunctionDefinition(FunctionDefinition node) { |
| 38 String name = node.element.name; | 38 String name = node.element.name; |
| 39 namer.useReturnName(node.returnContinuation); | 39 namer.useReturnName(node.returnContinuation); |
| 40 String parameters = node.parameters.map(visit).join(' '); | 40 String parameters = node.parameters.map(visit).join(' '); |
| 41 String body = indentBlock(() => visit(node.body)); | 41 String body = indentBlock(() => visit(node.body)); |
| 42 return '$indentation(FunctionDefinition $name ($parameters return)\n' | 42 return '$indentation(FunctionDefinition $name ($parameters return)\n' |
| 43 '$body)'; | 43 '$body)'; |
| 44 } | 44 } |
| 45 | 45 |
| 46 String visitFieldDefinition(FieldDefinition node) { |
| 47 String name = node.element.name; |
| 48 namer.useReturnName(node.returnContinuation); |
| 49 String body = indentBlock(() => visit(node.body)); |
| 50 return '$indentation(FieldDefinition $name (return)\n' |
| 51 '$body)'; |
| 52 } |
| 53 |
| 46 String visitLetPrim(LetPrim node) { | 54 String visitLetPrim(LetPrim node) { |
| 47 String name = newValueName(node.primitive); | 55 String name = newValueName(node.primitive); |
| 48 String value = visit(node.primitive); | 56 String value = visit(node.primitive); |
| 49 String body = visit(node.body); | 57 String body = visit(node.body); |
| 50 return '$indentation(LetPrim $name $value)\n$body'; | 58 return '$indentation(LetPrim $name $value)\n$body'; |
| 51 } | 59 } |
| 52 | 60 |
| 53 String visitLetCont(LetCont node) { | 61 String visitLetCont(LetCont node) { |
| 54 String cont = newContinuationName(node.continuation); | 62 String cont = newContinuationName(node.continuation); |
| 55 // TODO(karlklose): this should be changed to `.map(visit).join(' ')` and | 63 // TODO(karlklose): this should be changed to `.map(visit).join(' ')` and |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 String useReturnName(Continuation node) { | 236 String useReturnName(Continuation node) { |
| 229 assert(!_names.containsKey(node) || _names[node] == 'return'); | 237 assert(!_names.containsKey(node) || _names[node] == 'return'); |
| 230 return _names[node] = 'return'; | 238 return _names[node] = 'return'; |
| 231 } | 239 } |
| 232 | 240 |
| 233 String getName(Node node) { | 241 String getName(Node node) { |
| 234 assert(_names.containsKey(node)); | 242 assert(_names.containsKey(node)); |
| 235 return _names[node]; | 243 return _names[node]; |
| 236 } | 244 } |
| 237 } | 245 } |
| OLD | NEW |