| 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/universe.dart' show Selector, CallStructure; | 10 import '../universe/universe.dart' show Selector, CallStructure; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 String args = formatArguments(node.selector.callStructure, node.arguments); | 152 String args = formatArguments(node.selector.callStructure, node.arguments); |
| 153 return '$indentation(InvokeMethodDirectly $receiver $name $args $cont)'; | 153 return '$indentation(InvokeMethodDirectly $receiver $name $args $cont)'; |
| 154 } | 154 } |
| 155 | 155 |
| 156 String visitInvokeConstructor(InvokeConstructor node) { | 156 String visitInvokeConstructor(InvokeConstructor node) { |
| 157 String className; | 157 String className; |
| 158 // TODO(karlklose): for illegal nodes constructed for tests or unresolved | 158 // TODO(karlklose): for illegal nodes constructed for tests or unresolved |
| 159 // constructor calls in the DartBackend, we get an element with no enclosing | 159 // constructor calls in the DartBackend, we get an element with no enclosing |
| 160 // class. Clean this up by introducing a name field to the node and | 160 // class. Clean this up by introducing a name field to the node and |
| 161 // removing [ErroneousElement]s from the IR. | 161 // removing [ErroneousElement]s from the IR. |
| 162 if (node.type != null) { | 162 if (node.dartType != null) { |
| 163 className = node.type.toString(); | 163 className = node.dartType.toString(); |
| 164 } else { | 164 } else { |
| 165 className = node.target.enclosingClass.name; | 165 className = node.target.enclosingClass.name; |
| 166 } | 166 } |
| 167 String callName; | 167 String callName; |
| 168 if (node.target.name.isEmpty) { | 168 if (node.target.name.isEmpty) { |
| 169 callName = '${className}'; | 169 callName = '${className}'; |
| 170 } else { | 170 } else { |
| 171 callName = '${className}.${node.target.name}'; | 171 callName = '${className}.${node.target.name}'; |
| 172 } | 172 } |
| 173 String cont = access(node.continuation); | 173 String cont = access(node.continuation); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 | 225 |
| 226 String visitSetMutable(SetMutable node) { | 226 String visitSetMutable(SetMutable node) { |
| 227 String value = access(node.value); | 227 String value = access(node.value); |
| 228 return '(SetMutable ${access(node.variable)} $value)'; | 228 return '(SetMutable ${access(node.variable)} $value)'; |
| 229 } | 229 } |
| 230 | 230 |
| 231 String visitTypeCast(TypeCast node) { | 231 String visitTypeCast(TypeCast node) { |
| 232 String value = access(node.value); | 232 String value = access(node.value); |
| 233 String cont = access(node.continuation); | 233 String cont = access(node.continuation); |
| 234 String typeArguments = node.typeArguments.map(access).join(' '); | 234 String typeArguments = node.typeArguments.map(access).join(' '); |
| 235 return '$indentation(TypeCast $value ${node.type} ($typeArguments) $cont)'; | 235 return '$indentation(TypeCast $value ${node.dartType}' |
| 236 ' ($typeArguments) $cont)'; |
| 236 } | 237 } |
| 237 | 238 |
| 238 String visitTypeTest(TypeTest node) { | 239 String visitTypeTest(TypeTest node) { |
| 239 String value = access(node.value); | 240 String value = access(node.value); |
| 240 String typeArguments = node.typeArguments.map(access).join(' '); | 241 String typeArguments = node.typeArguments.map(access).join(' '); |
| 241 return '(TypeTest $value ${node.type} ($typeArguments))'; | 242 return '(TypeTest $value ${node.dartType} ($typeArguments))'; |
| 242 } | 243 } |
| 243 | 244 |
| 244 String visitLiteralList(LiteralList node) { | 245 String visitLiteralList(LiteralList node) { |
| 245 String values = node.values.map(access).join(' '); | 246 String values = node.values.map(access).join(' '); |
| 246 return '(LiteralList ($values))'; | 247 return '(LiteralList ($values))'; |
| 247 } | 248 } |
| 248 | 249 |
| 249 String visitLiteralMap(LiteralMap node) { | 250 String visitLiteralMap(LiteralMap node) { |
| 250 String keys = node.entries.map((e) => access(e.key)).join(' '); | 251 String keys = node.entries.map((e) => access(e.key)).join(' '); |
| 251 String values = node.entries.map((e) => access(e.value)).join(' '); | 252 String values = node.entries.map((e) => access(e.value)).join(' '); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 void setReturnContinuation(Continuation node) { | 475 void setReturnContinuation(Continuation node) { |
| 475 assert(!_names.containsKey(node) || _names[node] == 'return'); | 476 assert(!_names.containsKey(node) || _names[node] == 'return'); |
| 476 _names[node] = 'return'; | 477 _names[node] = 'return'; |
| 477 } | 478 } |
| 478 | 479 |
| 479 String getName(Node node) { | 480 String getName(Node node) { |
| 480 if (!_names.containsKey(node)) return 'MISSING_NAME'; | 481 if (!_names.containsKey(node)) return 'MISSING_NAME'; |
| 481 return _names[node]; | 482 return _names[node]; |
| 482 } | 483 } |
| 483 } | 484 } |
| OLD | NEW |