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 '../constants/values.dart'; | 7 import '../constants/values.dart'; |
8 import '../util/util.dart'; | 8 import '../util/util.dart'; |
9 import 'cps_ir_nodes.dart'; | 9 import 'cps_ir_nodes.dart'; |
10 | 10 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return '$indentation(DeclareFunction $name =\n' | 221 return '$indentation(DeclareFunction $name =\n' |
222 '$function in\n' | 222 '$function in\n' |
223 '$body)'; | 223 '$body)'; |
224 } | 224 } |
225 | 225 |
226 String visitIsTrue(IsTrue node) { | 226 String visitIsTrue(IsTrue node) { |
227 String value = access(node.value); | 227 String value = access(node.value); |
228 return '(IsTrue $value)'; | 228 return '(IsTrue $value)'; |
229 } | 229 } |
230 | 230 |
| 231 String visitSetField(SetField node) { |
| 232 String object = access(node.object); |
| 233 String field = node.field.name; |
| 234 String value = access(node.value); |
| 235 String body = indentBlock(() => visit(node.body)); |
| 236 return '$indentation(SetField $object $field $value)\n$body'; |
| 237 } |
| 238 |
| 239 String visitGetField(GetField node) { |
| 240 String object = access(node.object); |
| 241 String field = node.field.toString(); |
| 242 return '(GetField $object $field)'; |
| 243 } |
| 244 |
| 245 String visitCreateBox(CreateBox node) { |
| 246 return '(CreateBox)'; |
| 247 } |
| 248 |
| 249 String visitCreateClosureClass(CreateClosureClass node) { |
| 250 String className = node.classElement.name; |
| 251 String arguments = node.arguments.map(access).join(' '); |
| 252 return '(CreateClosureClass $className ($arguments))'; |
| 253 } |
| 254 |
231 String visitIdentical(Identical node) { | 255 String visitIdentical(Identical node) { |
232 String left = access(node.left); | 256 String left = access(node.left); |
233 String right = access(node.right); | 257 String right = access(node.right); |
234 return '(Identical $left $right)'; | 258 return '(Identical $left $right)'; |
235 } | 259 } |
236 | 260 |
237 String visitInterceptor(Interceptor node) { | 261 String visitInterceptor(Interceptor node) { |
238 return '(Interceptor ${node.input})'; | 262 return '(Interceptor ${node.input})'; |
239 } | 263 } |
240 } | 264 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 void setReturnContinuation(Continuation node) { | 355 void setReturnContinuation(Continuation node) { |
332 assert(!_names.containsKey(node) || _names[node] == 'return'); | 356 assert(!_names.containsKey(node) || _names[node] == 'return'); |
333 _names[node] = 'return'; | 357 _names[node] = 'return'; |
334 } | 358 } |
335 | 359 |
336 String getName(Node node) { | 360 String getName(Node node) { |
337 assert(_names.containsKey(node)); | 361 assert(_names.containsKey(node)); |
338 return _names[node]; | 362 return _names[node]; |
339 } | 363 } |
340 } | 364 } |
OLD | NEW |