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

Unified Diff: pkg/kernel/binary.md

Issue 2665723002: Implement canonical name scheme in kernel. (Closed)
Patch Set: Address comments Created 3 years, 11 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
Index: pkg/kernel/binary.md
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index a287dd6be83b9b2884a61d04c12ab347a3fb7af5..b85ccef524f2e91c6bc77f0dcbe617d2931421f1 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -91,70 +91,52 @@ type Something<T> extends Option<T> {
T value;
}
+type CanonicalNameReference {
+ UInt biasedIndex; // 0 if null, otherwise N+1 where N is index of parent
+}
+
+type CanonicalName {
+ CanonicalNameReference parent;
+ StringReference name;
+}
+
type ProgramFile {
MagicWord magic = 0x90ABCDEF;
StringTable strings;
UriSource sourceMap;
+ List<CanonicalName> canonicalNames;
List<Library> libraries;
- LibraryProcedureReference mainMethod;
+ CanonicalNameReference mainMethod;
}
type LibraryReference {
- // Index into the ProgramFile libraries.
- UInt index;
-}
-
-abstract type ClassReference {}
-
-type NormalClassReference extends ClassReference {
- Byte tag = 100;
- LibraryReference library;
- UInt classIndex;
-}
-
-type MixinClassReference extends ClassReference {
- Byte tag = 101;
- LibraryReference library;
- UInt classIndex;
-}
-
-abstract type MemberReference {
-}
-
-type LibraryFieldReference extends MemberReference {
- Byte tag = 102;
- LibraryReference library;
- UInt fieldIndex; // Index in list of fields.
+ // Must be populated by a library (possibly later in the file).
+ CanonicalNameReference canonicalName;
}
-type ClassFieldReference extends MemberReference {
- Byte tag = 103;
- ClassReference class;
- UInt fieldIndex;
+type ClassReference {
+ // Must be populated by a class (possibly later in the file).
+ CanonicalNameReference canonicalName;
}
-type ClassConstructorReference extends MemberReference {
- Byte tag = 104;
- ClassReference class;
- UInt constructorIndex; // Index in list of constructors.
+type MemberReference {
+ // Must be populated by a member (possibly later in the file).
+ CanonicalNameReference canonicalName;
}
-type LibraryProcedureReference extends MemberReference {
- Byte tag = 105;
- LibraryReference library;
- UInt procedureIndex; // Index in list of procedures.
+type FieldReference {
+ // Must be populated by a field (possibly later in the file).
+ CanonicalNameReference canonicalName;
}
-type ClassProcedureReference extends MemberReference {
- Byte tag = 106;
- ClassReference class;
- UInt procedureIndex;
+type ConstructorReference {
+ // Must be populated by a constructor (possibly later in the file).
+ CanonicalNameReference canonicalName;
}
-// Can be used as MemberReference or ClassReference *only* if indicated that
-// the given reference may be a NullReference.
-type NullReference extends MemberReference, ClassReference {
- Byte tag = 99;
+type ProcedureReference {
+ // Must be populated by a procedure (possibly later in the file).
+ CanonicalNameReference canonicalName;
}
type Name {
@@ -166,13 +148,8 @@ type Name {
type Library {
Byte flags (isExternal);
+ CanonicalNameReference canonicalName;
StringReference name;
- // A URI from which the library was created. The URI has the dart, package,
- // file, or app scheme. For file URIs, the path is an absolute path to the
- // .dart file from which the library was created. For app URIs, the path is
- // relative to an application root that was specified when the binary was
- // generated.
- StringReference importUri;
// An absolute path URI to the .dart file from which the library was created.
UriReference fileUri;
List<Class> classes;
@@ -192,10 +169,9 @@ abstract type Node {
//
// See ClassLevel in ast.dart for the details of each loading level.
-abstract type Class extends Node {}
-
-type NormalClass extends Class {
+abstract type Class extends Node {
Byte tag = 2;
+ CanonicalNameReference canonicalName;
FileOffset fileOffset;
Byte flags (isAbstract, isTypeLevel);
StringReference name;
@@ -204,31 +180,18 @@ type NormalClass extends Class {
List<Expression> annotations;
List<TypeParameter> typeParameters;
Option<InterfaceType> superClass;
+ Option<InterfaceType> mixedInType;
List<InterfaceType> implementedClasses;
List<Field> fields;
List<Constructor> constructors;
List<Procedure> procedures;
}
-type MixinClass extends Class {
- Byte tag = 3;
- FileOffset fileOffset;
- Byte flags (isAbstract, isTypeLevel);
- StringReference name;
- // An absolute path URI to the .dart file from which the class was created.
- UriReference fileUri;
- List<Expression> annotations;
- List<TypeParameter> typeParameters;
- InterfaceType firstSuperClass;
- InterfaceType secondSuperClass;
- List<InterfaceType> implementedClasses;
- List<Constructor> constructors;
-}
-
abstract type Member extends Node {}
type Field extends Member {
Byte tag = 4;
+ CanonicalNameReference canonicalName;
FileOffset fileOffset;
FileOffset fileEndOffset;
Byte flags (isFinal, isConst, isStatic);
@@ -243,6 +206,7 @@ type Field extends Member {
type Constructor extends Member {
Byte tag = 5;
+ CanonicalNameReference canonicalName;
FileOffset fileOffset;
FileOffset fileEndOffset;
Byte flags (isConst, isExternal);

Powered by Google App Engine
This is Rietveld 408576698