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

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

Issue 2622303006: Reapply "Add support for generic function type syntax, part 1" (Closed)
Patch Set: 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/analyzer/lib/src/summary/summarize_ast.dart
diff --git a/pkg/analyzer/lib/src/summary/summarize_ast.dart b/pkg/analyzer/lib/src/summary/summarize_ast.dart
index 46b7b2d9990fef15813062a70c771c1601d6693a..7eb3ad549b49e9e2fdc43a530e536be6212e7a77 100644
--- a/pkg/analyzer/lib/src/summary/summarize_ast.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_ast.dart
@@ -567,7 +567,7 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
NodeList<Annotation> annotations,
bool isFinal,
bool isConst,
- TypeName type,
+ TypeAnnotation type,
bool assignPropagatedTypeSlot,
SimpleIdentifier declaredIdentifier) {
UnlinkedVariableBuilder b = new UnlinkedVariableBuilder();
@@ -615,7 +615,7 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
int nameOffset,
bool isGetter,
bool isSetter,
- TypeName returnType,
+ TypeAnnotation returnType,
FormalParameterList formalParameters,
FunctionBody body,
bool isTopLevel,
@@ -764,7 +764,7 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
* parameter and store them in [b].
*/
void serializeFunctionTypedParameterDetails(UnlinkedParamBuilder b,
- TypeName returnType, FormalParameterList parameters) {
+ TypeAnnotation returnType, FormalParameterList parameters) {
EntityRefBuilder serializedReturnType = serializeTypeName(returnType);
if (serializedReturnType != null) {
b.type = serializedReturnType;
@@ -933,8 +933,13 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
* a [EntityRef]. Note that this method does the right thing if the
* name doesn't refer to an entity other than a type (e.g. a class member).
*/
- EntityRefBuilder serializeTypeName(TypeName node) {
- return serializeType(node?.name, node?.typeArguments);
+ EntityRefBuilder serializeTypeName(TypeAnnotation node) {
+ if (node is TypeName) {
+ return serializeType(node?.name, node?.typeArguments);
+ } else if (node != null) {
+ throw new ArgumentError('Cannot serialize a ${node.runtimeType}');
+ }
+ return null;
}
/**
@@ -1397,14 +1402,6 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
}
/**
- * Helper method to determine if a given [typeName] refers to `dynamic`.
- */
- static bool isDynamic(TypeName typeName) {
- Identifier name = typeName.name;
- return name is SimpleIdentifier && name.name == 'dynamic';
- }
-
- /**
* Compute the API signature of the unit and record it.
*/
static void _computeApiSignature(UnlinkedUnitBuilder b) {
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | pkg/analyzer/lib/src/summary/summarize_const_expr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698