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

Side by Side Diff: pkg/analyzer/lib/src/generated/source.dart

Issue 882813007: Make source be a target (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 // 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);
25 26
26 /** 27 /**
28 * An abstract base class for implementations of [Source].
29 */
30 abstract class AbstractSource implements Source {
Paul Berry 2015/01/29 18:37:55 I'm confused as to why this class is needed, since
Brian Wilkerson 2015/01/30 16:39:18 I think my intention would have been a lot more cl
31 @override
32 Source get source => this;
33 }
34
35 /**
27 * Instances of class `ContentCache` hold content used to override the default c ontent of a 36 * Instances of class `ContentCache` hold content used to override the default c ontent of a
28 * [Source]. 37 * [Source].
29 */ 38 */
30 class ContentCache { 39 class ContentCache {
31 /** 40 /**
32 * A table mapping sources to the contents of those sources. This is used to o verride the default 41 * A table mapping sources to the contents of those sources. This is used to o verride the default
33 * contents of a source. 42 * contents of a source.
34 */ 43 */
35 HashMap<Source, String> _contentMap = new HashMap<Source, String>(); 44 HashMap<Source, String> _contentMap = new HashMap<Source, String>();
36 45
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 311 }
303 312
304 class LocalSourcePredicate_TRUE implements LocalSourcePredicate { 313 class LocalSourcePredicate_TRUE implements LocalSourcePredicate {
305 @override 314 @override
306 bool isLocal(Source source) => true; 315 bool isLocal(Source source) => true;
307 } 316 }
308 317
309 /** 318 /**
310 * An implementation of an non-existing [Source]. 319 * An implementation of an non-existing [Source].
311 */ 320 */
312 class NonExistingSource implements Source { 321 class NonExistingSource extends AbstractSource {
313 final String _name; 322 final String _name;
314 323
315 final UriKind uriKind; 324 final UriKind uriKind;
316 325
317 NonExistingSource(this._name, this.uriKind); 326 NonExistingSource(this._name, this.uriKind);
318 327
319 @override 328 @override
320 TimestampedData<String> get contents { 329 TimestampedData<String> get contents {
321 throw new UnsupportedOperationException("${_name}does not exist."); 330 throw new UnsupportedOperationException("${_name}does not exist.");
322 } 331 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 * Because of these assumptions, most implementations will not maintain any stat e but will delegate 384 * 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 385 * 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 386 * represents files on disk would typically query the file system to determine t he state of the
378 * file. 387 * file.
379 * 388 *
380 * If the instances that implement this API are the system of record, then they will typically be 389 * 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 390 * 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 391 * 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. 392 * those files will know that they now exist.
384 */ 393 */
385 abstract class Source { 394 abstract class Source implements AnalysisTarget {
386 /** 395 /**
387 * An empty list of sources. 396 * An empty list of sources.
388 */ 397 */
389 static const List<Source> EMPTY_ARRAY = const <Source>[]; 398 static const List<Source> EMPTY_ARRAY = const <Source>[];
390 399
391 /** 400 /**
392 * Get the contents and timestamp of this source. 401 * Get the contents and timestamp of this source.
393 * 402 *
394 * Clients should consider using the the method [AnalysisContext.getContents] 403 * 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 404 * because contexts can have local overrides of the content of a source that t he source is not
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 989
981 /** 990 /**
982 * Return an absolute URI that represents the given source, or `null` if a val id URI cannot 991 * Return an absolute URI that represents the given source, or `null` if a val id URI cannot
983 * be computed. 992 * be computed.
984 * 993 *
985 * @param source the source to get URI for 994 * @param source the source to get URI for
986 * @return the absolute URI representing the given source 995 * @return the absolute URI representing the given source
987 */ 996 */
988 Uri restoreAbsolute(Source source) => null; 997 Uri restoreAbsolute(Source source) => null;
989 } 998 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698