| 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.source; | 8 library engine.source; |
| 9 | 9 |
| 10 import "dart:math" as math; | 10 import "dart:math" as math; |
| 11 import 'dart:collection'; | 11 import 'dart:collection'; |
| 12 | 12 |
| 13 import 'package:analyzer/file_system/file_system.dart'; | 13 import 'package:analyzer/file_system/file_system.dart'; |
| 14 import 'package:analyzer/source/package_map_resolver.dart'; | 14 import 'package:analyzer/source/package_map_resolver.dart'; |
| 15 import 'package:analyzer/task/model.dart'; |
| 15 | 16 |
| 16 import 'engine.dart'; | 17 import 'engine.dart'; |
| 17 import 'java_core.dart'; | 18 import 'java_core.dart'; |
| 18 import 'java_engine.dart'; | 19 import 'java_engine.dart'; |
| 19 import 'sdk.dart' show DartSdk; | 20 import 'sdk.dart' show DartSdk; |
| 20 | 21 |
| 21 /** | 22 /** |
| 22 * A function that is used to handle [ContentCache] entries. | 23 * A function that is used to handle [ContentCache] entries. |
| 23 */ | 24 */ |
| 24 typedef void ContentCacheVisitor(Source source, int stamp, String contents); | 25 typedef void ContentCacheVisitor(Source source, int stamp, String contents); |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 303 } |
| 303 | 304 |
| 304 class LocalSourcePredicate_TRUE implements LocalSourcePredicate { | 305 class LocalSourcePredicate_TRUE implements LocalSourcePredicate { |
| 305 @override | 306 @override |
| 306 bool isLocal(Source source) => true; | 307 bool isLocal(Source source) => true; |
| 307 } | 308 } |
| 308 | 309 |
| 309 /** | 310 /** |
| 310 * An implementation of an non-existing [Source]. | 311 * An implementation of an non-existing [Source]. |
| 311 */ | 312 */ |
| 312 class NonExistingSource implements Source { | 313 class NonExistingSource extends Source { |
| 313 final String _name; | 314 final String _name; |
| 314 | 315 |
| 315 final UriKind uriKind; | 316 final UriKind uriKind; |
| 316 | 317 |
| 317 NonExistingSource(this._name, this.uriKind); | 318 NonExistingSource(this._name, this.uriKind); |
| 318 | 319 |
| 319 @override | 320 @override |
| 320 TimestampedData<String> get contents { | 321 TimestampedData<String> get contents { |
| 321 throw new UnsupportedOperationException("${_name}does not exist."); | 322 throw new UnsupportedOperationException("${_name}does not exist."); |
| 322 } | 323 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 * Because of these assumptions, most implementations will not maintain any stat
e but will delegate | 376 * Because of these assumptions, most implementations will not maintain any stat
e but will delegate |
| 376 * to an authoritative system of record in order to implement this API. For exam
ple, a source that | 377 * to an authoritative system of record in order to implement this API. For exam
ple, a source that |
| 377 * represents files on disk would typically query the file system to determine t
he state of the | 378 * represents files on disk would typically query the file system to determine t
he state of the |
| 378 * file. | 379 * file. |
| 379 * | 380 * |
| 380 * If the instances that implement this API are the system of record, then they
will typically be | 381 * If the instances that implement this API are the system of record, then they
will typically be |
| 381 * unique. In that case, sources that are created that represent non-existent fi
les must also be | 382 * unique. In that case, sources that are created that represent non-existent fi
les must also be |
| 382 * retained so that if those files are created at a later date the long-lived so
urces representing | 383 * retained so that if those files are created at a later date the long-lived so
urces representing |
| 383 * those files will know that they now exist. | 384 * those files will know that they now exist. |
| 384 */ | 385 */ |
| 385 abstract class Source { | 386 abstract class Source implements AnalysisTarget { |
| 386 /** | 387 /** |
| 387 * An empty list of sources. | 388 * An empty list of sources. |
| 388 */ | 389 */ |
| 389 static const List<Source> EMPTY_ARRAY = const <Source>[]; | 390 static const List<Source> EMPTY_ARRAY = const <Source>[]; |
| 390 | 391 |
| 391 /** | 392 /** |
| 392 * Get the contents and timestamp of this source. | 393 * Get the contents and timestamp of this source. |
| 393 * | 394 * |
| 394 * Clients should consider using the the method [AnalysisContext.getContents] | 395 * Clients should consider using the the method [AnalysisContext.getContents] |
| 395 * because contexts can have local overrides of the content of a source that t
he source is not | 396 * because contexts can have local overrides of the content of a source that t
he source is not |
| 396 * aware of. | 397 * aware of. |
| 397 * | 398 * |
| 398 * @return the contents and timestamp of the source | 399 * @return the contents and timestamp of the source |
| 399 * @throws Exception if the contents of this source could not be accessed | 400 * @throws Exception if the contents of this source could not be accessed |
| 400 */ | 401 */ |
| 401 TimestampedData<String> get contents; | 402 TimestampedData<String> get contents; |
| 402 | 403 |
| 403 /** | 404 /** |
| 404 * Return an encoded representation of this source that can be used to create
a source that is | 405 * Return an encoded representation of this source that can be used to create
a source that is |
| 405 * equal to this source. | 406 * equal to this source. |
| 406 * | 407 * |
| 407 * @return an encoded representation of this source | 408 * @return an encoded representation of this source |
| 408 * See [SourceFactory.fromEncoding]. | 409 * See [SourceFactory.fromEncoding]. |
| 409 */ | 410 */ |
| 410 String get encoding; | 411 String get encoding; |
| 411 | 412 |
| 413 @override |
| 414 Source get source => this; |
| 415 |
| 412 /** | 416 /** |
| 413 * Return the full (long) version of the name that can be displayed to the use
r to denote this | 417 * Return the full (long) version of the name that can be displayed to the use
r to denote this |
| 414 * source. For example, for a source representing a file this would typically
be the absolute path | 418 * source. For example, for a source representing a file this would typically
be the absolute path |
| 415 * of the file. | 419 * of the file. |
| 416 * | 420 * |
| 417 * @return a name that can be displayed to the user to denote this source | 421 * @return a name that can be displayed to the user to denote this source |
| 418 */ | 422 */ |
| 419 String get fullName; | 423 String get fullName; |
| 420 | 424 |
| 421 /** | 425 /** |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 | 984 |
| 981 /** | 985 /** |
| 982 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot | 986 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot |
| 983 * be computed. | 987 * be computed. |
| 984 * | 988 * |
| 985 * @param source the source to get URI for | 989 * @param source the source to get URI for |
| 986 * @return the absolute URI representing the given source | 990 * @return the absolute URI representing the given source |
| 987 */ | 991 */ |
| 988 Uri restoreAbsolute(Source source) => null; | 992 Uri restoreAbsolute(Source source) => null; |
| 989 } | 993 } |
| OLD | NEW |