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

Side by Side Diff: pkg/analyzer_experimental/lib/src/generated/source_io.dart

Issue 12604020: analyzer_experimental checkpoint and AnalysisContext example. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't mark Source as 'changed'. Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 3
4 library engine.source.io; 4 library engine.source.io;
5 5
6 import 'source.dart'; 6 import 'source.dart';
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:uri'; 8 import 'dart:uri';
9 import 'java_core.dart'; 9 import 'java_core.dart';
10 import 'java_io.dart'; 10 import 'java_io.dart';
11 import 'package:analyzer_experimental/src/generated/sdk.dart' show DartSdk; 11 import 'sdk.dart' show DartSdk;
12 import 'engine.dart' show AnalysisContext;
12 export 'source.dart'; 13 export 'source.dart';
13 14
14 /** 15 /**
15 * Instances of the class {@code FileBasedSource} implement a source that repres ents a file. 16 * Instances of the class {@code FileBasedSource} implement a source that repres ents a file.
16 * @coverage dart.engine.source 17 * @coverage dart.engine.source
17 */ 18 */
18 class FileBasedSource implements Source { 19 class FileBasedSource implements Source {
19 /** 20 /**
20 * The source factory that created this source and that should be used to reso lve URI's against 21 * The source factory that created this source and that should be used to reso lve URI's against
21 * this source. 22 * this source.
22 */ 23 */
23 SourceFactory _factory; 24 SourceFactory _factory;
24 /** 25 /**
25 * The file represented by this source. 26 * The file represented by this source.
26 */ 27 */
27 JavaFile _file; 28 JavaFile _file;
28 /** 29 /**
29 * A flag indicating whether this source is in one of the system libraries. 30 * A flag indicating whether this source is in one of the system libraries.
30 */ 31 */
31 bool _inSystemLibrary = false; 32 bool _inSystemLibrary = false;
32 /** 33 /**
33 * Initialize a newly created source object. The source object is assumed to n ot be in a system 34 * Initialize a newly created source object. The source object is assumed to n ot be in a system
34 * library. 35 * library.
35 * @param factory the source factory that created this source 36 * @param factory the source factory that created this source
36 * @param file the file represented by this source 37 * @param file the file represented by this source
37 */ 38 */
38 FileBasedSource.con1(SourceFactory factory, JavaFile file) { 39 FileBasedSource.con1(SourceFactory factory, JavaFile file) {
39 _jtd_constructor_296_impl(factory, file); 40 _jtd_constructor_298_impl(factory, file);
40 } 41 }
41 _jtd_constructor_296_impl(SourceFactory factory, JavaFile file) { 42 _jtd_constructor_298_impl(SourceFactory factory, JavaFile file) {
42 _jtd_constructor_297_impl(factory, file, false); 43 _jtd_constructor_299_impl(factory, file, false);
43 } 44 }
44 /** 45 /**
45 * Initialize a newly created source object. 46 * Initialize a newly created source object.
46 * @param factory the source factory that created this source 47 * @param factory the source factory that created this source
47 * @param file the file represented by this source 48 * @param file the file represented by this source
48 * @param inSystemLibrary {@code true} if this source is in one of the system libraries 49 * @param inSystemLibrary {@code true} if this source is in one of the system libraries
49 */ 50 */
50 FileBasedSource.con2(SourceFactory factory2, JavaFile file3, bool inSystemLibr ary2) { 51 FileBasedSource.con2(SourceFactory factory2, JavaFile file3, bool inSystemLibr ary2) {
51 _jtd_constructor_297_impl(factory2, file3, inSystemLibrary2); 52 _jtd_constructor_299_impl(factory2, file3, inSystemLibrary2);
52 } 53 }
53 _jtd_constructor_297_impl(SourceFactory factory2, JavaFile file3, bool inSyste mLibrary2) { 54 _jtd_constructor_299_impl(SourceFactory factory2, JavaFile file3, bool inSyste mLibrary2) {
54 this._factory = factory2; 55 this._factory = factory2;
55 this._file = file3; 56 this._file = file3;
56 this._inSystemLibrary = inSystemLibrary2; 57 this._inSystemLibrary = inSystemLibrary2;
57 } 58 }
58 bool operator ==(Object object) => object != null && identical(this.runtimeTyp e, object.runtimeType) && _file == ((object as FileBasedSource))._file; 59 bool operator ==(Object object) => object != null && identical(this.runtimeTyp e, object.runtimeType) && _file == ((object as FileBasedSource))._file;
59 bool exists() => _file.exists(); 60 bool exists() => _file.exists();
61 AnalysisContext get context => _factory.context;
60 void getContents(Source_ContentReceiver receiver) { 62 void getContents(Source_ContentReceiver receiver) {
61 { 63 {
62 String contents = _factory.getContents(this); 64 String contents = _factory.getContents(this);
63 if (contents != null) { 65 if (contents != null) {
64 receiver.accept2(contents); 66 receiver.accept2(contents);
65 return; 67 return;
66 } 68 }
67 } 69 }
68 receiver.accept2(_file.readAsStringSync()); 70 receiver.accept2(_file.readAsStringSync());
69 } 71 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 * @param sdk the Dart SDK against which URI's are to be resolved 128 * @param sdk the Dart SDK against which URI's are to be resolved
127 */ 129 */
128 DartUriResolver(DartSdk sdk) { 130 DartUriResolver(DartSdk sdk) {
129 this._sdk = sdk; 131 this._sdk = sdk;
130 } 132 }
131 Source resolveAbsolute(SourceFactory factory, Uri uri) { 133 Source resolveAbsolute(SourceFactory factory, Uri uri) {
132 if (!isDartUri(uri)) { 134 if (!isDartUri(uri)) {
133 return null; 135 return null;
134 } 136 }
135 JavaFile resolvedFile = _sdk.mapDartUri(uri.toString()); 137 JavaFile resolvedFile = _sdk.mapDartUri(uri.toString());
138 if (resolvedFile == null) {
139 return null;
140 }
136 return new FileBasedSource.con2(factory, resolvedFile, true); 141 return new FileBasedSource.con2(factory, resolvedFile, true);
137 } 142 }
138 } 143 }
139 /** 144 /**
140 * Instances of the class {@code PackageUriResolver} resolve {@code package} URI 's in the context of 145 * Instances of the class {@code PackageUriResolver} resolve {@code package} URI 's in the context of
141 * an application. 146 * an application.
142 * @coverage dart.engine.source 147 * @coverage dart.engine.source
143 */ 148 */
144 class PackageUriResolver extends UriResolver { 149 class PackageUriResolver extends UriResolver {
145 /** 150 /**
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 /** 214 /**
210 * The container's path (not {@code null}). 215 * The container's path (not {@code null}).
211 */ 216 */
212 String _path; 217 String _path;
213 /** 218 /**
214 * Construct a container representing the specified directory and containing a ny sources whose{@link Source#getFullName()} starts with the directory's path. T his is a convenience method, 219 * Construct a container representing the specified directory and containing a ny sources whose{@link Source#getFullName()} starts with the directory's path. T his is a convenience method,
215 * fully equivalent to {@link DirectoryBasedSourceContainer#DirectoryBasedSour ceContainer(String)}. 220 * fully equivalent to {@link DirectoryBasedSourceContainer#DirectoryBasedSour ceContainer(String)}.
216 * @param directory the directory (not {@code null}) 221 * @param directory the directory (not {@code null})
217 */ 222 */
218 DirectoryBasedSourceContainer.con1(JavaFile directory) { 223 DirectoryBasedSourceContainer.con1(JavaFile directory) {
219 _jtd_constructor_294_impl(directory); 224 _jtd_constructor_296_impl(directory);
220 } 225 }
221 _jtd_constructor_294_impl(JavaFile directory) { 226 _jtd_constructor_296_impl(JavaFile directory) {
222 _jtd_constructor_295_impl(directory.getPath()); 227 _jtd_constructor_297_impl(directory.getPath());
223 } 228 }
224 /** 229 /**
225 * Construct a container representing the specified path and containing any so urces whose{@link Source#getFullName()} starts with the specified path. 230 * Construct a container representing the specified path and containing any so urces whose{@link Source#getFullName()} starts with the specified path.
226 * @param path the path (not {@code null} and not empty) 231 * @param path the path (not {@code null} and not empty)
227 */ 232 */
228 DirectoryBasedSourceContainer.con2(String path3) { 233 DirectoryBasedSourceContainer.con2(String path3) {
229 _jtd_constructor_295_impl(path3); 234 _jtd_constructor_297_impl(path3);
230 } 235 }
231 _jtd_constructor_295_impl(String path3) { 236 _jtd_constructor_297_impl(String path3) {
232 this._path = appendFileSeparator(path3); 237 this._path = appendFileSeparator(path3);
233 } 238 }
234 bool contains(Source source) => source.fullName.startsWith(_path); 239 bool contains(Source source) => source.fullName.startsWith(_path);
235 bool operator ==(Object obj) => (obj is DirectoryBasedSourceContainer) && ((ob j as DirectoryBasedSourceContainer)).path == path; 240 bool operator ==(Object obj) => (obj is DirectoryBasedSourceContainer) && ((ob j as DirectoryBasedSourceContainer)).path == path;
236 /** 241 /**
237 * Answer the receiver's path, used to determine if a source is contained in t he receiver. 242 * Answer the receiver's path, used to determine if a source is contained in t he receiver.
238 * @return the path (not {@code null}, not empty) 243 * @return the path (not {@code null}, not empty)
239 */ 244 */
240 String get path => _path; 245 String get path => _path;
241 int get hashCode => _path.hashCode; 246 int get hashCode => _path.hashCode;
(...skipping 19 matching lines...) Expand all
261 */ 266 */
262 FileUriResolver() : super() { 267 FileUriResolver() : super() {
263 } 268 }
264 Source resolveAbsolute(SourceFactory factory, Uri uri) { 269 Source resolveAbsolute(SourceFactory factory, Uri uri) {
265 if (!isFileUri(uri)) { 270 if (!isFileUri(uri)) {
266 return null; 271 return null;
267 } 272 }
268 return new FileBasedSource.con1(factory, new JavaFile.fromUri(uri)); 273 return new FileBasedSource.con1(factory, new JavaFile.fromUri(uri));
269 } 274 }
270 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698