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

Unified Diff: pkg/analyzer/tool/summary/idl.dart

Issue 1420053011: Introduce code to generate summaries from an element model. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address code review comments. Created 5 years, 1 month 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/analyzer/tool/summary/idl.dart
diff --git a/pkg/analyzer/tool/summary/idl.dart b/pkg/analyzer/tool/summary/idl.dart
index 500acaec12483819d424b5604089aa9d12007a83..efd3bdebec813729c038d2ca20deab6be02c451a 100644
--- a/pkg/analyzer/tool/summary/idl.dart
+++ b/pkg/analyzer/tool/summary/idl.dart
@@ -57,6 +57,12 @@ const informative = null;
const private = null;
/**
+ * Annotation describing a class which can be the top level object in an
+ * encoded summary.
+ */
+const topLevel = null;
+
+/**
* Information about a dependency that exists between one library and another
* due to an "import" declaration.
*/
@@ -70,6 +76,7 @@ class PrelinkedDependency {
/**
* Pre-linked summary of a library.
*/
+@topLevel
class PrelinkedLibrary {
/**
* The unlinked library summary.
@@ -114,7 +121,8 @@ class PrelinkedReference {
int dependency;
/**
- * The kind of the entity being referred to.
+ * The kind of the entity being referred to. For the pseudo-type `dynamic`,
+ * the kind if [PrelinkedReferenceKind.classOrEnum].
*/
PrelinkedReferenceKind kind;
}
@@ -552,7 +560,8 @@ class UnlinkedPrefix {
*/
class UnlinkedReference {
/**
- * Name of the entity being referred to.
+ * Name of the entity being referred to. The empty string refers to the
+ * pseudo-type `dynamic`.
*/
String name;
@@ -618,21 +627,33 @@ class UnlinkedTypeRef {
/**
* Index into [UnlinkedLibrary.references] for the type being referred to, or
* zero if this is a reference to a type parameter.
+ *
+ * Note that since zero is also a valid index into
+ * [UnlinkedLibrary.references], we cannot distinguish between references to
+ * type parameters and references to types by checking [reference] against
+ * zero. To distinguish between references to type parameters and references
+ * to types, check whether [paramReference] is zero.
*/
int reference;
/**
- * If this is a reference to a type parameter, one-based index into
- * [UnlinkedClass.typeParameters] or [UnlinkedTypedef.typeParameters] for the
- * parameter being referenced. Otherwise zero.
+ * If this is a reference to a type parameter, one-based index into the list
+ * of [UnlinkedTypeParam]s currently in effect. Indexing is done using De
+ * Bruijn index conventions; that is, innermost parameters come first, and
+ * if a class or method has multiple parameters, they are indexed from right
+ * to left. So for instance, if the enclosing declaration is
+ *
+ * class C<T,U> {
+ * m<V,W> {
+ * ...
+ * }
+ * }
+ *
+ * Then [paramReference] values of 1, 2, 3, and 4 represent W, V, U, and T,
+ * respectively. TODO(paulberry): test this.
*
- * If generic method syntax is enabled, this may also be a one-based index
- * into [UnlinkedExecutable.typeParameters]. Note that this creates an
- * ambiguity since it allows executables with type parameters to be nested
- * inside other declarations with type parameters (which might themselves be
- * executables). The ambiguity is resolved by considering this to be a
- * one-based index into a list that concatenates all type parameters that are
- * in scope, listing the outermost type parameters first.
+ * If the type being referred to is not a type parameter, [paramReference] is
+ * zero.
*/
int paramReference;

Powered by Google App Engine
This is Rietveld 408576698