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

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

Issue 2856123002: Add flag to track if a constructor is the synthetic default constructor. (Closed)
Patch Set: Created 3 years, 8 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/analyzer/lib/src/kernel/loader.dart ('k') | pkg/kernel/lib/text/ast_to_text.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 daa5427e83ab2e3d8af16aec6b0c292b3b547747..fa2d18086786c490994e0d73ab078909a8e60dbc 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -938,6 +938,7 @@ class Constructor extends Member {
{Name name,
bool isConst: false,
bool isExternal: false,
+ bool isSyntheticDefault: false,
List<Initializer> initializers,
int transformerFlags: 0,
Reference reference})
@@ -947,15 +948,21 @@ class Constructor extends Member {
setParents(this.initializers, this);
this.isConst = isConst;
this.isExternal = isExternal;
+ this.isSyntheticDefault = isSyntheticDefault;
this.transformerFlags = transformerFlags;
}
static const int FlagConst = 1 << 0; // Must match serialized bit positions.
static const int FlagExternal = 1 << 1;
+ static const int FlagSyntheticDefault = 1 << 2;
bool get isConst => flags & FlagConst != 0;
bool get isExternal => flags & FlagExternal != 0;
+ /// True if this is a synthetic default constructor inserted in a class that
+ /// does not otherwise declare any constructors.
+ bool get isSyntheticDefault => flags & FlagSyntheticDefault != 0;
+
void set isConst(bool value) {
flags = value ? (flags | FlagConst) : (flags & ~FlagConst);
}
@@ -964,6 +971,12 @@ class Constructor extends Member {
flags = value ? (flags | FlagExternal) : (flags & ~FlagExternal);
}
+ void set isSyntheticDefault(bool value) {
+ flags = value
+ ? (flags | FlagSyntheticDefault)
+ : (flags & ~FlagSyntheticDefault);
+ }
+
bool get isInstanceMember => false;
bool get hasGetter => false;
bool get hasSetter => false;
« no previous file with comments | « pkg/analyzer/lib/src/kernel/loader.dart ('k') | pkg/kernel/lib/text/ast_to_text.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698