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