Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart

Issue 1011403003: cps-ir: Set runtime type information for new objects that require it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 String visitInvokeMethodDirectly(InvokeMethodDirectly node) { 192 String visitInvokeMethodDirectly(InvokeMethodDirectly node) {
193 String receiver = access(node.receiver); 193 String receiver = access(node.receiver);
194 String name = node.selector.name; 194 String name = node.selector.name;
195 String cont = access(node.continuation); 195 String cont = access(node.continuation);
196 String args = formatArguments(node); 196 String args = formatArguments(node);
197 return '$indentation(InvokeMethodDirectly $receiver $name $args $cont)'; 197 return '$indentation(InvokeMethodDirectly $receiver $name $args $cont)';
198 } 198 }
199 199
200 String visitInvokeConstructor(InvokeConstructor node) { 200 String visitInvokeConstructor(InvokeConstructor node) {
201 String className;
202 // TODO(karlklose): for illegal nodes constructed for tests or unresolved
203 // cosntructor calls in the DartBackend, we get an element with no enclosing
204 // class. Clean this up by introducing a name field to the node and
205 // removing [ErroneousElement]s from the IR.
206 if (node.type != null) {
207 className = node.type.toString();
208 } else {
209 className = node.target.enclosingClass.name;
210 }
201 String callName; 211 String callName;
202 if (node.target.name.isEmpty) { 212 if (node.target.name.isEmpty) {
203 callName = '${node.type}'; 213 callName = '${className}';
204 } else { 214 } else {
205 callName = '${node.type}.${node.target.name}'; 215 callName = '${className}.${node.target.name}';
206 } 216 }
207 String cont = access(node.continuation); 217 String cont = access(node.continuation);
208 String args = formatArguments(node); 218 String args = formatArguments(node);
209 return '$indentation(InvokeConstructor $callName $args $cont)'; 219 String typeArguments = node.typeArguments.isEmpty ? ''
220 : ' <${node.typeArguments.map(access).join(', ')}>';
221 return '$indentation(InvokeConstructor $callName $args$typeArguments'
222 ' $cont)';
210 } 223 }
211 224
212 String visitConcatenateStrings(ConcatenateStrings node) { 225 String visitConcatenateStrings(ConcatenateStrings node) {
213 String cont = access(node.continuation); 226 String cont = access(node.continuation);
214 String args = node.arguments.map(access).join(' '); 227 String args = node.arguments.map(access).join(' ');
215 return '$indentation(ConcatenateStrings ($args) $cont)'; 228 return '$indentation(ConcatenateStrings ($args) $cont)';
216 } 229 }
217 230
218 String visitInvokeContinuation(InvokeContinuation node) { 231 String visitInvokeContinuation(InvokeContinuation node) {
219 String name = access(node.continuation); 232 String name = access(node.continuation);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 return '(Interceptor ${access(node.input)})'; 344 return '(Interceptor ${access(node.input)})';
332 } 345 }
333 346
334 String visitReifyRuntimeType(ReifyRuntimeType node) { 347 String visitReifyRuntimeType(ReifyRuntimeType node) {
335 return '(ReifyRuntimeType ${access(node.value)})'; 348 return '(ReifyRuntimeType ${access(node.value)})';
336 } 349 }
337 350
338 String visitReadTypeVariable(ReadTypeVariable node) { 351 String visitReadTypeVariable(ReadTypeVariable node) {
339 return '(ReadTypeVariable ${access(node.target)}.${node.variable})'; 352 return '(ReadTypeVariable ${access(node.target)}.${node.variable})';
340 } 353 }
354
355 @override
356 String visitTypeExpression(TypeExpression node) {
357 String args = node.arguments.map(access).join(', ');
358 return '(TypeExpression ${node.dartType.toString()} $args)';
asgerf 2015/03/18 10:18:06 Redundant toString call
359 }
341 } 360 }
342 361
343 class ConstantStringifier extends ConstantValueVisitor<String, Null> { 362 class ConstantStringifier extends ConstantValueVisitor<String, Null> {
344 // Some of these methods are unimplemented because we haven't had a need 363 // Some of these methods are unimplemented because we haven't had a need
345 // to print such constants. When printing is implemented, the corresponding 364 // to print such constants. When printing is implemented, the corresponding
346 // parsing support should be added to SExpressionUnstringifier.parseConstant 365 // parsing support should be added to SExpressionUnstringifier.parseConstant
347 // in the dart2js tests (currently in the file 366 // in the dart2js tests (currently in the file
348 // tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart). 367 // tests/compiler/dart2js/backend_dart/sexpr_unstringifier.dart).
349 368
350 String _failWith(ConstantValue constant) { 369 String _failWith(ConstantValue constant) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 void setReturnContinuation(Continuation node) { 459 void setReturnContinuation(Continuation node) {
441 assert(!_names.containsKey(node) || _names[node] == 'return'); 460 assert(!_names.containsKey(node) || _names[node] == 'return');
442 _names[node] = 'return'; 461 _names[node] = 'return';
443 } 462 }
444 463
445 String getName(Node node) { 464 String getName(Node node) {
446 assert(_names.containsKey(node)); 465 assert(_names.containsKey(node));
447 return _names[node]; 466 return _names[node];
448 } 467 }
449 } 468 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698