[kernel] Add flag on Procedures for forwarding semi stubs.

Change-Id: I6e39557e9ed2e636a8f43e8835ae797e3fd8b0c2
Reviewed-on: https://dart-review.googlesource.com/29721
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
This commit is contained in:
Samir Jindel 2017-12-17 04:12:15 +00:00 committed by commit-bot@chromium.org
parent 31a0fe292d
commit 075720c352
4 changed files with 17 additions and 2 deletions

View file

@ -349,7 +349,7 @@ type Procedure extends Member {
FileOffset fileEndOffset;
Byte kind; // Index into the ProcedureKind enum above.
Byte flags (isStatic, isAbstract, isExternal, isConst, isForwardingStub,
isGenericContravariant);
isGenericContravariant, isForwardingSemiStub);
Name name;
// An absolute path URI to the .dart file from which the class was created.
UriReference fileUri;

View file

@ -1496,6 +1496,7 @@ class Procedure extends Member implements FileUriNode {
bool isExternal: false,
bool isConst: false,
bool isForwardingStub: false,
bool isForwardingSemiStub: false,
int transformerFlags: 0,
this.fileUri,
Reference reference})
@ -1515,6 +1516,7 @@ class Procedure extends Member implements FileUriNode {
static const int FlagConst = 1 << 3; // Only for external const factories.
static const int FlagForwardingStub = 1 << 4;
static const int FlagGenericContravariant = 1 << 5;
static const int FlagForwardingSemiStub = 1 << 6;
bool get isStatic => flags & FlagStatic != 0;
bool get isAbstract => flags & FlagAbstract != 0;
@ -1534,6 +1536,10 @@ class Procedure extends Member implements FileUriNode {
/// front end computational overhead.
bool get isGenericContravariant => flags & FlagGenericContravariant != 0;
/// If set, this flag indicates that although this function is a forwarding
/// stub, it was present in the original source as an abstract method.
bool get isForwardingSemiStub => flags & FlagForwardingSemiStub != 0;
void set isStatic(bool value) {
flags = value ? (flags | FlagStatic) : (flags & ~FlagStatic);
}
@ -1561,6 +1567,12 @@ class Procedure extends Member implements FileUriNode {
: (flags & ~FlagGenericContravariant);
}
void set isForwardingSemiStub(bool value) {
flags = value
? (flags | FlagForwardingSemiStub)
: (flags & ~FlagForwardingSemiStub);
}
bool get isInstanceMember => !isStatic;
bool get isGetter => kind == ProcedureKind.Getter;
bool get isSetter => kind == ProcedureKind.Setter;

View file

@ -401,9 +401,11 @@ class CloneVisitor extends TreeVisitor {
isExternal: node.isExternal,
isConst: node.isConst,
isForwardingStub: node.isForwardingStub,
isForwardingSemiStub: node.isForwardingSemiStub,
transformerFlags: node.transformerFlags,
fileUri: node.fileUri)
..fileEndOffset = node.fileEndOffset;
..fileEndOffset = node.fileEndOffset
..isGenericContravariant = node.isGenericContravariant;
}
visitField(Field node) {

View file

@ -904,6 +904,7 @@ class Printer extends Visitor<Null> {
writeModifier(node.isStatic, 'static');
writeModifier(node.isAbstract, 'abstract');
writeModifier(node.isForwardingStub, 'forwarding-stub');
writeModifier(node.isForwardingSemiStub, 'forwarding-semi-stub');
writeModifier(node.isGenericContravariant, 'generic-contravariant');
writeWord(procedureKindToString(node.kind));
if ((node.enclosingClass == null &&