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

Unified Diff: pkg/analyzer/lib/src/dart/constant/evaluation.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
« no previous file with comments | « pkg/analyzer/lib/src/dart/ast/utilities.dart ('k') | pkg/analyzer/lib/src/generated/element_resolver.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/constant/evaluation.dart
diff --git a/pkg/analyzer/lib/src/dart/constant/evaluation.dart b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
index 7e477d3c223e2f4dfa426f212debf90a3bf0ac94..4718171ab6e33ea0d2029acca8287c711599739f 100644
--- a/pkg/analyzer/lib/src/dart/constant/evaluation.dart
+++ b/pkg/analyzer/lib/src/dart/constant/evaluation.dart
@@ -1358,9 +1358,9 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
return null;
}
DartType elementType = _typeProvider.dynamicType;
- NodeList<TypeName> typeArgs = node.typeArguments?.arguments;
+ NodeList<TypeAnnotation> typeArgs = node.typeArguments?.arguments;
if (typeArgs?.length == 1) {
- DartType type = visitTypeName(typeArgs[0])?.toTypeValue();
+ DartType type = visitTypeAnnotation(typeArgs[0])?.toTypeValue();
if (type != null) {
elementType = type;
}
@@ -1393,13 +1393,15 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
}
DartType keyType = _typeProvider.dynamicType;
DartType valueType = _typeProvider.dynamicType;
- NodeList<TypeName> typeArgs = node.typeArguments?.arguments;
+ NodeList<TypeAnnotation> typeArgs = node.typeArguments?.arguments;
if (typeArgs?.length == 2) {
- DartType keyTypeCandidate = visitTypeName(typeArgs[0])?.toTypeValue();
+ DartType keyTypeCandidate =
+ visitTypeAnnotation(typeArgs[0])?.toTypeValue();
if (keyTypeCandidate != null) {
keyType = keyTypeCandidate;
}
- DartType valueTypeCandidate = visitTypeName(typeArgs[1])?.toTypeValue();
+ DartType valueTypeCandidate =
+ visitTypeAnnotation(typeArgs[1])?.toTypeValue();
if (valueTypeCandidate != null) {
valueType = valueTypeCandidate;
}
@@ -1549,8 +1551,7 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
_typeProvider.symbolType, new SymbolState(buffer.toString()));
}
- @override
- DartObjectImpl visitTypeName(TypeName node) {
+ DartObjectImpl visitTypeAnnotation(TypeAnnotation node) {
DartType type = evaluateType(node.type);
if (type == null) {
return super.visitTypeName(node);
@@ -1558,6 +1559,9 @@ class ConstantVisitor extends UnifyingAstVisitor<DartObjectImpl> {
return typeConstant(type);
}
+ @override
+ DartObjectImpl visitTypeName(TypeName node) => visitTypeAnnotation(node);
+
/**
* Create an error associated with the given [node]. The error will have the
* given error [code].
« no previous file with comments | « pkg/analyzer/lib/src/dart/ast/utilities.dart ('k') | pkg/analyzer/lib/src/generated/element_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698