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

Unified Diff: pkg/analyzer/lib/src/generated/static_type_analyzer.dart

Issue 2613383003: 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/generated/static_type_analyzer.dart
diff --git a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
index 3367b1639ebca21b2bcdf826d79b6309b31b5b79..99114d7015aa12af523d4e079917aa663bc2f3eb 100644
--- a/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
+++ b/pkg/analyzer/lib/src/generated/static_type_analyzer.dart
@@ -611,10 +611,9 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
// If we have explicit arguments, use them
if (typeArguments != null) {
DartType staticType = _dynamicType;
- NodeList<TypeName> arguments = typeArguments.arguments;
+ NodeList<TypeAnnotation> arguments = typeArguments.arguments;
if (arguments != null && arguments.length == 1) {
- TypeName argumentTypeName = arguments[0];
- DartType argumentType = _getType(argumentTypeName);
+ DartType argumentType = _getType(arguments[0]);
if (argumentType != null) {
staticType = argumentType;
}
@@ -689,15 +688,13 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
if (typeArguments != null) {
DartType staticKeyType = _dynamicType;
DartType staticValueType = _dynamicType;
- NodeList<TypeName> arguments = typeArguments.arguments;
+ NodeList<TypeAnnotation> arguments = typeArguments.arguments;
if (arguments != null && arguments.length == 2) {
- TypeName entryKeyTypeName = arguments[0];
- DartType entryKeyType = _getType(entryKeyTypeName);
+ DartType entryKeyType = _getType(arguments[0]);
if (entryKeyType != null) {
staticKeyType = entryKeyType;
}
- TypeName entryValueTypeName = arguments[1];
- DartType entryValueType = _getType(entryValueTypeName);
+ DartType entryValueType = _getType(arguments[1]);
if (entryValueType != null) {
staticValueType = entryValueType;
}
@@ -1577,7 +1574,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
*/
DartType _computeStaticReturnTypeOfFunctionDeclaration(
FunctionDeclaration node) {
- TypeName returnType = node.returnType;
+ TypeAnnotation returnType = node.returnType;
if (returnType == null) {
return _dynamicType;
}
@@ -1834,13 +1831,10 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
}
/**
- * Return the type represented by the given type name.
- *
- * @param typeName the type name representing the type to be returned
- * @return the type represented by the type name
+ * Return the type represented by the given type [annotation].
*/
- DartType _getType(TypeName typeName) {
- DartType type = typeName.type;
+ DartType _getType(TypeAnnotation annotation) {
+ DartType type = annotation.type;
if (type == null) {
//TODO(brianwilkerson) Determine the conditions for which the type is
// null.
@@ -2259,10 +2253,7 @@ class StaticTypeAnalyzer extends SimpleAstVisitor<Object> {
library != null && "dart.dom.html" == library.name;
/**
- * Return `true` if the given node is not a type literal.
- *
- * @param node the node being tested
- * @return `true` if the given node is not a type literal
+ * Return `true` if the given [node] is not a type literal.
*/
bool _isNotTypeLiteral(Identifier node) {
AstNode parent = node.parent;
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/lib/src/generated/testing/ast_test_factory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698