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

Unified Diff: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart

Issue 1637843002: typeInformation in CreateInstance is a kind of TypeExpression (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
diff --git a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
index aaf7baf8e48ad7012daff9dc7b3365697c78826a..08ea8bac0c1e070ade74d32e89f754e473115942 100644
--- a/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
+++ b/pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart
@@ -1446,15 +1446,17 @@ class CreateInstance extends Primitive {
/// May be `null` to indicate that no type information is needed because the
/// compiler determined that the type information for instances of this class
/// is not needed at runtime.
- final List<Reference<Primitive>> typeInformation;
+ final Reference<Primitive> typeInformation;
final SourceInformation sourceInformation;
CreateInstance(this.classElement, List<Primitive> arguments,
- List<Primitive> typeInformation,
+ Primitive typeInformation,
this.sourceInformation)
: this.arguments = _referenceList(arguments),
- this.typeInformation = _referenceList(typeInformation);
+ this.typeInformation = typeInformation == null
+ ? null
+ : new Reference<Primitive>(typeInformation);
accept(Visitor visitor) => visitor.visitCreateInstance(this);
@@ -1466,7 +1468,7 @@ class CreateInstance extends Primitive {
void setParentPointers() {
_setParentsOnList(arguments, this);
- if (typeInformation != null) _setParentsOnList(typeInformation, this);
+ if (typeInformation != null) typeInformation.parent = this;
}
}
@@ -1755,9 +1757,11 @@ class ReadTypeVariable extends Primitive {
class TypeExpression extends Primitive {
final DartType dartType;
final List<Reference<Primitive>> arguments;
+ final bool isForInstance; // Expression on instance has 'headless' form.
asgerf 2016/01/26 10:30:00 The name and comment are obscure without more deta
sra1 2016/01/26 22:21:08 It is flat because the dartType is always the 'thi
asgerf 2016/01/27 14:53:26 CreateInstance is not always going to create the '
sra1 2016/01/27 19:20:03 After inlining, the TypeExpression(INSTANCE) will
TypeExpression(this.dartType,
- [List<Primitive> arguments = const <Primitive>[]])
+ List<Primitive> arguments,
+ this.isForInstance)
: this.arguments = _referenceList(arguments);
@override
@@ -2147,7 +2151,7 @@ class DeepRecursiveVisitor implements Visitor {
visitCreateInstance(CreateInstance node) {
processCreateInstance(node);
node.arguments.forEach(processReference);
- node.typeInformation.forEach(processReference);
+ if (node.typeInformation != null) processReference(node.typeInformation);
}
processSetField(SetField node) {}
@@ -2559,8 +2563,10 @@ class DefinitionCopyingVisitor extends Visitor<Definition> {
}
Definition visitCreateInstance(CreateInstance node) {
- return new CreateInstance(node.classElement, getList(node.arguments),
- getList(node.typeInformation),
+ return new CreateInstance(
+ node.classElement,
+ getList(node.arguments),
+ node.typeInformation == null ? null : getCopy(node.typeInformation),
node.sourceInformation);
}
@@ -2582,7 +2588,8 @@ class DefinitionCopyingVisitor extends Visitor<Definition> {
}
Definition visitTypeExpression(TypeExpression node) {
- return new TypeExpression(node.dartType, getList(node.arguments));
+ return new TypeExpression(
+ node.dartType, getList(node.arguments), node.isForInstance);
}
Definition visitCreateInvocationMirror(CreateInvocationMirror node) {

Powered by Google App Engine
This is Rietveld 408576698