| 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 library analyzer.src.generated.source; | 5 library analyzer.src.generated.source; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import "dart:math" as math; | 8 import "dart:math" as math; |
| 9 | 9 |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| 11 import 'package:analyzer/src/context/source.dart'; | 11 import 'package:analyzer/src/context/source.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/engine.dart'; |
| 13 import 'package:analyzer/src/generated/java_engine.dart'; | 13 import 'package:analyzer/src/generated/java_engine.dart'; |
| 14 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; | 14 import 'package:analyzer/src/generated/java_io.dart' show JavaFile; |
| 15 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; | 15 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; |
| 16 import 'package:analyzer/src/generated/source_io.dart' show FileBasedSource; | 16 import 'package:analyzer/src/generated/source_io.dart' show FileBasedSource; |
| 17 import 'package:front_end/src/base/source.dart'; | 17 import 'package:front_end/src/base/source.dart'; |
| 18 import 'package:front_end/src/base/uri_kind.dart'; | 18 import 'package:front_end/src/base/uri_kind.dart'; |
| 19 import 'package:package_config/packages.dart'; | 19 import 'package:package_config/packages.dart'; |
| 20 import 'package:path/path.dart' as pathos; | 20 import 'package:path/path.dart' as pathos; |
| 21 import 'package:source_span/source_span.dart' as source_span; |
| 21 | 22 |
| 22 export 'package:front_end/src/base/source.dart' show Source; | 23 export 'package:front_end/src/base/source.dart' show Source; |
| 23 export 'package:front_end/src/base/uri_kind.dart' show UriKind; | 24 export 'package:front_end/src/base/uri_kind.dart' show UriKind; |
| 24 | 25 |
| 25 /** | 26 /** |
| 26 * A function that is used to visit [ContentCache] entries. | 27 * A function that is used to visit [ContentCache] entries. |
| 27 */ | 28 */ |
| 28 typedef void ContentCacheVisitor(String fullPath, int stamp, String contents); | 29 typedef void ContentCacheVisitor(String fullPath, int stamp, String contents); |
| 29 | 30 |
| 30 /** | 31 /** |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 364 |
| 364 class LocalSourcePredicate_TRUE implements LocalSourcePredicate { | 365 class LocalSourcePredicate_TRUE implements LocalSourcePredicate { |
| 365 @override | 366 @override |
| 366 bool isLocal(Source source) => true; | 367 bool isLocal(Source source) => true; |
| 367 } | 368 } |
| 368 | 369 |
| 369 /** | 370 /** |
| 370 * An implementation of an non-existing [Source]. | 371 * An implementation of an non-existing [Source]. |
| 371 */ | 372 */ |
| 372 class NonExistingSource extends Source { | 373 class NonExistingSource extends Source { |
| 374 source_span.SourceFile _sourceFile; |
| 375 |
| 373 @override | 376 @override |
| 374 final String fullName; | 377 final String fullName; |
| 375 | 378 |
| 376 @override | 379 @override |
| 377 final Uri uri; | 380 final Uri uri; |
| 378 | 381 |
| 379 @override | 382 @override |
| 380 final UriKind uriKind; | 383 final UriKind uriKind; |
| 381 | 384 |
| 382 NonExistingSource(this.fullName, this.uri, this.uriKind); | 385 NonExistingSource(this.fullName, this.uri, this.uriKind); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 395 @override | 398 @override |
| 396 bool get isInSystemLibrary => false; | 399 bool get isInSystemLibrary => false; |
| 397 | 400 |
| 398 @override | 401 @override |
| 399 int get modificationStamp => -1; | 402 int get modificationStamp => -1; |
| 400 | 403 |
| 401 @override | 404 @override |
| 402 String get shortName => pathos.basename(fullName); | 405 String get shortName => pathos.basename(fullName); |
| 403 | 406 |
| 404 @override | 407 @override |
| 408 source_span.SourceFile get sourceFile => |
| 409 _sourceFile ??= new source_span.SourceFile('', url: uri); |
| 410 |
| 411 @override |
| 405 bool operator ==(Object other) { | 412 bool operator ==(Object other) { |
| 406 if (other is NonExistingSource) { | 413 if (other is NonExistingSource) { |
| 407 return other.uriKind == uriKind && other.fullName == fullName; | 414 return other.uriKind == uriKind && other.fullName == fullName; |
| 408 } | 415 } |
| 409 return false; | 416 return false; |
| 410 } | 417 } |
| 411 | 418 |
| 412 @override | 419 @override |
| 413 bool exists() => false; | 420 bool exists() => false; |
| 414 } | 421 } |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 Source resolveAbsolute(Uri uri, [Uri actualUri]); | 749 Source resolveAbsolute(Uri uri, [Uri actualUri]); |
| 743 | 750 |
| 744 /** | 751 /** |
| 745 * Return an absolute URI that represents the given [source], or `null` if a | 752 * Return an absolute URI that represents the given [source], or `null` if a |
| 746 * valid URI cannot be computed. | 753 * valid URI cannot be computed. |
| 747 * | 754 * |
| 748 * The computation should be based solely on [source.fullName]. | 755 * The computation should be based solely on [source.fullName]. |
| 749 */ | 756 */ |
| 750 Uri restoreAbsolute(Source source) => null; | 757 Uri restoreAbsolute(Source source) => null; |
| 751 } | 758 } |
| OLD | NEW |