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

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

Issue 2624283003: Revert "Add support for generic function type syntax, part 1" (TBR) (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 7eb3ad549b49e9e2fdc43a530e536be6212e7a77..46b7b2d9990fef15813062a70c771c1601d6693a 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,
- TypeAnnotation type,
+ TypeName type,
bool assignPropagatedTypeSlot,
SimpleIdentifier declaredIdentifier) {
UnlinkedVariableBuilder b = new UnlinkedVariableBuilder();
@@ -615,7 +615,7 @@ class _SummarizeAstVisitor extends RecursiveAstVisitor {
int nameOffset,
bool isGetter,
bool isSetter,
- TypeAnnotation returnType,
+ TypeName 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,
- TypeAnnotation returnType, FormalParameterList parameters) {
+ TypeName returnType, FormalParameterList parameters) {
EntityRefBuilder serializedReturnType = serializeTypeName(returnType);
if (serializedReturnType != null) {
b.type = serializedReturnType;
@@ -933,13 +933,8 @@ 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(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;
+ EntityRefBuilder serializeTypeName(TypeName node) {
+ return serializeType(node?.name, node?.typeArguments);
}
/**
@@ -1402,6 +1397,14 @@ 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