Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.src.generated.source; | 5 library analyzer.src.generated.source; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 /** | 170 /** |
| 171 * Return `true` if the given URI is a `dart:` URI. | 171 * Return `true` if the given URI is a `dart:` URI. |
| 172 * | 172 * |
| 173 * @param uri the URI being tested | 173 * @param uri the URI being tested |
| 174 * @return `true` if the given URI is a `dart:` URI | 174 * @return `true` if the given URI is a `dart:` URI |
| 175 */ | 175 */ |
| 176 static bool isDartUri(Uri uri) => DART_SCHEME == uri.scheme; | 176 static bool isDartUri(Uri uri) => DART_SCHEME == uri.scheme; |
| 177 } | 177 } |
| 178 | 178 |
| 179 /** | 179 /** |
| 180 * Information about analysis `//ignore:` comments within a source file. | |
| 181 */ | |
| 182 class IgnoreInfo { | |
|
scheglov
2016/05/27 18:05:47
This could live in src/dart.dart
pquitslund
2016/05/27 21:50:53
Done.
| |
| 183 final Map<int, List<String>> _ignoreMap = new HashMap<int, List<String>>(); | |
| 184 | |
| 185 /** | |
| 186 * Map of line numbers to associated ignored error codes. | |
| 187 */ | |
| 188 Map<int, Iterable<String>> get ignores => _ignoreMap; | |
| 189 | |
| 190 /** | |
| 191 * Ignore this [errorCode] at [line]. | |
| 192 */ | |
| 193 void add(int line, String errorCode) { | |
| 194 _ignoreMap.putIfAbsent(line, () => new List<String>()).add(errorCode); | |
| 195 } | |
| 196 | |
| 197 /** | |
| 198 * Whether this info object defines any ignores. | |
| 199 */ | |
| 200 bool get hasIgnores => ignores.length > 0; | |
|
scheglov
2016/05/27 18:05:47
=> ignores.isNotEmpty;
pquitslund
2016/05/27 21:50:53
Done.
| |
| 201 | |
| 202 /** | |
| 203 * Test whether this [errorCode] is ignored at the given [line]. | |
| 204 */ | |
| 205 bool ignoredAt(String errorCode, int line) => | |
| 206 _ignoreMap[line]?.contains(errorCode) == true; | |
| 207 } | |
| 208 | |
| 209 /** | |
| 180 * Information about line and column information within a source file. | 210 * Information about line and column information within a source file. |
| 181 */ | 211 */ |
| 182 class LineInfo { | 212 class LineInfo { |
| 183 /** | 213 /** |
| 184 * A list containing the offsets of the first character of each line in the | 214 * A list containing the offsets of the first character of each line in the |
| 185 * source code. | 215 * source code. |
| 186 */ | 216 */ |
| 187 final List<int> _lineStarts; | 217 final List<int> _lineStarts; |
| 188 | 218 |
| 189 /** | 219 /** |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 930 Source resolveAbsolute(Uri uri, [Uri actualUri]); | 960 Source resolveAbsolute(Uri uri, [Uri actualUri]); |
| 931 | 961 |
| 932 /** | 962 /** |
| 933 * Return an absolute URI that represents the given [source], or `null` if a | 963 * Return an absolute URI that represents the given [source], or `null` if a |
| 934 * valid URI cannot be computed. | 964 * valid URI cannot be computed. |
| 935 * | 965 * |
| 936 * The computation should be based solely on [source.fullName]. | 966 * The computation should be based solely on [source.fullName]. |
| 937 */ | 967 */ |
| 938 Uri restoreAbsolute(Source source) => null; | 968 Uri restoreAbsolute(Source source) => null; |
| 939 } | 969 } |
| OLD | NEW |