[cfe] Add FileUriConstantExpression

This adds FileUriConstantExpression, a subclass of ConstantExpression, to support correct file offset of annotations for augmentations and patches.
The FileUriExpression is used to carry the file uri of the expression
before constant evaluation.

TEST=general/patch_annotations

Change-Id: I0dc8a0cb97dd530fd1960785d38c2d5e4883c3dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311660
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Johnni Winther
2023-06-28 07:52:09 +00:00
committed by Commit Queue
parent cfd4200c85
commit 0c8ded72dc
120 changed files with 816 additions and 257 deletions
+9 -1
View File
@@ -147,7 +147,7 @@ type CanonicalName {
type ComponentFile {
UInt32 magic = 0x90ABCDEF;
UInt32 formatVersion = 105;
UInt32 formatVersion = 106;
Byte[10] shortSdkHash;
List<String> problemsAsJson; // Described in problems.md.
Library[] libraries;
@@ -1192,6 +1192,14 @@ type ConstantExpression extends Expression {
ConstantReference constantReference;
}
type FileUriConstantExpression extends Expression {
Byte tag = 108;
FileOffset fileOffset;
UriReference fileUri;
DartType type;
ConstantReference constantReference;
}
abstract type Constant extends Node {
Byte tag;
}