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

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

Issue 1672413002: Add summary support for annotations. (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/summarize_const_expr.dart
diff --git a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
index b523b8b3c8c40e0bd6633ea4a6cfd0bf4c94bd1f..d82ee6447f9c925ca0f7d346e6a729295cf013a4 100644
--- a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
@@ -65,7 +65,10 @@ abstract class AbstractConstExprSerializer {
references.add(serializeIdentifier(expr));
operations.add(UnlinkedConstOperation.pushReference);
} else if (expr is InstanceCreationExpression) {
- _serializeInstanceCreation(expr);
+ serializeInstanceCreation(
+ serializeConstructorName(
+ expr.constructorName.type, expr.constructorName.name),
+ expr.argumentList);
} else if (expr is ListLiteral) {
_serializeListLiteral(expr);
} else if (expr is MapLiteral) {
@@ -109,9 +112,16 @@ abstract class AbstractConstExprSerializer {
}
/**
- * Return [EntityRefBuilder] that corresponds to the given [constructor].
+ * Serialize the given [annotation] into this serializer state.
*/
- EntityRefBuilder serializeConstructorName(ConstructorName constructor);
+ void serializeAnnotation(Annotation annotation);
+
+ /**
+ * Return [EntityRefBuilder] that corresponds to the constructor having name
+ * [name] in the class identified by [type].
+ */
+ EntityRefBuilder serializeConstructorName(
+ TypeName type, SimpleIdentifier name);
/**
* Return [EntityRefBuilder] that corresponds to the given [identifier].
@@ -209,9 +219,9 @@ abstract class AbstractConstExprSerializer {
}
}
- void _serializeInstanceCreation(InstanceCreationExpression expr) {
- ConstructorName constructor = expr.constructorName;
- List<Expression> arguments = expr.argumentList.arguments;
+ void serializeInstanceCreation(
+ EntityRefBuilder constructor, ArgumentList argumentList) {
+ List<Expression> arguments = argumentList.arguments;
// Serialize the arguments.
List<String> argumentNames = <String>[];
arguments.forEach((arg) {
@@ -228,7 +238,7 @@ abstract class AbstractConstExprSerializer {
strings.addAll(argumentNames);
ints.add(arguments.length - argumentNames.length);
// Serialize the reference.
- references.add(serializeConstructorName(constructor));
+ references.add(constructor);
}
void _serializeListLiteral(ListLiteral expr) {
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_ast.dart ('k') | pkg/analyzer/lib/src/summary/summarize_elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698