2016-04-26 08:39:15 +00:00
|
|
|
This file describes the binary format of Dart Kernel.
|
|
|
|
|
|
|
|
Notation
|
|
|
|
--------
|
|
|
|
Bitmasks are described with the syntax:
|
|
|
|
```scala
|
|
|
|
Byte flags (flag1, flag2, ..., flagN)
|
|
|
|
```
|
|
|
|
where 'flag<N>' is the N-th least significant bit,
|
|
|
|
(so flag1 is the least significant bit).
|
|
|
|
|
|
|
|
Bytes with tagging bits are described with the syntax:
|
|
|
|
```scala
|
|
|
|
Byte byte (10xxxxxx)
|
|
|
|
```
|
|
|
|
where the x'es represent the bit positions to be extracted from the
|
|
|
|
byte and the 0'es and 1'es the bits used for tagging. The leftmost bit
|
|
|
|
is the most significant.
|
|
|
|
|
|
|
|
Binary format
|
|
|
|
-------------
|
|
|
|
```scala
|
|
|
|
type Byte = a byte
|
|
|
|
|
|
|
|
abstract type UInt {}
|
|
|
|
|
|
|
|
type UInt7 extends UInt {
|
|
|
|
Byte byte1(0xxxxxxx);
|
|
|
|
}
|
|
|
|
|
|
|
|
type UInt14 extends UInt {
|
|
|
|
Byte byte1(10xxxxxx); // most significant byte, discard the high bit
|
|
|
|
Byte byte2(xxxxxxxx); // least signficant byte
|
|
|
|
}
|
|
|
|
|
|
|
|
type UInt30 extends UInt {
|
|
|
|
Byte byte1(11xxxxxx); // most significant byte, discard the two high bits.
|
|
|
|
Byte byte2(xxxxxxxx);
|
|
|
|
Byte byte3(xxxxxxxx);
|
|
|
|
Byte byte4(xxxxxxxx); // least significant byte
|
|
|
|
}
|
|
|
|
|
|
|
|
type MagicWord = big endian 32-bit unsigned integer
|
|
|
|
|
2016-11-30 11:26:03 +00:00
|
|
|
type List<T> {
|
|
|
|
UInt length;
|
|
|
|
T[length] items;
|
|
|
|
}
|
2017-04-04 11:04:11 +00:00
|
|
|
```
|
2016-11-30 11:26:03 +00:00
|
|
|
|
2017-04-04 11:04:11 +00:00
|
|
|
A string table consists of an array of end offsets and a payload array of
|
|
|
|
strings encoded as UTF-8. The array of end offsets maps a string index to the
|
|
|
|
offset of the _next_ string in the table or the offset of the end of the array
|
|
|
|
for the last string. These offsets are relative to the string payload array.
|
|
|
|
Thus, string number 0 consists of the UTF-8 encoded string stretching from
|
|
|
|
offset 0 (inclusive) to endOffset[0] (exclusive); and string number N for N > 0
|
|
|
|
consists of the UTF-8 encoded string stretching from offset endOffset[N-1]
|
|
|
|
(inclusive) to endOffset[N] (exclusive).
|
2016-04-26 08:39:15 +00:00
|
|
|
|
2017-04-04 11:04:11 +00:00
|
|
|
``` scala
|
2016-04-26 08:39:15 +00:00
|
|
|
type StringTable {
|
2017-04-04 11:04:11 +00:00
|
|
|
List<UInt> endOffsets;
|
|
|
|
Byte[endOffsets.last] utf8Bytes;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type StringReference {
|
2017-04-04 11:04:11 +00:00
|
|
|
UInt index; // Index into the Program's .strings.
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
2017-01-03 13:33:16 +00:00
|
|
|
type Source {
|
2017-04-04 11:04:11 +00:00
|
|
|
List<Byte> utf8Bytes;
|
2016-11-30 11:26:03 +00:00
|
|
|
// Line starts are delta-encoded (they are encoded as line lengths). The list
|
|
|
|
// [0, 10, 25, 32, 42] is encoded as [0, 10, 15, 7, 10].
|
|
|
|
List<Uint> lineStarts;
|
2016-09-29 09:26:40 +00:00
|
|
|
}
|
|
|
|
|
2017-01-03 13:33:16 +00:00
|
|
|
type UriSource {
|
2017-04-04 11:04:11 +00:00
|
|
|
StringTable uris;
|
|
|
|
Source[uris.endOffsets.length] source;
|
2016-09-29 09:26:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type UriReference {
|
2017-01-03 13:33:16 +00:00
|
|
|
UInt index; // Index into the UriSource uris.
|
2016-09-29 09:26:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type FileOffset {
|
2016-11-30 11:26:03 +00:00
|
|
|
// Encoded as offset + 1 to accommodate -1 indicating no offset.
|
2016-09-29 09:26:40 +00:00
|
|
|
UInt fileOffset;
|
|
|
|
}
|
|
|
|
|
2016-04-26 08:39:15 +00:00
|
|
|
type Option<T> {
|
|
|
|
Byte tag;
|
|
|
|
}
|
|
|
|
type Nothing extends Option<T> {
|
|
|
|
Byte tag = 0;
|
|
|
|
}
|
|
|
|
type Something<T> extends Option<T> {
|
|
|
|
Byte tag = 1;
|
|
|
|
T value;
|
|
|
|
}
|
|
|
|
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
type CanonicalNameReference {
|
|
|
|
UInt biasedIndex; // 0 if null, otherwise N+1 where N is index of parent
|
|
|
|
}
|
|
|
|
|
|
|
|
type CanonicalName {
|
|
|
|
CanonicalNameReference parent;
|
|
|
|
StringReference name;
|
|
|
|
}
|
|
|
|
|
2016-04-26 08:39:15 +00:00
|
|
|
type ProgramFile {
|
|
|
|
MagicWord magic = 0x90ABCDEF;
|
|
|
|
StringTable strings;
|
2017-01-03 13:33:16 +00:00
|
|
|
UriSource sourceMap;
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
List<CanonicalName> canonicalNames;
|
2016-11-30 11:26:03 +00:00
|
|
|
List<Library> libraries;
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
ProcedureReference mainMethod;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type LibraryReference {
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
// Must be populated by a library (possibly later in the file).
|
|
|
|
CanonicalNameReference canonicalName;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
type ClassReference {
|
|
|
|
// Must be populated by a class (possibly later in the file).
|
|
|
|
CanonicalNameReference canonicalName;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
type MemberReference {
|
|
|
|
// Must be populated by a member (possibly later in the file).
|
|
|
|
CanonicalNameReference canonicalName;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
type FieldReference {
|
|
|
|
// Must be populated by a field (possibly later in the file).
|
|
|
|
CanonicalNameReference canonicalName;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
type ConstructorReference {
|
|
|
|
// Must be populated by a constructor (possibly later in the file).
|
|
|
|
CanonicalNameReference canonicalName;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
type ProcedureReference {
|
|
|
|
// Must be populated by a procedure (possibly later in the file).
|
|
|
|
CanonicalNameReference canonicalName;
|
2016-09-06 09:40:13 +00:00
|
|
|
}
|
|
|
|
|
2016-04-26 08:39:15 +00:00
|
|
|
type Name {
|
|
|
|
StringReference name;
|
|
|
|
if name begins with '_' {
|
|
|
|
LibraryReference library;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type Library {
|
[kernel] Refactor frontend to allow modular compilation.
The concept of a binary library file no longer exists.
A kernel file can contain any number of libraries, and some of these
libraries can be "external". To reference a class or member from
another build, the class or member must be declared in an external
library.
Members in an external library contain all their type information,
but have no body.
Classes in an external library have their hierarchy information
present, but are not guaranteed to contain all their actual members.
The idea is that references themselves don't really cross module
boundaries, but rather refer to a local definition whose body is
contributed from elsewhere, much like 'external' members in Dart.
A modular backend such as DDC should be able to compile from one of
these kernel files without needing to load auxiliary information from
summaries or other kernel files.
For whole program transformations or backends, a linking step, which
is not yet implemented, must merge classes and members in external
libraries based on their name.
External libraries share the same IR and binary format as ordinary
libraries. Transformations that affect the interface for a member
or class should transform the external libraries alongside with the
internal ones, ideally without needing to treat them any different.
R=kmillikin@google.com
Review URL: https://chromereviews.googleplex.com/516847013 .
2016-10-04 11:30:46 +00:00
|
|
|
Byte flags (isExternal);
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
CanonicalNameReference canonicalName;
|
2016-04-26 08:39:15 +00:00
|
|
|
StringReference name;
|
2016-09-29 09:26:40 +00:00
|
|
|
// An absolute path URI to the .dart file from which the library was created.
|
|
|
|
UriReference fileUri;
|
2017-02-13 13:31:24 +00:00
|
|
|
List<DeferredImport> deferredImports;
|
2016-04-26 08:39:15 +00:00
|
|
|
List<Class> classes;
|
|
|
|
List<Field> fields;
|
|
|
|
List<Procedure> procedures;
|
|
|
|
}
|
|
|
|
|
2017-02-13 13:31:24 +00:00
|
|
|
type DeferredImport {
|
|
|
|
LibraryReference importedLibrary;
|
|
|
|
StringReference name;
|
|
|
|
}
|
|
|
|
|
|
|
|
type DeferredImportReference {
|
|
|
|
// Index into deferredImports in the enclosing Library.
|
|
|
|
UInt index;
|
|
|
|
}
|
|
|
|
|
2016-04-26 08:39:15 +00:00
|
|
|
abstract type Node {
|
|
|
|
Byte tag;
|
|
|
|
}
|
|
|
|
|
2017-02-13 13:20:04 +00:00
|
|
|
enum ClassLevel { Type = 0, Hierarchy = 1, Mixin = 2, Body = 3, }
|
|
|
|
|
[kernel] Refactor frontend to allow modular compilation.
The concept of a binary library file no longer exists.
A kernel file can contain any number of libraries, and some of these
libraries can be "external". To reference a class or member from
another build, the class or member must be declared in an external
library.
Members in an external library contain all their type information,
but have no body.
Classes in an external library have their hierarchy information
present, but are not guaranteed to contain all their actual members.
The idea is that references themselves don't really cross module
boundaries, but rather refer to a local definition whose body is
contributed from elsewhere, much like 'external' members in Dart.
A modular backend such as DDC should be able to compile from one of
these kernel files without needing to load auxiliary information from
summaries or other kernel files.
For whole program transformations or backends, a linking step, which
is not yet implemented, must merge classes and members in external
libraries based on their name.
External libraries share the same IR and binary format as ordinary
libraries. Transformations that affect the interface for a member
or class should transform the external libraries alongside with the
internal ones, ideally without needing to treat them any different.
R=kmillikin@google.com
Review URL: https://chromereviews.googleplex.com/516847013 .
2016-10-04 11:30:46 +00:00
|
|
|
// A class can be represented at one of three levels: type, hierarchy, or body.
|
|
|
|
//
|
|
|
|
// If the enclosing library is external, a class is either at type or
|
|
|
|
// hierarchy level, depending on its isTypeLevel flag.
|
|
|
|
// If the enclosing library is not external, a class is always at body level.
|
|
|
|
//
|
|
|
|
// See ClassLevel in ast.dart for the details of each loading level.
|
|
|
|
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
abstract type Class extends Node {
|
2016-04-26 08:39:15 +00:00
|
|
|
Byte tag = 2;
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
CanonicalNameReference canonicalName;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2017-02-13 13:20:04 +00:00
|
|
|
Byte flags (isAbstract, xx); // Where xx is index into ClassLevel
|
2016-04-26 08:39:15 +00:00
|
|
|
StringReference name;
|
2016-09-29 09:26:40 +00:00
|
|
|
// An absolute path URI to the .dart file from which the class was created.
|
|
|
|
UriReference fileUri;
|
2016-08-09 14:32:23 +00:00
|
|
|
List<Expression> annotations;
|
2016-04-26 08:39:15 +00:00
|
|
|
List<TypeParameter> typeParameters;
|
|
|
|
Option<InterfaceType> superClass;
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
Option<InterfaceType> mixedInType;
|
2016-04-26 08:39:15 +00:00
|
|
|
List<InterfaceType> implementedClasses;
|
|
|
|
List<Field> fields;
|
|
|
|
List<Constructor> constructors;
|
|
|
|
List<Procedure> procedures;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract type Member extends Node {}
|
|
|
|
|
|
|
|
type Field extends Member {
|
|
|
|
Byte tag = 4;
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
CanonicalNameReference canonicalName;
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileEndOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Byte flags (isFinal, isConst, isStatic);
|
|
|
|
Name name;
|
2016-09-29 09:26:40 +00:00
|
|
|
// An absolute path URI to the .dart file from which the field was created.
|
|
|
|
UriReference fileUri;
|
2016-08-09 14:32:23 +00:00
|
|
|
List<Expression> annotations;
|
2016-04-26 08:39:15 +00:00
|
|
|
DartType type;
|
|
|
|
Option<Expression> initializer;
|
|
|
|
}
|
|
|
|
|
|
|
|
type Constructor extends Member {
|
|
|
|
Byte tag = 5;
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
CanonicalNameReference canonicalName;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
|
|
|
FileOffset fileEndOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Byte flags (isConst, isExternal);
|
|
|
|
Name name;
|
2016-08-09 14:32:23 +00:00
|
|
|
List<Expression> annotations;
|
2016-04-26 08:39:15 +00:00
|
|
|
FunctionNode function;
|
|
|
|
List<Initializer> initializers;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
enum ProcedureKind {
|
|
|
|
Method,
|
|
|
|
Getter,
|
|
|
|
Setter,
|
|
|
|
Operator,
|
|
|
|
Factory,
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
type Procedure extends Member {
|
|
|
|
Byte tag = 6;
|
Implement canonical name scheme in kernel.
This adds a class CanonicalName that can represent a library, class,
or member. All references now go through a Reference object, which is
linked to both the AST node and its CanonicalName, so either can be
created first.
dartk now accepts multiple input files:
- If multiple dart files are given, they are all compiled.
- If multiple binaries are given, they are linked together.
Mixed dart and binary input is not supported by dartk.
dartk now has a flag --include-sdk which includes the entire SDK in
the output. This is so the SDK can be compiled alone and then linked.
Example of compiling separately and then linking:
dartk foo.dart -o foo.dill
dartk main.dart -o main.dill
dartk --include-sdk -o sdk.dill
dartk main.dill foo.dill sdk.dill --target=vm --link -o program.dill
dartk still has incredibly slow cold start due to the analyzer loading
the dart sdk, so this does not actually speed things up at the moment.
BUG=
R=ahe@google.com, kmillikin@google.com, kustermann@google.com, sigmund@google.com
Review-Url: https://codereview.chromium.org/2665723002 .
2017-02-23 13:12:10 +00:00
|
|
|
CanonicalNameReference canonicalName;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
|
|
|
FileOffset fileEndOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Byte kind; // Index into the ProcedureKind enum above.
|
2016-04-28 10:28:32 +00:00
|
|
|
Byte flags (isStatic, isAbstract, isExternal, isConst);
|
2016-04-26 08:39:15 +00:00
|
|
|
Name name;
|
2016-09-29 09:26:40 +00:00
|
|
|
// An absolute path URI to the .dart file from which the class was created.
|
|
|
|
UriReference fileUri;
|
2016-08-09 14:32:23 +00:00
|
|
|
List<Expression> annotations;
|
2016-04-26 08:39:15 +00:00
|
|
|
// Can only be absent if abstract, but tag is there anyway.
|
|
|
|
Option<FunctionNode> function;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract type Initializer extends Node {}
|
|
|
|
|
|
|
|
type InvalidInitializer extends Initializer {
|
|
|
|
Byte tag = 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
type FieldInitializer extends Initializer {
|
|
|
|
Byte tag = 8;
|
|
|
|
FieldReference field;
|
|
|
|
Expression value;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SuperInitializer extends Initializer {
|
|
|
|
Byte tag = 9;
|
|
|
|
ConstructorReference target;
|
|
|
|
Arguments arguments;
|
|
|
|
}
|
|
|
|
|
|
|
|
type RedirectingInitializer extends Initializer {
|
|
|
|
Byte tag = 10;
|
|
|
|
ConstructorReference target;
|
|
|
|
Arguments arguments;
|
|
|
|
}
|
|
|
|
|
2016-06-28 12:27:01 +00:00
|
|
|
type LocalInitializer extends Initializer {
|
|
|
|
Byte tag = 11;
|
|
|
|
VariableDeclaration variable;
|
|
|
|
}
|
|
|
|
|
2016-04-26 08:39:15 +00:00
|
|
|
/*
|
|
|
|
enum AsyncMarker {
|
|
|
|
Sync,
|
|
|
|
SyncStar,
|
|
|
|
Async,
|
2017-02-22 11:12:54 +00:00
|
|
|
AsyncStar,
|
|
|
|
SyncYielding
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
type FunctionNode {
|
|
|
|
// Note: there is no tag on FunctionNode.
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
|
|
|
FileOffset fileEndOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Byte asyncMarker; // Index into AsyncMarker above.
|
2017-02-22 11:12:54 +00:00
|
|
|
Byte dartAsyncMarker; // Index into AsyncMarker above.
|
2016-04-26 08:39:15 +00:00
|
|
|
List<TypeParameter> typeParameters;
|
|
|
|
UInt requiredParameterCount;
|
|
|
|
List<VariableDeclaration> positionalParameters;
|
|
|
|
List<VariableDeclaration> namedParameters;
|
2016-06-06 13:01:51 +00:00
|
|
|
DartType returnType;
|
2016-04-26 08:39:15 +00:00
|
|
|
Option<Statement> body;
|
|
|
|
}
|
|
|
|
|
|
|
|
type VariableReference {
|
|
|
|
// Reference to the Nth variable in scope, with 0 being the
|
|
|
|
// first variable declared in the outermost scope, and larger
|
|
|
|
// numbers being the variables declared later in a given scope,
|
|
|
|
// or in a more deeply nested scope.
|
|
|
|
//
|
|
|
|
// Function parameters are indexed from left to right and make
|
|
|
|
// up the outermost scope (enclosing the function body).
|
|
|
|
// Variables ARE NOT in scope inside their own initializer.
|
|
|
|
// Variables ARE NOT in scope before their declaration, in contrast
|
|
|
|
// to how the Dart Specification defines scoping.
|
|
|
|
// Variables ARE in scope across function boundaries.
|
|
|
|
//
|
|
|
|
// When declared, a variable remains in scope until the end of the
|
|
|
|
// immediately enclosing Block, Let, FunctionNode, ForStatement,
|
|
|
|
// ForInStatement, or Catch.
|
|
|
|
//
|
|
|
|
// A special exception is made for constructor parameters, which are
|
|
|
|
// also in scope in the initializer list, even though the tree nesting
|
|
|
|
// is inconsistent with the scoping.
|
|
|
|
UInt stackIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract type Expression extends Node {}
|
|
|
|
|
|
|
|
type InvalidExpression extends Expression {
|
|
|
|
Byte tag = 19;
|
|
|
|
}
|
|
|
|
|
|
|
|
type VariableGet extends Expression {
|
|
|
|
Byte tag = 20;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
VariableReference variable;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SpecializedVariableGet extends Expression {
|
|
|
|
Byte tag = 128 + N; // Where 0 <= N < 8.
|
|
|
|
// Equivalent to a VariableGet with index N.
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type VariableSet extends Expression {
|
|
|
|
Byte tag = 21;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
VariableReference variable;
|
|
|
|
Expression value;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SpecializedVariableSet extends Expression {
|
|
|
|
Byte tag = 136 + N; // Where 0 <= N < 8.
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Expression value;
|
|
|
|
// Equivalent to VariableSet with index N.
|
|
|
|
}
|
|
|
|
|
|
|
|
type PropertyGet extends Expression {
|
|
|
|
Byte tag = 22;
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Expression receiver;
|
|
|
|
Name name;
|
2016-09-06 09:40:13 +00:00
|
|
|
MemberReference interfaceTarget; // May be NullReference.
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type PropertySet extends Expression {
|
|
|
|
Byte tag = 23;
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Expression receiver;
|
|
|
|
Name name;
|
|
|
|
Expression value;
|
2016-09-06 09:40:13 +00:00
|
|
|
MemberReference interfaceTarget; // May be NullReference.
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type SuperPropertyGet extends Expression {
|
|
|
|
Byte tag = 24;
|
2016-08-24 14:46:50 +00:00
|
|
|
Name name;
|
2016-09-06 09:40:13 +00:00
|
|
|
MemberReference interfaceTarget; // May be NullReference.
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type SuperPropertySet extends Expression {
|
|
|
|
Byte tag = 25;
|
2016-08-24 14:46:50 +00:00
|
|
|
Name name;
|
|
|
|
Expression value;
|
2016-09-06 09:40:13 +00:00
|
|
|
MemberReference interfaceTarget; // May be NullReference.
|
2016-08-24 14:46:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type DirectPropertyGet extends Expression {
|
|
|
|
Byte tag = 15; // Note: tag is out of order
|
2017-03-21 13:43:45 +00:00
|
|
|
FileOffset fileOffset;
|
2016-08-24 14:46:50 +00:00
|
|
|
Expression receiver;
|
|
|
|
MemberReference target;
|
|
|
|
}
|
|
|
|
|
|
|
|
type DirectPropertySet extends Expression {
|
|
|
|
Byte tag = 16; // Note: tag is out of order
|
2017-03-21 13:43:45 +00:00
|
|
|
FileOffset fileOffset;
|
2016-08-24 14:46:50 +00:00
|
|
|
Expression receiver;
|
2016-04-26 08:39:15 +00:00
|
|
|
MemberReference target;
|
|
|
|
Expression value;
|
|
|
|
}
|
|
|
|
|
|
|
|
type StaticGet extends Expression {
|
|
|
|
Byte tag = 26;
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
MemberReference target;
|
|
|
|
}
|
|
|
|
|
|
|
|
type StaticSet extends Expression {
|
|
|
|
Byte tag = 27;
|
2017-03-07 08:43:59 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
MemberReference target;
|
|
|
|
Expression value;
|
|
|
|
}
|
|
|
|
|
|
|
|
type Arguments {
|
|
|
|
// Note: there is no tag on Arguments.
|
|
|
|
List<DartType> types;
|
|
|
|
List<Expression> positional;
|
|
|
|
List<NamedExpression> named;
|
|
|
|
}
|
|
|
|
|
|
|
|
type NamedExpression {
|
|
|
|
// Note: there is no tag on NamedExpression.
|
|
|
|
StringReference name;
|
|
|
|
Expression value;
|
|
|
|
}
|
|
|
|
|
|
|
|
type MethodInvocation extends Expression {
|
|
|
|
Byte tag = 28;
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Expression receiver;
|
|
|
|
Name name;
|
|
|
|
Arguments arguments;
|
2016-09-06 09:40:13 +00:00
|
|
|
MemberReference interfaceTarget; // May be NullReference.
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type SuperMethodInvocation extends Expression {
|
|
|
|
Byte tag = 29;
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2016-08-24 14:46:50 +00:00
|
|
|
Name name;
|
|
|
|
Arguments arguments;
|
2016-09-06 09:40:13 +00:00
|
|
|
MemberReference interfaceTarget; // May be NullReference.
|
2016-08-24 14:46:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type DirectMethodInvocation extends Expression {
|
|
|
|
Byte tag = 17; // Note: tag is out of order
|
|
|
|
Expression receiver;
|
2016-04-26 08:39:15 +00:00
|
|
|
MemberReference target;
|
|
|
|
Arguments arguments;
|
|
|
|
}
|
|
|
|
|
|
|
|
type StaticInvocation extends Expression {
|
|
|
|
Byte tag = 30;
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
MemberReference target;
|
|
|
|
Arguments arguments;
|
|
|
|
}
|
|
|
|
|
2016-04-28 10:58:42 +00:00
|
|
|
// Constant call to an external constant factory.
|
|
|
|
type ConstStaticInvocation extends Expression {
|
|
|
|
Byte tag = 18; // Note: tag is out of order.
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-28 10:58:42 +00:00
|
|
|
MemberReference target;
|
|
|
|
Arguments arguments;
|
|
|
|
}
|
|
|
|
|
2016-04-26 08:39:15 +00:00
|
|
|
type ConstructorInvocation extends Expression {
|
|
|
|
Byte tag = 31;
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
ConstructorReference target;
|
|
|
|
Arguments arguments;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ConstConstructorInvocation extends Expression {
|
|
|
|
Byte tag = 32;
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
ConstructorReference target;
|
|
|
|
Arguments arguments;
|
|
|
|
}
|
|
|
|
|
|
|
|
type Not extends Expression {
|
|
|
|
Byte tag = 33;
|
|
|
|
Expression operand;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2016-09-23 10:52:00 +00:00
|
|
|
enum LogicalOperator { &&, || }
|
2016-04-26 08:39:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
type LogicalExpression extends Expression {
|
|
|
|
Byte tag = 34;
|
|
|
|
Expression left;
|
|
|
|
Byte operator; // Index into LogicalOperator enum above
|
|
|
|
Expression right;
|
2016-09-08 13:53:07 +00:00
|
|
|
Option<DartType> staticType;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type ConditionalExpression extends Expression {
|
|
|
|
Byte tag = 35;
|
|
|
|
Expression condition;
|
|
|
|
Expression then;
|
|
|
|
Expression otherwise;
|
2016-09-08 13:53:07 +00:00
|
|
|
Option<DartType> staticType;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type StringConcatenation extends Expression {
|
|
|
|
Byte tag = 36;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
List<Expression> expressions;
|
|
|
|
}
|
|
|
|
|
|
|
|
type IsExpression extends Expression {
|
|
|
|
Byte tag = 37;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Expression operand;
|
|
|
|
DartType type;
|
|
|
|
}
|
|
|
|
|
|
|
|
type AsExpression extends Expression {
|
|
|
|
Byte tag = 38;
|
2017-03-07 08:43:59 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Expression operand;
|
|
|
|
DartType type;
|
|
|
|
}
|
|
|
|
|
|
|
|
type StringLiteral extends Expression {
|
|
|
|
Byte tag = 39;
|
|
|
|
StringReference value;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SpecializedIntLiteral extends Expression {
|
|
|
|
Byte tag = 144 + N; // Where 0 <= N < 8.
|
|
|
|
// Integer literal with value (N - 3), that is, an integer in range -3..4.
|
|
|
|
}
|
|
|
|
|
|
|
|
type PositiveIntLiteral extends Expression {
|
|
|
|
Byte tag = 55;
|
|
|
|
UInt value;
|
|
|
|
}
|
|
|
|
|
|
|
|
type NegativeIntLiteral extends Expression {
|
|
|
|
Byte tag = 56;
|
|
|
|
UInt absoluteValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
type BigIntLiteral extends Expression {
|
|
|
|
Byte tag = 57;
|
|
|
|
StringReference valueString;
|
|
|
|
}
|
|
|
|
|
|
|
|
type DoubleLiteral extends Expression {
|
|
|
|
Byte tag = 40;
|
|
|
|
StringReference valueString;
|
|
|
|
}
|
|
|
|
|
|
|
|
type TrueLiteral extends Expression {
|
|
|
|
Byte tag = 41;
|
|
|
|
}
|
|
|
|
|
|
|
|
type FalseLiteral extends Expression {
|
|
|
|
Byte tag = 42;
|
|
|
|
}
|
|
|
|
|
|
|
|
type NullLiteral extends Expression {
|
|
|
|
Byte tag = 43;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SymbolLiteral extends Expression {
|
|
|
|
Byte tag = 44;
|
|
|
|
StringReference value; // Everything strictly after the '#'.
|
|
|
|
}
|
|
|
|
|
|
|
|
type TypeLiteral extends Expression {
|
|
|
|
Byte tag = 45;
|
|
|
|
DartType type;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ThisExpression extends Expression {
|
|
|
|
Byte tag = 46;
|
|
|
|
}
|
|
|
|
|
|
|
|
type Rethrow extends Expression {
|
|
|
|
Byte tag = 47;
|
2017-03-07 08:43:59 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Throw extends Expression {
|
|
|
|
Byte tag = 48;
|
2016-09-29 09:26:40 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Expression value;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ListLiteral extends Expression {
|
|
|
|
Byte tag = 49;
|
2017-03-07 08:43:59 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
DartType typeArgument;
|
|
|
|
List<Expression> values;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ConstListLiteral extends Expression {
|
|
|
|
Byte tag = 58; // Note: tag is out of order.
|
2017-03-07 08:43:59 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
DartType typeArgument;
|
|
|
|
List<Expression> values;
|
|
|
|
}
|
|
|
|
|
|
|
|
type MapLiteral extends Expression {
|
|
|
|
Byte tag = 50;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
DartType keyType;
|
|
|
|
DartType valueType;
|
|
|
|
List<MapEntry> entries;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ConstMapLiteral extends Expression {
|
|
|
|
Byte tag = 59; // Note: tag is out of order.
|
|
|
|
DartType keyType;
|
|
|
|
DartType valueType;
|
|
|
|
List<MapEntry> entries;
|
|
|
|
}
|
|
|
|
|
|
|
|
type MapEntry {
|
|
|
|
// Note: there is no tag on MapEntry
|
|
|
|
Expression key;
|
|
|
|
Expression value;
|
|
|
|
}
|
|
|
|
|
|
|
|
type AwaitExpression extends Expression {
|
|
|
|
Byte tag = 51;
|
|
|
|
Expression operand;
|
|
|
|
}
|
|
|
|
|
|
|
|
type FunctionExpression extends Expression {
|
|
|
|
Byte tag = 52;
|
|
|
|
FunctionNode function;
|
|
|
|
}
|
|
|
|
|
|
|
|
type Let extends Expression {
|
|
|
|
Byte tag = 53;
|
|
|
|
VariableDeclaration variable;
|
|
|
|
Expression body;
|
|
|
|
}
|
|
|
|
|
2017-02-13 13:31:24 +00:00
|
|
|
type LoadLibrary extends Expression {
|
|
|
|
Byte tag = 14;
|
|
|
|
DeferredImportReference import;
|
|
|
|
}
|
|
|
|
|
|
|
|
type CheckLibraryIsLoaded extends Expression {
|
|
|
|
Byte tag = 13;
|
|
|
|
DeferredImportReference import;
|
|
|
|
}
|
|
|
|
|
2017-03-27 13:52:26 +00:00
|
|
|
type VectorCreation extends Expression {
|
|
|
|
Byte tag = 102;
|
|
|
|
UInt length;
|
|
|
|
}
|
|
|
|
|
|
|
|
type VectorGet extends Expression {
|
|
|
|
Byte tag = 103;
|
|
|
|
Expression vectorExpression;
|
|
|
|
UInt index;
|
|
|
|
}
|
|
|
|
|
|
|
|
type VectorSet extends Expression {
|
|
|
|
Byte tag = 104;
|
|
|
|
Expression vectorExpression;
|
|
|
|
UInt index;
|
|
|
|
Expression value;
|
|
|
|
}
|
|
|
|
|
|
|
|
type VectorCopy extends Expression {
|
|
|
|
Byte tag = 105;
|
|
|
|
Expression vectorExpression;
|
|
|
|
}
|
|
|
|
|
2017-03-31 12:43:46 +00:00
|
|
|
type ClosureCreation extends Expression {
|
|
|
|
Byte tag = 106;
|
|
|
|
MemberReference topLevelFunctionReference;
|
|
|
|
Expression contextVector;
|
|
|
|
FunctionType functionType;
|
|
|
|
}
|
|
|
|
|
2016-04-26 08:39:15 +00:00
|
|
|
abstract type Statement extends Node {}
|
|
|
|
|
|
|
|
type InvalidStatement extends Statement {
|
|
|
|
Byte tag = 60;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ExpressionStatement extends Statement {
|
|
|
|
Byte tag = 61;
|
|
|
|
Expression expression;
|
|
|
|
}
|
|
|
|
|
|
|
|
type Block extends Statement {
|
|
|
|
Byte tag = 62;
|
|
|
|
List<Expression> expressions;
|
|
|
|
}
|
|
|
|
|
|
|
|
type EmptyStatement extends Statement {
|
|
|
|
Byte tag = 63;
|
|
|
|
}
|
|
|
|
|
|
|
|
type AssertStatement extends Statement {
|
|
|
|
Byte tag = 64;
|
|
|
|
Expression condition;
|
|
|
|
Option<Expression> message;
|
|
|
|
}
|
|
|
|
|
|
|
|
type LabeledStatement extends Statement {
|
|
|
|
Byte tag = 65;
|
|
|
|
Statement body;
|
|
|
|
}
|
|
|
|
|
|
|
|
type BreakStatement extends Statement {
|
|
|
|
Byte tag = 66;
|
2017-03-07 08:43:59 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
|
|
|
|
// Reference to the Nth LabeledStatement in scope, with 0 being the
|
|
|
|
// outermost enclosing labeled statement within the same FunctionNode.
|
|
|
|
//
|
|
|
|
// Labels are not in scope across function boundaries.
|
|
|
|
UInt labelIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
type WhileStatement extends Statement {
|
|
|
|
Byte tag = 67;
|
|
|
|
Expression condition;
|
|
|
|
Statement body;
|
|
|
|
}
|
|
|
|
|
|
|
|
type DoStatement extends Statement {
|
|
|
|
Byte tag = 68;
|
|
|
|
Statement body;
|
|
|
|
Expression condition;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ForStatement extends Statement {
|
|
|
|
Byte tag = 69;
|
|
|
|
List<VariableDeclaration> variables;
|
|
|
|
Option<Expression> condition;
|
|
|
|
List<Expression> updates;
|
|
|
|
Statement body;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ForInStatement extends Statement {
|
|
|
|
Byte tag = 70;
|
2017-03-15 12:22:58 +00:00
|
|
|
FileOffset fileOffset; // note that this is actually the body offset
|
2016-04-26 08:39:15 +00:00
|
|
|
VariableDeclaration variable;
|
|
|
|
Expression iterable;
|
|
|
|
Statement body;
|
|
|
|
}
|
|
|
|
|
|
|
|
type AsyncForInStatement extends Statement {
|
|
|
|
Byte tag = 80; // Note: tag is out of order.
|
2017-03-15 12:22:58 +00:00
|
|
|
FileOffset fileOffset; // note that this is actually the body offset
|
2016-04-26 08:39:15 +00:00
|
|
|
VariableDeclaration variable;
|
|
|
|
Expression iterable;
|
|
|
|
Statement body;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SwitchStatement extends Statement {
|
|
|
|
Byte tag = 71;
|
|
|
|
Expression expression;
|
|
|
|
List<SwitchCase> cases;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SwitchCase {
|
|
|
|
// Note: there is no tag on SwitchCase
|
|
|
|
List<Expression> expressions;
|
2017-03-21 10:36:48 +00:00
|
|
|
FileOffset[expressions.length] expressionOffsets; // 1-to-1 with expressions.
|
2016-04-26 08:39:15 +00:00
|
|
|
Byte isDefault; // 1 if default, 0 is not default.
|
|
|
|
Statement body;
|
|
|
|
}
|
|
|
|
|
|
|
|
type ContinueSwitchStatement extends Statement {
|
|
|
|
Byte tag = 72;
|
|
|
|
|
|
|
|
// Reference to the Nth SwitchCase in scope.
|
|
|
|
//
|
|
|
|
// A SwitchCase is in scope everywhere within its enclosing switch,
|
|
|
|
// except the scope is delimited by FunctionNodes.
|
|
|
|
//
|
|
|
|
// Switches are ordered from outermost to innermost, and the SwitchCases
|
|
|
|
// within a switch are consecutively indexed from first to last, so index
|
|
|
|
// 0 is the first SwitchCase of the outermost enclosing switch in the
|
|
|
|
// same FunctionNode.
|
|
|
|
UInt caseIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
type IfStatement extends Statement {
|
|
|
|
Byte tag = 73;
|
|
|
|
Expression condition;
|
|
|
|
Statement then;
|
|
|
|
Statement otherwise; // Empty statement if there was no else part.
|
|
|
|
}
|
|
|
|
|
|
|
|
type ReturnStatement extends Statement {
|
|
|
|
Byte tag = 74;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Option<Expression> expression;
|
|
|
|
}
|
|
|
|
|
|
|
|
type TryCatch extends Statement {
|
|
|
|
Byte tag = 75;
|
|
|
|
Statement body;
|
|
|
|
List<Catch> catches;
|
|
|
|
}
|
|
|
|
|
|
|
|
type Catch {
|
2016-06-06 13:01:51 +00:00
|
|
|
DartType guard;
|
2016-04-26 08:39:15 +00:00
|
|
|
Option<VariableDeclaration> exception;
|
|
|
|
Option<VariableDeclaration> stackTrace;
|
|
|
|
Statement body;
|
|
|
|
}
|
|
|
|
|
|
|
|
type TryFinally extends Statement {
|
|
|
|
Byte tag = 76;
|
|
|
|
Statement body;
|
|
|
|
Statement finalizer;
|
|
|
|
}
|
|
|
|
|
|
|
|
type YieldStatement extends Statement {
|
|
|
|
Byte tag = 77;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
Byte flags (isYieldStar);
|
|
|
|
Expression expression;
|
|
|
|
}
|
|
|
|
|
|
|
|
type VariableDeclarationStatement extends Statement {
|
|
|
|
Byte tag = 78;
|
|
|
|
VariableDeclaration variable;
|
|
|
|
}
|
|
|
|
|
|
|
|
type VariableDeclaration {
|
2017-03-07 08:43:59 +00:00
|
|
|
// The offset for the variable declaration, i.e. the offset of the start of
|
|
|
|
// the declaration.
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2017-03-07 08:43:59 +00:00
|
|
|
|
|
|
|
// The offset for the equal sign in the declaration (if it contains one).
|
|
|
|
// If it does not contain one this should be -1.
|
|
|
|
FileOffset fileEqualsOffset;
|
|
|
|
|
2016-04-26 08:39:15 +00:00
|
|
|
Byte flags (isFinal, isConst);
|
|
|
|
// For named parameters, this is the parameter name.
|
|
|
|
// For other variables, the name is cosmetic, may be empty,
|
|
|
|
// and is not necessarily unique.
|
|
|
|
StringReference name;
|
2016-06-06 13:01:51 +00:00
|
|
|
DartType type;
|
2016-04-26 08:39:15 +00:00
|
|
|
|
|
|
|
// For statements and for-loops, this is the initial value.
|
|
|
|
// For optional parameters, this is the default value (if given).
|
|
|
|
// In all other contexts, it must be Nothing.
|
|
|
|
Option<Expression> initializer;
|
|
|
|
}
|
|
|
|
|
|
|
|
type FunctionDeclaration extends Statement {
|
|
|
|
Byte tag = 79;
|
2017-01-11 08:59:52 +00:00
|
|
|
FileOffset fileOffset;
|
2016-04-26 08:39:15 +00:00
|
|
|
// The variable binding the function. The variable is in scope
|
|
|
|
// within the function for use as a self-reference.
|
|
|
|
// Some of the fields in the variable are redundant, but its presence here
|
|
|
|
// simplifies the rule for variable indexing.
|
|
|
|
VariableDeclaration variable;
|
|
|
|
FunctionNode function;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract type DartType extends Node {}
|
|
|
|
|
|
|
|
type InvalidType extends DartType {
|
|
|
|
Byte tag = 90;
|
|
|
|
}
|
|
|
|
|
|
|
|
type DynamicType extends DartType {
|
|
|
|
Byte tag = 91;
|
|
|
|
}
|
|
|
|
|
|
|
|
type VoidType extends DartType {
|
|
|
|
Byte tag = 92;
|
|
|
|
}
|
|
|
|
|
|
|
|
type InterfaceType extends DartType {
|
|
|
|
Byte tag = 93;
|
|
|
|
ClassReference class;
|
|
|
|
List<DartType> typeArguments;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SimpleInterfaceType extends DartType {
|
|
|
|
Byte tag = 96; // Note: tag is out of order.
|
|
|
|
ClassReference class;
|
|
|
|
// Equivalent to InterfaceType with empty list of type arguments.
|
|
|
|
}
|
|
|
|
|
|
|
|
type FunctionType extends DartType {
|
|
|
|
Byte tag = 94;
|
|
|
|
List<TypeParameter> typeParameters;
|
|
|
|
UInt requiredParameterCount;
|
|
|
|
List<DartType> positionalParameters;
|
|
|
|
List<NamedDartType> namedParameters;
|
|
|
|
DartType returnType;
|
|
|
|
}
|
|
|
|
|
|
|
|
type SimpleFunctionType extends DartType {
|
|
|
|
Byte tag = 97; // Note: tag is out of order.
|
|
|
|
List<DartType> positionalParameters;
|
|
|
|
DartType returnType;
|
|
|
|
// Equivalent to a FunctionType with no type parameters or named parameters,
|
|
|
|
// and where all positional parameters are required.
|
|
|
|
}
|
|
|
|
|
|
|
|
type NamedDartType {
|
|
|
|
StringReference name;
|
|
|
|
DartType type;
|
|
|
|
}
|
|
|
|
|
|
|
|
type TypeParameterType extends DartType {
|
|
|
|
Byte tag = 95;
|
|
|
|
|
|
|
|
// Reference to the Nth type parameter in scope (with some caveats about
|
|
|
|
// type parameter bounds).
|
|
|
|
//
|
|
|
|
// As with the other indexing schemes, outermost nodes have lower
|
|
|
|
// indices, and a type parameter list is consecutively indexed from
|
|
|
|
// left to right.
|
|
|
|
//
|
|
|
|
// In the case of type parameter bounds, this indexing diverges slightly
|
|
|
|
// from the definition of scoping, since type parameter N+1 is not "in scope"
|
|
|
|
// in the bound of type parameter N, but it takes up an index as if it was in
|
|
|
|
// scope there.
|
|
|
|
//
|
|
|
|
// The type parameter can be bound by a Class, FunctionNode, or FunctionType.
|
|
|
|
//
|
|
|
|
// Note that constructors currently do not declare type parameters. Uses of
|
|
|
|
// the class type parameters in a constructor refer to those declared on the
|
|
|
|
// class.
|
|
|
|
UInt index;
|
|
|
|
}
|
|
|
|
|
2017-03-27 13:52:26 +00:00
|
|
|
type VectorType extends DartType {
|
|
|
|
Byte tag = 88;
|
|
|
|
}
|
|
|
|
|
2016-04-26 08:39:15 +00:00
|
|
|
type TypeParameter {
|
|
|
|
// Note: there is no tag on TypeParameter
|
|
|
|
StringReference name; // Cosmetic, may be empty, not unique.
|
|
|
|
DartType bound; // 'dynamic' if no explicit bound was given.
|
|
|
|
}
|
|
|
|
|
|
|
|
```
|