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

Unified Diff: pkg/analyzer/lib/source/analysis_options_provider.dart

Issue 1413973003: Analysis Options processing task and manager. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: No partial results fix. 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 | « pkg/analysis_server/test/context_manager_test.dart ('k') | pkg/analyzer/lib/src/generated/error.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/source/analysis_options_provider.dart
diff --git a/pkg/analyzer/lib/source/analysis_options_provider.dart b/pkg/analyzer/lib/source/analysis_options_provider.dart
index aeac0531ecd0900f04baa9823592b8be49697002..2c5dfdcc49a9fe7b4f2533e0b45cb32ae899a2e9 100644
--- a/pkg/analyzer/lib/source/analysis_options_provider.dart
+++ b/pkg/analyzer/lib/source/analysis_options_provider.dart
@@ -6,6 +6,7 @@ library source.analysis_options_provider;
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/generated/engine.dart';
+import 'package:source_span/source_span.dart';
import 'package:yaml/yaml.dart';
/// Provide the options found in the `.analysis_options` file.
@@ -34,17 +35,19 @@ class AnalysisOptionsProvider {
}
var doc = loadYaml(optionsSource);
if ((doc != null) && (doc is! YamlMap)) {
- throw new Exception(
+ throw new OptionsFormatException(
'Bad options file format (expected map, got ${doc.runtimeType})\n'
'contents of options file:\n'
- '$optionsSource\n');
+ '$optionsSource\n',
+ doc.span);
}
if (doc is YamlMap) {
doc.forEach((k, v) {
if (k is! String) {
- throw new Exception(
+ throw new OptionsFormatException(
'Bad options file format (expected String scope key, '
- 'got ${k.runtimeType})');
+ 'got ${k.runtimeType})',
+ k != null ? k.span : doc.span);
}
options[k] = v;
});
@@ -63,3 +66,14 @@ class AnalysisOptionsProvider {
}
}
}
+
+/// Thrown on options format exceptions.
+class OptionsFormatException implements Exception {
+ final String message;
+ final SourceSpan span;
+ OptionsFormatException(this.message, [this.span]);
+
+ @override
+ String toString() =>
+ 'OptionsFormatException: ${message?.toString()}, ${span?.toString()}';
+}
« no previous file with comments | « pkg/analysis_server/test/context_manager_test.dart ('k') | pkg/analyzer/lib/src/generated/error.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698