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

Side by Side Diff: lib/src/checker/resolver.dart

Issue 1133663006: Promote analyzer warnings to ddc errors (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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 | no next file » | 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 /// Encapsulates how to invoke the analyzer resolver and overrides how it 5 /// Encapsulates how to invoke the analyzer resolver and overrides how it
6 /// computes types on expressions to use our restricted set of types. 6 /// computes types on expressions to use our restricted set of types.
7 library dev_compiler.src.checker.resolver; 7 library dev_compiler.src.checker.resolver;
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 reporter.log(message); 104 reporter.log(message);
105 } 105 }
106 } 106 }
107 return failure; 107 return failure;
108 } 108 }
109 } 109 }
110 110
111 class AnalyzerError extends Message { 111 class AnalyzerError extends Message {
112 factory AnalyzerError.from(analyzer.AnalysisError error) { 112 factory AnalyzerError.from(analyzer.AnalysisError error) {
113 var severity = error.errorCode.type.severity; 113 var severity = error.errorCode.type.severity;
114 var isError = severity == analyzer.ErrorSeverity.ERROR; 114 var isError = severity == analyzer.ErrorSeverity.WARNING;
115 var level = isError ? logger.Level.SEVERE : logger.Level.WARNING; 115 var level = isError ? logger.Level.SEVERE : logger.Level.WARNING;
116 int begin = error.offset; 116 int begin = error.offset;
117 int end = begin + error.length; 117 int end = begin + error.length;
118 return new AnalyzerError(error.message, level, begin, end); 118 return new AnalyzerError(error.message, level, begin, end);
119 } 119 }
120 120
121 const AnalyzerError(String message, logger.Level level, int begin, int end) 121 const AnalyzerError(String message, logger.Level level, int begin, int end)
122 : super('[from analyzer]: $message', level, begin, end); 122 : super(message, level, begin, end);
123 } 123 }
124 124
125 /// Creates an analysis context that contains our restricted typing rules. 125 /// Creates an analysis context that contains our restricted typing rules.
126 InternalAnalysisContext _initContext(ResolverOptions options) { 126 InternalAnalysisContext _initContext(ResolverOptions options) {
127 var analysisOptions = new AnalysisOptionsImpl()..cacheSize = 512; 127 var analysisOptions = new AnalysisOptionsImpl()..cacheSize = 512;
128 AnalysisContextImpl res = AnalysisEngine.instance.createAnalysisContext(); 128 AnalysisContextImpl res = AnalysisEngine.instance.createAnalysisContext();
129 res.analysisOptions = analysisOptions; 129 res.analysisOptions = analysisOptions;
130 res.libraryResolverFactory = 130 res.libraryResolverFactory =
131 (context) => new LibraryResolverWithInference(context, options); 131 (context) => new LibraryResolverWithInference(context, options);
132 return res; 132 return res;
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 } 788 }
789 } 789 }
790 790
791 // Review note: no longer need to override visitFunctionExpression, this is 791 // Review note: no longer need to override visitFunctionExpression, this is
792 // handled by the analyzer internally. 792 // handled by the analyzer internally.
793 // TODO(vsm): in visitbinaryExpression: check computeStaticReturnType result? 793 // TODO(vsm): in visitbinaryExpression: check computeStaticReturnType result?
794 // TODO(vsm): in visitFunctionDeclaration: Should we ever use the expression 794 // TODO(vsm): in visitFunctionDeclaration: Should we ever use the expression
795 // type in a (...) => expr or just the written type? 795 // type in a (...) => expr or just the written type?
796 796
797 } 797 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698