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

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

Issue 1161683002: dart2js cps: 'is' checks on types with type arguments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Status file Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // IrNodes are kept in a separate library to have precise control over their 5 // IrNodes are kept in a separate library to have precise control over their
6 // dependencies on other parts of the system. 6 // dependencies on other parts of the system.
7 library dart2js.ir_nodes; 7 library dart2js.ir_nodes;
8 8
9 import '../constants/expressions.dart'; 9 import '../constants/expressions.dart';
10 import '../constants/values.dart' as values show ConstantValue; 10 import '../constants/values.dart' as values show ConstantValue;
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 396
397 accept(Visitor visitor) => visitor.visitInvokeConstructor(this); 397 accept(Visitor visitor) => visitor.visitInvokeConstructor(this);
398 } 398 }
399 399
400 /// "as" casts and "is" checks. 400 /// "as" casts and "is" checks.
401 // We might want to turn "is"-checks into a [Primitive] as it can never diverge. 401 // We might want to turn "is"-checks into a [Primitive] as it can never diverge.
402 // But then we need to special-case for is-checks with an erroneous .type as 402 // But then we need to special-case for is-checks with an erroneous .type as
403 // these will throw. 403 // these will throw.
404 class TypeOperator extends Expression { 404 class TypeOperator extends Expression {
405 Reference<Primitive> receiver; 405 Reference<Primitive> value;
406 final DartType type; 406 final DartType type;
407 /// Type arguments to [type]. Since [type] may reference type variables in the
408 /// enclosing class, these are not constant.
409 final List<Reference<Primitive>> typeArguments;
407 final Reference<Continuation> continuation; 410 final Reference<Continuation> continuation;
408 // TODO(johnniwinther): Use `Operator` class to encapsule the operator type. 411 // TODO(johnniwinther): Use `Operator` class to encapsule the operator type.
409 final bool isTypeTest; 412 final bool isTypeTest;
410 413
411 TypeOperator(Primitive receiver, 414 TypeOperator(Primitive value,
412 this.type, 415 this.type,
416 List<Primitive> typeArguments,
413 Continuation cont, 417 Continuation cont,
414 {bool this.isTypeTest}) 418 {bool this.isTypeTest})
415 : this.receiver = new Reference<Primitive>(receiver), 419 : this.value = new Reference<Primitive>(value),
420 this.typeArguments = _referenceList(typeArguments),
416 this.continuation = new Reference<Continuation>(cont) { 421 this.continuation = new Reference<Continuation>(cont) {
417 assert(isTypeTest != null); 422 assert(isTypeTest != null);
418 } 423 }
419 424
420 bool get isTypeCast => !isTypeTest; 425 bool get isTypeCast => !isTypeTest;
421 426
422 accept(Visitor visitor) => visitor.visitTypeOperator(this); 427 accept(Visitor visitor) => visitor.visitTypeOperator(this);
423 } 428 }
424 429
425 /// Invoke [toString] on each argument and concatenate the results. 430 /// Invoke [toString] on each argument and concatenate the results.
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 processBranch(node); 1242 processBranch(node);
1238 processReference(node.trueContinuation); 1243 processReference(node.trueContinuation);
1239 processReference(node.falseContinuation); 1244 processReference(node.falseContinuation);
1240 visit(node.condition); 1245 visit(node.condition);
1241 } 1246 }
1242 1247
1243 processTypeOperator(TypeOperator node) {} 1248 processTypeOperator(TypeOperator node) {}
1244 visitTypeOperator(TypeOperator node) { 1249 visitTypeOperator(TypeOperator node) {
1245 processTypeOperator(node); 1250 processTypeOperator(node);
1246 processReference(node.continuation); 1251 processReference(node.continuation);
1247 processReference(node.receiver); 1252 processReference(node.value);
1253 node.typeArguments.forEach(processReference);
1248 } 1254 }
1249 1255
1250 processSetMutableVariable(SetMutableVariable node) {} 1256 processSetMutableVariable(SetMutableVariable node) {}
1251 visitSetMutableVariable(SetMutableVariable node) { 1257 visitSetMutableVariable(SetMutableVariable node) {
1252 processSetMutableVariable(node); 1258 processSetMutableVariable(node);
1253 processReference(node.variable); 1259 processReference(node.variable);
1254 processReference(node.value); 1260 processReference(node.value);
1255 visit(node.body); 1261 visit(node.body);
1256 } 1262 }
1257 1263
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 processNonTailThrow(node); 1414 processNonTailThrow(node);
1409 processReference(node.value); 1415 processReference(node.value);
1410 } 1416 }
1411 1417
1412 processCreateInvocationMirror(CreateInvocationMirror node) {} 1418 processCreateInvocationMirror(CreateInvocationMirror node) {}
1413 visitCreateInvocationMirror(CreateInvocationMirror node) { 1419 visitCreateInvocationMirror(CreateInvocationMirror node) {
1414 processCreateInvocationMirror(node); 1420 processCreateInvocationMirror(node);
1415 node.arguments.forEach(processReference); 1421 node.arguments.forEach(processReference);
1416 } 1422 }
1417 } 1423 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698