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

Side by Side Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 1720083002: Report a static warning if a for loop condition is non-boolean. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/static_type_warning_code_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.src.generated.error_verifier; 5 library analyzer.src.generated.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 Object visitFieldFormalParameter(FieldFormalParameter node) { 675 Object visitFieldFormalParameter(FieldFormalParameter node) {
676 _checkForValidField(node); 676 _checkForValidField(node);
677 _checkForConstFormalParameter(node); 677 _checkForConstFormalParameter(node);
678 _checkForPrivateOptionalParameter(node); 678 _checkForPrivateOptionalParameter(node);
679 _checkForFieldInitializingFormalRedirectingConstructor(node); 679 _checkForFieldInitializingFormalRedirectingConstructor(node);
680 _checkForTypeAnnotationDeferredClass(node.type); 680 _checkForTypeAnnotationDeferredClass(node.type);
681 return super.visitFieldFormalParameter(node); 681 return super.visitFieldFormalParameter(node);
682 } 682 }
683 683
684 @override 684 @override
685 Object visitForStatement(ForStatement node) {
686 if (node.condition != null) {
687 _checkForNonBoolCondition(node.condition);
688 }
689 return super.visitForStatement(node);
690 }
691
692 @override
685 Object visitFunctionDeclaration(FunctionDeclaration node) { 693 Object visitFunctionDeclaration(FunctionDeclaration node) {
686 ExecutableElement outerFunction = _enclosingFunction; 694 ExecutableElement outerFunction = _enclosingFunction;
687 try { 695 try {
688 SimpleIdentifier identifier = node.name; 696 SimpleIdentifier identifier = node.name;
689 String methodName = ""; 697 String methodName = "";
690 if (identifier != null) { 698 if (identifier != null) {
691 methodName = identifier.name; 699 methodName = identifier.name;
692 } 700 }
693 _enclosingFunction = node.element; 701 _enclosingFunction = node.element;
694 TypeName returnType = node.returnType; 702 TypeName returnType = node.returnType;
(...skipping 5512 matching lines...) Expand 10 before | Expand all | Expand 10 after
6207 toCheck.add(type.element); 6215 toCheck.add(type.element);
6208 // type arguments 6216 // type arguments
6209 if (type is InterfaceType) { 6217 if (type is InterfaceType) {
6210 InterfaceType interfaceType = type; 6218 InterfaceType interfaceType = type;
6211 for (DartType typeArgument in interfaceType.typeArguments) { 6219 for (DartType typeArgument in interfaceType.typeArguments) {
6212 _addTypeToCheck(typeArgument); 6220 _addTypeToCheck(typeArgument);
6213 } 6221 }
6214 } 6222 }
6215 } 6223 }
6216 } 6224 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/static_type_warning_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698