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

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

Issue 18129004: Simplify constructors translation, improve code style. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 library engine.source.io; 3 library engine.source.io;
4 import 'source.dart'; 4 import 'source.dart';
5 import 'dart:io'; 5 import 'dart:io';
6 import 'java_core.dart'; 6 import 'java_core.dart';
7 import 'java_io.dart'; 7 import 'java_io.dart';
8 import 'sdk.dart' show DartSdk; 8 import 'sdk.dart' show DartSdk;
9 import 'engine.dart' show AnalysisContext, AnalysisEngine; 9 import 'engine.dart' show AnalysisContext, AnalysisEngine;
10 export 'source.dart'; 10 export 'source.dart';
(...skipping 25 matching lines...) Expand all
36 */ 36 */
37 UriKind _uriKind; 37 UriKind _uriKind;
38 38
39 /** 39 /**
40 * Initialize a newly created source object. The source object is assumed to n ot be in a system 40 * Initialize a newly created source object. The source object is assumed to n ot be in a system
41 * library. 41 * library.
42 * 42 *
43 * @param contentCache the content cache used to access the contents of this s ource 43 * @param contentCache the content cache used to access the contents of this s ource
44 * @param file the file represented by this source 44 * @param file the file represented by this source
45 */ 45 */
46 FileBasedSource.con1(ContentCache contentCache, JavaFile file) { 46 FileBasedSource.con1(ContentCache contentCache, JavaFile file) : this.con2(con tentCache, file, UriKind.FILE_URI);
47 _jtd_constructor_343_impl(contentCache, file);
48 }
49 _jtd_constructor_343_impl(ContentCache contentCache, JavaFile file) {
50 _jtd_constructor_344_impl(contentCache, file, UriKind.FILE_URI);
51 }
52 47
53 /** 48 /**
54 * Initialize a newly created source object. 49 * Initialize a newly created source object.
55 * 50 *
56 * @param contentCache the content cache used to access the contents of this s ource 51 * @param contentCache the content cache used to access the contents of this s ource
57 * @param file the file represented by this source 52 * @param file the file represented by this source
58 * @param flags `true` if this source is in one of the system libraries 53 * @param flags `true` if this source is in one of the system libraries
59 */ 54 */
60 FileBasedSource.con2(ContentCache contentCache2, JavaFile file2, UriKind uriKi nd2) { 55 FileBasedSource.con2(ContentCache contentCache, JavaFile file, UriKind uriKind ) {
61 _jtd_constructor_344_impl(contentCache2, file2, uriKind2); 56 this._contentCache = contentCache;
62 } 57 this._file = file;
63 _jtd_constructor_344_impl(ContentCache contentCache2, JavaFile file2, UriKind uriKind2) { 58 this._uriKind = uriKind;
64 this._contentCache = contentCache2; 59 this._encoding = "${uriKind.encoding}${file.toURI().toString()}";
65 this._file = file2;
66 this._uriKind = uriKind2;
67 this._encoding = "${uriKind2.encoding}${file2.toURI().toString()}";
68 } 60 }
69 bool operator ==(Object object) => object != null && this.runtimeType == objec t.runtimeType && _file == ((object as FileBasedSource))._file; 61 bool operator ==(Object object) => object != null && this.runtimeType == objec t.runtimeType && _file == ((object as FileBasedSource))._file;
70 bool exists() => _contentCache.getContents(this) != null || (_file.exists() && !_file.isDirectory()); 62 bool exists() => _contentCache.getContents(this) != null || (_file.exists() && !_file.isDirectory());
71 void getContents(Source_ContentReceiver receiver) { 63 void getContents(Source_ContentReceiver receiver) {
72 { 64 {
73 String contents = _contentCache.getContents(this); 65 String contents = _contentCache.getContents(this);
74 if (contents != null) { 66 if (contents != null) {
75 receiver.accept2(contents, _contentCache.getModificationStamp(this)); 67 receiver.accept2(contents, _contentCache.getModificationStamp(this));
76 return; 68 return;
77 } 69 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 String _path; 265 String _path;
274 266
275 /** 267 /**
276 * Construct a container representing the specified directory and containing a ny sources whose 268 * Construct a container representing the specified directory and containing a ny sources whose
277 * [Source#getFullName] starts with the directory's path. This is a convenienc e method, 269 * [Source#getFullName] starts with the directory's path. This is a convenienc e method,
278 * fully equivalent to [DirectoryBasedSourceContainer#DirectoryBasedSourceCont ainer] 270 * fully equivalent to [DirectoryBasedSourceContainer#DirectoryBasedSourceCont ainer]
279 * . 271 * .
280 * 272 *
281 * @param directory the directory (not `null`) 273 * @param directory the directory (not `null`)
282 */ 274 */
283 DirectoryBasedSourceContainer.con1(JavaFile directory) { 275 DirectoryBasedSourceContainer.con1(JavaFile directory) : this.con2(directory.g etPath());
284 _jtd_constructor_341_impl(directory);
285 }
286 _jtd_constructor_341_impl(JavaFile directory) {
287 _jtd_constructor_342_impl(directory.getPath());
288 }
289 276
290 /** 277 /**
291 * Construct a container representing the specified path and containing any so urces whose 278 * Construct a container representing the specified path and containing any so urces whose
292 * [Source#getFullName] starts with the specified path. 279 * [Source#getFullName] starts with the specified path.
293 * 280 *
294 * @param path the path (not `null` and not empty) 281 * @param path the path (not `null` and not empty)
295 */ 282 */
296 DirectoryBasedSourceContainer.con2(String path2) { 283 DirectoryBasedSourceContainer.con2(String path) {
297 _jtd_constructor_342_impl(path2); 284 this._path = appendFileSeparator(path);
298 }
299 _jtd_constructor_342_impl(String path2) {
300 this._path = appendFileSeparator(path2);
301 } 285 }
302 bool contains(Source source) => source.fullName.startsWith(_path); 286 bool contains(Source source) => source.fullName.startsWith(_path);
303 bool operator ==(Object obj) => (obj is DirectoryBasedSourceContainer) && ((ob j as DirectoryBasedSourceContainer)).path == path; 287 bool operator ==(Object obj) => (obj is DirectoryBasedSourceContainer) && ((ob j as DirectoryBasedSourceContainer)).path == path;
304 288
305 /** 289 /**
306 * Answer the receiver's path, used to determine if a source is contained in t he receiver. 290 * Answer the receiver's path, used to determine if a source is contained in t he receiver.
307 * 291 *
308 * @return the path (not `null`, not empty) 292 * @return the path (not `null`, not empty)
309 */ 293 */
310 String get path => _path; 294 String get path => _path;
(...skipping 25 matching lines...) Expand all
336 } 320 }
337 return null; 321 return null;
338 } 322 }
339 Source resolveAbsolute(ContentCache contentCache, Uri uri) { 323 Source resolveAbsolute(ContentCache contentCache, Uri uri) {
340 if (!isFileUri(uri)) { 324 if (!isFileUri(uri)) {
341 return null; 325 return null;
342 } 326 }
343 return new FileBasedSource.con1(contentCache, new JavaFile.fromUri(uri)); 327 return new FileBasedSource.con1(contentCache, new JavaFile.fromUri(uri));
344 } 328 }
345 } 329 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698