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

Side by Side Diff: pkg/analyzer/lib/source/analysis_options_provider.dart

Issue 2299243002: Revert "Remove unnecessary hide clauses" (Closed)
Patch Set: Created 4 years, 3 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
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 library analyzer.source.analysis_options_provider; 5 library analyzer.source.analysis_options_provider;
6 6
7 import 'dart:core'; 7 import 'dart:core' hide Resource;
8 8
9 import 'package:analyzer/file_system/file_system.dart'; 9 import 'package:analyzer/file_system/file_system.dart';
10 import 'package:analyzer/src/generated/engine.dart'; 10 import 'package:analyzer/src/generated/engine.dart';
11 import 'package:analyzer/src/util/yaml.dart'; 11 import 'package:analyzer/src/util/yaml.dart';
12 import 'package:source_span/source_span.dart'; 12 import 'package:source_span/source_span.dart';
13 import 'package:yaml/yaml.dart'; 13 import 'package:yaml/yaml.dart';
14 14
15 /// Provide the options found in the analysis options file. 15 /// Provide the options found in the analysis options file.
16 class AnalysisOptionsProvider { 16 class AnalysisOptionsProvider {
17 /// Provide the options found in either 17 /// Provide the options found in either
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 YamlNode safelyLoadYamlNode() { 52 YamlNode safelyLoadYamlNode() {
53 try { 53 try {
54 return loadYamlNode(optionsSource); 54 return loadYamlNode(optionsSource);
55 } on YamlException catch (e) { 55 } on YamlException catch (e) {
56 throw new OptionsFormatException(e.message, e.span); 56 throw new OptionsFormatException(e.message, e.span);
57 } catch (e) { 57 } catch (e) {
58 throw new OptionsFormatException('Unable to parse YAML document.'); 58 throw new OptionsFormatException('Unable to parse YAML document.');
59 } 59 }
60 } 60 }
61
62 YamlNode doc = safelyLoadYamlNode(); 61 YamlNode doc = safelyLoadYamlNode();
63 62
64 // Empty options. 63 // Empty options.
65 if (doc is YamlScalar && doc.value == null) { 64 if (doc is YamlScalar && doc.value == null) {
66 return options; 65 return options;
67 } 66 }
68 if ((doc != null) && (doc is! YamlMap)) { 67 if ((doc != null) && (doc is! YamlMap)) {
69 throw new OptionsFormatException( 68 throw new OptionsFormatException(
70 'Bad options file format (expected map, got ${doc.runtimeType})', 69 'Bad options file format (expected map, got ${doc.runtimeType})',
71 doc.span); 70 doc.span);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 /// Thrown on options format exceptions. 124 /// Thrown on options format exceptions.
126 class OptionsFormatException implements Exception { 125 class OptionsFormatException implements Exception {
127 final String message; 126 final String message;
128 final SourceSpan span; 127 final SourceSpan span;
129 OptionsFormatException(this.message, [this.span]); 128 OptionsFormatException(this.message, [this.span]);
130 129
131 @override 130 @override
132 String toString() => 131 String toString() =>
133 'OptionsFormatException: ${message?.toString()}, ${span?.toString()}'; 132 'OptionsFormatException: ${message?.toString()}, ${span?.toString()}';
134 } 133 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/file_system/physical_file_system.dart ('k') | pkg/analyzer/lib/source/embedder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698