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

Unified Diff: lib/strong_mode.dart

Issue 1401273002: Move DDC to analyzer-based checker (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: rebase Created 5 years, 2 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
« no previous file with comments | « lib/src/utils.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/strong_mode.dart
diff --git a/lib/strong_mode.dart b/lib/strong_mode.dart
index 99cef5c7dc78730b16f29726202972898880a64d..45d17ab50ff9b0327d8099e7d06125324bc89123 100644
--- a/lib/strong_mode.dart
+++ b/lib/strong_mode.dart
@@ -31,6 +31,7 @@ import 'src/checker/rules.dart' show TypeRules;
/// A type checker for Dart code that operates under stronger rules, and has
/// the ability to do local type inference in some situations.
+// TODO(jmesserly): remove this class.
class StrongChecker {
final AnalysisContext _context;
final CodeChecker _checker;
@@ -41,25 +42,28 @@ class StrongChecker {
factory StrongChecker(AnalysisContext context, StrongModeOptions options) {
// TODO(vsm): Remove this once analyzer_cli is completely switched to the
// task model.
- if (!AnalysisEngine
- .instance.useTaskModel) enableDevCompilerInference(context, options);
- var rules = new TypeRules(context.typeProvider, options: options);
- var reporter = new _ErrorCollector(options.hints);
- var checker = new CodeChecker(rules, reporter);
- return new StrongChecker._(context, checker, reporter);
+ if (!AnalysisEngine.instance.useTaskModel) {
+ enableDevCompilerInference(context, options);
+ var rules = new TypeRules(context.typeProvider);
+ var reporter = new _ErrorCollector(options.hints);
+ var checker = new CodeChecker(rules, reporter);
+ return new StrongChecker._(context, checker, reporter);
+ }
+ return new StrongChecker._(context, null, null);
}
/// Computes and returns DDC errors for the [source].
AnalysisErrorInfo computeErrors(Source source) {
var errors = new List<AnalysisError>();
- _reporter.errors = errors;
-
- for (Source librarySource in _context.getLibrariesContaining(source)) {
- var resolved = _context.resolveCompilationUnit2(source, librarySource);
- _checker.visitCompilationUnit(resolved);
+ if (_checker != null) {
+ _reporter.errors = errors;
+
+ for (Source librarySource in _context.getLibrariesContaining(source)) {
+ var resolved = _context.resolveCompilationUnit2(source, librarySource);
+ _checker.visitCompilationUnit(resolved);
+ }
+ _reporter.errors = null;
}
- _reporter.errors = null;
-
return new AnalysisErrorInfoImpl(errors, _context.getLineInfo(source));
}
}
« no previous file with comments | « lib/src/utils.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698