| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:front_end/src/base/analysis_target.dart'; | 5 import 'package:front_end/src/base/analysis_target.dart'; |
| 6 import 'package:front_end/src/base/timestamped_data.dart'; | 6 import 'package:front_end/src/base/timestamped_data.dart'; |
| 7 import 'package:front_end/src/base/uri_kind.dart'; | 7 import 'package:front_end/src/base/uri_kind.dart'; |
| 8 import 'package:source_span/source_span.dart' as source_span; |
| 8 | 9 |
| 9 /** | 10 /** |
| 10 * The interface `Source` defines the behavior of objects representing source co
de that can be | 11 * The interface `Source` defines the behavior of objects representing source co
de that can be |
| 11 * analyzed by the analysis engine. | 12 * analyzed by the analysis engine. |
| 12 * | 13 * |
| 13 * Implementations of this interface need to be aware of some assumptions made b
y the analysis | 14 * Implementations of this interface need to be aware of some assumptions made b
y the analysis |
| 14 * engine concerning sources: | 15 * engine concerning sources: |
| 15 * * Sources are not required to be unique. That is, there can be multiple insta
nces representing | 16 * * Sources are not required to be unique. That is, there can be multiple insta
nces representing |
| 16 * the same source. | 17 * the same source. |
| 17 * * Sources are long lived. That is, the engine is allowed to hold on to a sour
ce for an extended | 18 * * Sources are long lived. That is, the engine is allowed to hold on to a sour
ce for an extended |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 * example, for a source representing a file this would typically be the name
of the file. | 101 * example, for a source representing a file this would typically be the name
of the file. |
| 101 * | 102 * |
| 102 * @return a name that can be displayed to the user to denote this source | 103 * @return a name that can be displayed to the user to denote this source |
| 103 */ | 104 */ |
| 104 String get shortName; | 105 String get shortName; |
| 105 | 106 |
| 106 @override | 107 @override |
| 107 Source get source => this; | 108 Source get source => this; |
| 108 | 109 |
| 109 /** | 110 /** |
| 111 * Return the [source_span.SourceFile] object corresponding to this source. |
| 112 */ |
| 113 source_span.SourceFile get sourceFile; |
| 114 |
| 115 /** |
| 110 * Return the URI from which this source was originally derived. | 116 * Return the URI from which this source was originally derived. |
| 111 * | 117 * |
| 112 * @return the URI from which this source was originally derived | 118 * @return the URI from which this source was originally derived |
| 113 */ | 119 */ |
| 114 Uri get uri; | 120 Uri get uri; |
| 115 | 121 |
| 116 /** | 122 /** |
| 117 * Return the kind of URI from which this source was originally derived. If th
is source was | 123 * Return the kind of URI from which this source was originally derived. If th
is source was |
| 118 * created from an absolute URI, then the returned kind will reflect the schem
e of the absolute | 124 * created from an absolute URI, then the returned kind will reflect the schem
e of the absolute |
| 119 * URI. If it was created from a relative URI, then the returned kind will be
the same as the kind | 125 * URI. If it was created from a relative URI, then the returned kind will be
the same as the kind |
| (...skipping 19 matching lines...) Expand all Loading... |
| 139 * Return `true` if this source exists. | 145 * Return `true` if this source exists. |
| 140 * | 146 * |
| 141 * Clients should consider using the method [AnalysisContext.exists] because | 147 * Clients should consider using the method [AnalysisContext.exists] because |
| 142 * contexts can have local overrides of the content of a source that the sourc
e is not aware of | 148 * contexts can have local overrides of the content of a source that the sourc
e is not aware of |
| 143 * and a source with local content is considered to exist even if there is no
file on disk. | 149 * and a source with local content is considered to exist even if there is no
file on disk. |
| 144 * | 150 * |
| 145 * @return `true` if this source exists | 151 * @return `true` if this source exists |
| 146 */ | 152 */ |
| 147 bool exists(); | 153 bool exists(); |
| 148 } | 154 } |
| OLD | NEW |