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

Unified Diff: pkg/analyzer/lib/src/task/strong/checker.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/task/strong/checker.dart
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index c528c65cc1fcd9e042becdffa2d0e423da04c76e..7ccdcc97f08140025a5d11887d1ff2b5cd580aac 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -217,8 +217,8 @@ class CodeChecker extends RecursiveAstVisitor {
}
}
- DartType getType(TypeName name) {
- return (name == null) ? DynamicTypeImpl.instance : name.type;
+ DartType getType(TypeAnnotation type) {
+ return type?.type ?? DynamicTypeImpl.instance;
}
void reset() {
@@ -492,7 +492,7 @@ class CodeChecker extends RecursiveAstVisitor {
void visitListLiteral(ListLiteral node) {
DartType type = DynamicTypeImpl.instance;
if (node.typeArguments != null) {
- NodeList<TypeName> targs = node.typeArguments.arguments;
+ NodeList<TypeAnnotation> targs = node.typeArguments.arguments;
if (targs.length > 0) {
type = targs[0].type;
}
@@ -517,7 +517,7 @@ class CodeChecker extends RecursiveAstVisitor {
DartType ktype = DynamicTypeImpl.instance;
DartType vtype = DynamicTypeImpl.instance;
if (node.typeArguments != null) {
- NodeList<TypeName> targs = node.typeArguments.arguments;
+ NodeList<TypeAnnotation> targs = node.typeArguments.arguments;
if (targs.length > 0) {
ktype = targs[0].type;
}
@@ -657,7 +657,7 @@ class CodeChecker extends RecursiveAstVisitor {
@override
void visitVariableDeclarationList(VariableDeclarationList node) {
- TypeName type = node.type;
+ TypeAnnotation type = node.type;
if (type == null) {
// No checks are needed when the type is var. Although internally the
// typing rules may have inferred a more precise type for the variable
@@ -876,8 +876,8 @@ class CodeChecker extends RecursiveAstVisitor {
if (expression != null) checkAssignment(expression, type);
}
- void _checkRuntimeTypeCheck(AstNode node, TypeName typeName) {
- var type = getType(typeName);
+ void _checkRuntimeTypeCheck(AstNode node, TypeAnnotation annotation) {
+ var type = getType(annotation);
if (!rules.isGroundType(type)) {
_recordMessage(node, StrongModeCode.NON_GROUND_TYPE_CHECK_INFO, [type]);
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_const_expr.dart ('k') | pkg/analyzer/test/generated/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698