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

Side by Side Diff: pkg/analyzer/lib/src/task/strong/checker.dart

Issue 2786993002: Convert top-level inference errors to hints (Closed)
Patch Set: Preserve the new hints Created 3 years, 8 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 | « pkg/analyzer/lib/src/error/codes.dart ('k') | pkg/analyzer/test/generated/hint_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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be 5 // TODO(jmesserly): this was ported from package:dev_compiler, and needs to be
6 // refactored to fit into analyzer. 6 // refactored to fit into analyzer.
7 library analyzer.src.task.strong.checker; 7 library analyzer.src.task.strong.checker;
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 1040
1041 void _recordMessage(AstNode node, ErrorCode errorCode, List arguments) { 1041 void _recordMessage(AstNode node, ErrorCode errorCode, List arguments) {
1042 // Compute the right severity taking the analysis options into account. 1042 // Compute the right severity taking the analysis options into account.
1043 // We construct a dummy error to make the common case where we end up 1043 // We construct a dummy error to make the common case where we end up
1044 // ignoring the strong mode message cheaper. 1044 // ignoring the strong mode message cheaper.
1045 var processor = ErrorProcessor.getProcessor(_options, 1045 var processor = ErrorProcessor.getProcessor(_options,
1046 new AnalysisError.forValues(null, -1, 0, errorCode, null, null)); 1046 new AnalysisError.forValues(null, -1, 0, errorCode, null, null));
1047 var severity = 1047 var severity =
1048 (processor != null) ? processor.severity : errorCode.errorSeverity; 1048 (processor != null) ? processor.severity : errorCode.errorSeverity;
1049 1049
1050 if (severity == ErrorSeverity.ERROR) _failure = true; 1050 if (errorCode.type == ErrorType.HINT &&
1051 errorCode.name.startsWith('STRONG_MODE_TOP_LEVEL_')) {
1052 severity = ErrorSeverity.ERROR;
1053 }
1054 if (severity == ErrorSeverity.ERROR) {
1055 _failure = true;
Leaf 2017/03/30 19:39:59 I don't think we want to set _failure for these er
Brian Wilkerson 2017/03/30 19:45:18 Done
1056 }
1051 if (severity != ErrorSeverity.INFO || _options.strongModeHints) { 1057 if (severity != ErrorSeverity.INFO || _options.strongModeHints) {
1052 int begin = node is AnnotatedNode 1058 int begin = node is AnnotatedNode
1053 ? node.firstTokenAfterCommentAndMetadata.offset 1059 ? node.firstTokenAfterCommentAndMetadata.offset
1054 : node.offset; 1060 : node.offset;
1055 int length = node.end - begin; 1061 int length = node.end - begin;
1056 var source = resolutionMap 1062 var source = resolutionMap
1057 .elementDeclaredByCompilationUnit(node.root as CompilationUnit) 1063 .elementDeclaredByCompilationUnit(node.root as CompilationUnit)
1058 .source; 1064 .source;
1059 var error = 1065 var error =
1060 new AnalysisError(source, begin, length, errorCode, arguments); 1066 new AnalysisError(source, begin, length, errorCode, arguments);
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 var visited = new Set<InterfaceType>(); 1563 var visited = new Set<InterfaceType>();
1558 do { 1564 do {
1559 visited.add(current); 1565 visited.add(current);
1560 current.mixins.reversed.forEach( 1566 current.mixins.reversed.forEach(
1561 (m) => _checkIndividualOverridesFromClass(node, m, seen, true)); 1567 (m) => _checkIndividualOverridesFromClass(node, m, seen, true));
1562 _checkIndividualOverridesFromClass(node, current.superclass, seen, true); 1568 _checkIndividualOverridesFromClass(node, current.superclass, seen, true);
1563 current = current.superclass; 1569 current = current.superclass;
1564 } while (!current.isObject && !visited.contains(current)); 1570 } while (!current.isObject && !visited.contains(current));
1565 } 1571 }
1566 } 1572 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/error/codes.dart ('k') | pkg/analyzer/test/generated/hint_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698