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

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

Issue 2983173002: Remember isFieldFormal informative flag in VariableDeclaration(s). (Closed)
Patch Set: Created 3 years, 5 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/lib/src/fasta/kernel/kernel_shadow_ast.dart ('k') | pkg/kernel/lib/clone.dart » ('j') | 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 94dc6ee0fcc853c03b6deb1069d6afed720d7dee..8236e0905a58bd512afb385fac9ba32b166114d3 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -3716,31 +3716,41 @@ class VariableDeclaration extends Statement {
{this.initializer,
this.type: const DynamicType(),
bool isFinal: false,
- bool isConst: false}) {
+ bool isConst: false,
+ bool isFieldFormal: false}) {
assert(type != null);
initializer?.parent = this;
this.isFinal = isFinal;
this.isConst = isConst;
+ this.isFieldFormal = isFieldFormal;
}
/// Creates a synthetic variable with the given expression as initializer.
VariableDeclaration.forValue(this.initializer,
{bool isFinal: true,
bool isConst: false,
+ bool isFieldFormal: false,
this.type: const DynamicType()}) {
assert(type != null);
initializer?.parent = this;
this.isFinal = isFinal;
this.isConst = isConst;
+ this.isFieldFormal = isFieldFormal;
}
static const int FlagFinal = 1 << 0; // Must match serialized bit positions.
static const int FlagConst = 1 << 1;
- static const int FlagInScope = 1 << 2; // Temporary flag used by verifier.
+ static const int FlagFieldFormal = 1 << 2;
+ static const int FlagInScope = 1 << 3; // Temporary flag used by verifier.
bool get isFinal => flags & FlagFinal != 0;
bool get isConst => flags & FlagConst != 0;
+ /// Whether the variable is declared as a field formal parameter of
+ /// a constructor.
+ @informative
+ bool get isFieldFormal => flags & FlagFieldFormal != 0;
+
void set isFinal(bool value) {
flags = value ? (flags | FlagFinal) : (flags & ~FlagFinal);
}
@@ -3749,6 +3759,11 @@ class VariableDeclaration extends Statement {
flags = value ? (flags | FlagConst) : (flags & ~FlagConst);
}
+ @informative
+ void set isFieldFormal(bool value) {
+ flags = value ? (flags | FlagFieldFormal) : (flags & ~FlagFieldFormal);
+ }
+
accept(StatementVisitor v) => v.visitVariableDeclaration(this);
accept1(StatementVisitor1 v, arg) => v.visitVariableDeclaration(this, arg);
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart ('k') | pkg/kernel/lib/clone.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698