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

Unified Diff: pkg/analyzer/lib/src/summary/idl.dart

Issue 1678753002: Summarize constructor initializers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/analyzer/lib/src/summary/idl.dart
diff --git a/pkg/analyzer/lib/src/summary/idl.dart b/pkg/analyzer/lib/src/summary/idl.dart
index 921781d10b7d9934fc923d9f62dd43902d991666..4f8962f7dd1d7f2bb1d232259549cc708e1539f8 100644
--- a/pkg/analyzer/lib/src/summary/idl.dart
+++ b/pkg/analyzer/lib/src/summary/idl.dart
@@ -614,6 +614,12 @@ enum UnlinkedConstOperation {
pushNull,
/**
+ * Push the value of the constant constructor parameter with
+ * the name obtained from [UnlinkedConst.strings].
+ */
+ pushConstructorParameter,
+
+ /**
* Evaluate a (potentially qualified) identifier expression and push the
* resulting value onto the stack. The identifier to be evaluated is
* obtained from [UnlinkedConst.references].
@@ -833,6 +839,56 @@ enum UnlinkedConstOperation {
}
/**
+ * Unlinked summary information about a constructor initializer.
+ */
+abstract class UnlinkedConstructorInitializer extends base.SummaryClass {
+ /**
+ * The kind of the constructor initializer (field, redirect, super).
+ */
+ UnlinkedConstructorInitializerKind get kind;
+
+ /**
+ * Depending on the [kind] is the name of the field declared in the class,
Paul Berry 2016/02/08 14:53:12 Rather than make the reader figure out which possi
scheglov 2016/02/08 16:29:51 Done.
+ * or the name of the constructor to redirect to (may be `null`), or the name
+ * of the invoked super constructor (may be `null`).
+ */
+ String get name;
+
+ /**
+ * If [UnlinkedConstructorInitializerKind.field], the expression of the
Paul Berry 2016/02/08 14:53:12 Nit: how about saying "If [kind] is `field`"? It'
scheglov 2016/02/08 16:29:51 Done.
+ * field initializer. Otherwise `null`.
+ */
+ UnlinkedConst get expression;
+
+ /**
+ * If [UnlinkedConstructorInitializerKind.thisInvocation] or
+ * [UnlinkedConstructorInitializerKind.superInvocation], the arguments of
+ * the invocation. Otherwise empty.
+ */
+ List<UnlinkedConst> get arguments;
+}
+
+/**
+ * Enum used to indicate the kind of an constructor initializer.
+ */
+enum UnlinkedConstructorInitializerKind {
+ /**
+ * Initialization of a field.
+ */
+ field,
+
+ /**
+ * Invocation of a constructor in the same class.
+ */
+ thisInvocation,
+
+ /**
+ * Invocation of a superclass' constructor.
+ */
+ superInvocation
+}
+
+/**
* Unlinked summary information about a documentation comment.
*/
abstract class UnlinkedDocumentationComment extends base.SummaryClass {
@@ -992,12 +1048,18 @@ abstract class UnlinkedExecutable extends base.SummaryClass {
/**
* If this executable's return type is inferable, nonzero slot id
- * identifying which entry in [LinkedLibrary.types] contains the inferred
- * return type. If there is no matching entry in [LinkedLibrary.types], then
+ * identifying which entry in [LinkedUnit.types] contains the inferred
+ * return type. If there is no matching entry in [LinkedUnit.types], then
* no return type was inferred for this variable, so its static type is
* `dynamic`.
*/
int get inferredReturnTypeSlot;
+
+ /**
+ * If a constant [UnlinkedExecutableKind.constructor], the constructor
+ * initializers. Otherwise empty.
+ */
+ List<UnlinkedConstructorInitializer> get constantInitializers;
}
/**

Powered by Google App Engine
This is Rietveld 408576698