| 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 import '../universe/call_structure.dart' show | 10 import '../universe/call_structure.dart' show |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 194 |
| 195 String visitUnreachable(Unreachable node) { | 195 String visitUnreachable(Unreachable node) { |
| 196 return '$indentation(Unreachable)'; | 196 return '$indentation(Unreachable)'; |
| 197 } | 197 } |
| 198 | 198 |
| 199 String visitConstant(Constant node) { | 199 String visitConstant(Constant node) { |
| 200 String value = node.value.accept(new ConstantStringifier(), null); | 200 String value = node.value.accept(new ConstantStringifier(), null); |
| 201 return '(Constant $value)'; | 201 return '(Constant $value)'; |
| 202 } | 202 } |
| 203 | 203 |
| 204 String visitCreateFunction(CreateFunction node) { | |
| 205 String function = | |
| 206 indentBlock(() => indentBlock(() => visit(node.definition))); | |
| 207 return '(CreateFunction\n$function)'; | |
| 208 } | |
| 209 | |
| 210 String visitContinuation(Continuation node) { | 204 String visitContinuation(Continuation node) { |
| 211 String name = newContinuationName(node); | 205 String name = newContinuationName(node); |
| 212 if (node.isRecursive) name = 'rec $name'; | 206 if (node.isRecursive) name = 'rec $name'; |
| 213 // TODO(karlklose): this should be changed to `.map(visit).join(' ')` and | 207 // TODO(karlklose): this should be changed to `.map(visit).join(' ')` and |
| 214 // should recurse to [visit]. Currently we can't do that, because the | 208 // should recurse to [visit]. Currently we can't do that, because the |
| 215 // unstringifier_test produces [LetConts] with dummy arguments on them. | 209 // unstringifier_test produces [LetConts] with dummy arguments on them. |
| 216 String parameters = node.parameters | 210 String parameters = node.parameters |
| 217 .map((p) => '${decorator(p, newValueName(p))}') | 211 .map((p) => '${decorator(p, newValueName(p))}') |
| 218 .join(' '); | 212 .join(' '); |
| 219 String body = indentBlock(() => indentBlock(() => visit(node.body))); | 213 String body = indentBlock(() => indentBlock(() => visit(node.body))); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 231 | 225 |
| 232 String visitTypeCast(TypeCast node) { | 226 String visitTypeCast(TypeCast node) { |
| 233 String value = access(node.value); | 227 String value = access(node.value); |
| 234 String typeArguments = node.typeArguments.map(access).join(' '); | 228 String typeArguments = node.typeArguments.map(access).join(' '); |
| 235 return '(TypeCast $value ${node.dartType} ($typeArguments))'; | 229 return '(TypeCast $value ${node.dartType} ($typeArguments))'; |
| 236 } | 230 } |
| 237 | 231 |
| 238 String visitTypeTest(TypeTest node) { | 232 String visitTypeTest(TypeTest node) { |
| 239 String value = access(node.value); | 233 String value = access(node.value); |
| 240 String typeArguments = node.typeArguments.map(access).join(' '); | 234 String typeArguments = node.typeArguments.map(access).join(' '); |
| 241 String interceptor = node.interceptor == null | 235 return '(TypeTest $value ${node.dartType} ($typeArguments))'; |
| 242 ? '' | |
| 243 : access(node.interceptor); | |
| 244 return '(TypeTest $value ${node.dartType} ($typeArguments) ($interceptor))'; | |
| 245 } | 236 } |
| 246 | 237 |
| 247 String visitTypeTestViaFlag(TypeTestViaFlag node) { | 238 String visitTypeTestViaFlag(TypeTestViaFlag node) { |
| 248 String interceptor = access(node.interceptor); | 239 String interceptor = access(node.interceptor); |
| 249 return '(TypeTestViaFlag $interceptor ${node.dartType})'; | 240 return '(TypeTestViaFlag $interceptor ${node.dartType})'; |
| 250 } | 241 } |
| 251 | 242 |
| 252 String visitLiteralList(LiteralList node) { | 243 String visitLiteralList(LiteralList node) { |
| 253 String values = node.values.map(access).join(' '); | 244 String values = node.values.map(access).join(' '); |
| 254 return '(LiteralList ($values))'; | 245 return '(LiteralList ($values))'; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 void setReturnContinuation(Continuation node) { | 473 void setReturnContinuation(Continuation node) { |
| 483 assert(!_names.containsKey(node) || _names[node] == 'return'); | 474 assert(!_names.containsKey(node) || _names[node] == 'return'); |
| 484 _names[node] = 'return'; | 475 _names[node] = 'return'; |
| 485 } | 476 } |
| 486 | 477 |
| 487 String getName(Node node) { | 478 String getName(Node node) { |
| 488 if (!_names.containsKey(node)) return 'MISSING_NAME'; | 479 if (!_names.containsKey(node)) return 'MISSING_NAME'; |
| 489 return _names[node]; | 480 return _names[node]; |
| 490 } | 481 } |
| 491 } | 482 } |
| OLD | NEW |