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

Unified Diff: pkg/kernel/lib/ast.dart

Issue 2768533002: Fasta type inference prototype #2
Patch Set: Rework atop 415c868589d02e98eb839f48150f4203d5cecdb0 Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/test/fasta/testing.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/ast.dart
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 9d6d5cdd073424bf9d2999e6e6673af3d96dd8bc..297af4b5b8d2cdaa0a656539b92f53ec25bf8f5b 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -1429,7 +1429,10 @@ class VariableGet extends Expression {
VariableDeclaration variable;
DartType promotedType; // Null if not promoted.
- VariableGet(this.variable, [this.promotedType]);
+ VariableGet(VariableDeclaration variable, [DartType promotedType])
+ : this.forMixin(variable, promotedType);
+
+ VariableGet.forMixin(this.variable, this.promotedType);
DartType getStaticType(TypeEnvironment types) {
return promotedType ?? variable.type;
@@ -2530,8 +2533,11 @@ class ListLiteral extends Expression {
DartType typeArgument; // Not null, defaults to DynamicType.
final List<Expression> expressions;
- ListLiteral(this.expressions,
- {this.typeArgument: const DynamicType(), this.isConst: false}) {
+ ListLiteral(List<Expression> expressions,
+ {DartType typeArgument: const DynamicType(), bool isConst: false})
+ : this.forMixin(expressions, typeArgument, isConst);
+
+ ListLiteral.forMixin(this.expressions, this.typeArgument, this.isConst) {
assert(typeArgument != null);
setParents(expressions, this);
}
@@ -3172,7 +3178,9 @@ class IfStatement extends Statement {
class ReturnStatement extends Statement {
Expression expression; // May be null.
- ReturnStatement([this.expression]) {
+ ReturnStatement([Expression expression]) : this.forMixin(expression);
+
+ ReturnStatement.forMixin(this.expression) {
expression?.parent = this;
}
@@ -3361,12 +3369,16 @@ class VariableDeclaration extends Statement {
/// Should be null in other cases.
Expression initializer; // May be null.
- VariableDeclaration(this.name,
- {this.initializer,
- this.type: const DynamicType(),
- this.inferredValue,
+ VariableDeclaration(String name,
+ {Expression initializer,
+ DartType type: const DynamicType(),
+ InferredValue inferredValue,
bool isFinal: false,
- bool isConst: false}) {
+ bool isConst: false})
+ : this.forMixin(name, initializer, type, inferredValue, isFinal, isConst);
+
+ VariableDeclaration.forMixin(this.name, this.initializer, this.type,
+ this.inferredValue, bool isFinal, bool isConst) {
assert(type != null);
initializer?.parent = this;
this.isFinal = isFinal;
« no previous file with comments | « pkg/front_end/test/fasta/testing.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698