mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:58:29 +00:00
Add fileEndOffset to Class.
R=ahe@google.com, kmillikin@google.com, paulberry@google.com, sigmund@google.com BUG= Review-Url: https://codereview.chromium.org/2971903006 .
This commit is contained in:
parent
2c33abdca9
commit
09a5d31ec4
|
@ -223,6 +223,7 @@ abstract type Class extends Node {
|
||||||
Byte tag = 2;
|
Byte tag = 2;
|
||||||
CanonicalNameReference canonicalName;
|
CanonicalNameReference canonicalName;
|
||||||
FileOffset fileOffset;
|
FileOffset fileOffset;
|
||||||
|
FileOffset fileEndOffset;
|
||||||
Byte flags (isAbstract, xx); // Where xx is index into ClassLevel
|
Byte flags (isAbstract, xx); // Where xx is index into ClassLevel
|
||||||
StringReference name;
|
StringReference name;
|
||||||
// An absolute path URI to the .dart file from which the class was created.
|
// An absolute path URI to the .dart file from which the class was created.
|
||||||
|
|
|
@ -585,6 +585,11 @@ enum ClassLevel {
|
||||||
/// rule directly, as doing so can obstruct transformations. It is possible to
|
/// rule directly, as doing so can obstruct transformations. It is possible to
|
||||||
/// transform a mixin application to become a regular class, and vice versa.
|
/// transform a mixin application to become a regular class, and vice versa.
|
||||||
class Class extends NamedNode {
|
class Class extends NamedNode {
|
||||||
|
/// End offset in the source file it comes from. Valid values are from 0 and
|
||||||
|
/// up, or -1 ([TreeNode.noOffset]) if the file end offset is not available
|
||||||
|
/// (this is the default if none is specifically set).
|
||||||
|
int fileEndOffset = TreeNode.noOffset;
|
||||||
|
|
||||||
/// Offset of the declaration, set and used when writing the binary.
|
/// Offset of the declaration, set and used when writing the binary.
|
||||||
int binaryOffset = -1;
|
int binaryOffset = -1;
|
||||||
|
|
||||||
|
|
|
@ -445,6 +445,7 @@ class BinaryBuilder {
|
||||||
node = new Class(reference: reference)..level = ClassLevel.Temporary;
|
node = new Class(reference: reference)..level = ClassLevel.Temporary;
|
||||||
}
|
}
|
||||||
node.fileOffset = readOffset();
|
node.fileOffset = readOffset();
|
||||||
|
node.fileEndOffset = readOffset();
|
||||||
int flags = readByte();
|
int flags = readByte();
|
||||||
node.isAbstract = flags & 0x1 != 0;
|
node.isAbstract = flags & 0x1 != 0;
|
||||||
int levelIndex = (flags >> 1) & 0x3;
|
int levelIndex = (flags >> 1) & 0x3;
|
||||||
|
|
|
@ -378,6 +378,7 @@ class BinaryPrinter extends Visitor {
|
||||||
writeByte(Tag.Class);
|
writeByte(Tag.Class);
|
||||||
writeCanonicalNameReference(getCanonicalNameOfClass(node));
|
writeCanonicalNameReference(getCanonicalNameOfClass(node));
|
||||||
writeOffset(node.fileOffset);
|
writeOffset(node.fileOffset);
|
||||||
|
writeOffset(node.fileEndOffset);
|
||||||
writeByte(flags);
|
writeByte(flags);
|
||||||
writeStringReference(node.name ?? '');
|
writeStringReference(node.name ?? '');
|
||||||
writeUriReference(node.fileUri ?? '');
|
writeUriReference(node.fileUri ?? '');
|
||||||
|
|
|
@ -1198,6 +1198,7 @@ class ClassHelper {
|
||||||
kStart, // tag.
|
kStart, // tag.
|
||||||
kCanonicalName,
|
kCanonicalName,
|
||||||
kPosition,
|
kPosition,
|
||||||
|
kEndPosition,
|
||||||
kIsAbstract,
|
kIsAbstract,
|
||||||
kNameIndex,
|
kNameIndex,
|
||||||
kSourceUriIndex,
|
kSourceUriIndex,
|
||||||
|
@ -1238,6 +1239,9 @@ class ClassHelper {
|
||||||
case kPosition:
|
case kPosition:
|
||||||
position_ = builder_->ReadPosition(false); // read position.
|
position_ = builder_->ReadPosition(false); // read position.
|
||||||
if (++next_read_ == field) return;
|
if (++next_read_ == field) return;
|
||||||
|
case kEndPosition:
|
||||||
|
end_position_ = builder_->ReadPosition(); // read end position.
|
||||||
|
if (++next_read_ == field) return;
|
||||||
case kIsAbstract:
|
case kIsAbstract:
|
||||||
is_abstract_ = builder_->ReadBool(); // read is_abstract.
|
is_abstract_ = builder_->ReadBool(); // read is_abstract.
|
||||||
if (++next_read_ == field) return;
|
if (++next_read_ == field) return;
|
||||||
|
@ -1314,6 +1318,7 @@ class ClassHelper {
|
||||||
|
|
||||||
NameIndex canonical_name_;
|
NameIndex canonical_name_;
|
||||||
TokenPosition position_;
|
TokenPosition position_;
|
||||||
|
TokenPosition end_position_;
|
||||||
bool is_abstract_;
|
bool is_abstract_;
|
||||||
StringIndex name_index_;
|
StringIndex name_index_;
|
||||||
intptr_t source_uri_index_;
|
intptr_t source_uri_index_;
|
||||||
|
|
Loading…
Reference in a new issue