mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 11:42:11 +00:00
Remove Declaration.computeLibraryUri
Change-Id: I8ab2d15f83e9547f19301b12d0bff9f1dc05de46 Reviewed-on: https://dart-review.googlesource.com/57561 Reviewed-by: Dmitry Stefantsov <dmitryas@google.com> Commit-Queue: Peter von der Ahé <ahe@google.com>
This commit is contained in:
parent
5ecd78222e
commit
b851714bb7
|
@ -4,9 +4,7 @@
|
|||
|
||||
library fasta.declaration;
|
||||
|
||||
import '../problems.dart' show unhandled, unsupported;
|
||||
|
||||
import 'library_builder.dart' show LibraryBuilder;
|
||||
import '../problems.dart' show unsupported;
|
||||
|
||||
abstract class Declaration {
|
||||
/// Used when multiple things with the same name are declared within the same
|
||||
|
@ -62,15 +60,6 @@ abstract class Declaration {
|
|||
|
||||
bool get isTypeVariable => false;
|
||||
|
||||
Uri computeLibraryUri() {
|
||||
Declaration declaration = this;
|
||||
do {
|
||||
if (declaration is LibraryBuilder) return declaration.uri;
|
||||
declaration = declaration.parent;
|
||||
} while (declaration != null);
|
||||
return unhandled("no library parent", "${runtimeType}", -1, null);
|
||||
}
|
||||
|
||||
/// Applies [patch] to this declaration.
|
||||
void applyPatch(Declaration patch) {
|
||||
unsupported("${runtimeType}.applyPatch", charOffset, fileUri);
|
||||
|
|
|
@ -890,10 +890,10 @@ class KernelLibraryBuilder
|
|||
if (scope.local[name] == declaration) {
|
||||
isLocal = true;
|
||||
preferred = declaration;
|
||||
hiddenUri = other.computeLibraryUri();
|
||||
hiddenUri = computeLibraryUri(other);
|
||||
} else {
|
||||
uri = declaration.computeLibraryUri();
|
||||
otherUri = other.computeLibraryUri();
|
||||
uri = computeLibraryUri(declaration);
|
||||
otherUri = computeLibraryUri(other);
|
||||
if (declaration is LoadLibraryBuilder) {
|
||||
isLoadLibrary = true;
|
||||
preferred = declaration;
|
||||
|
@ -1139,3 +1139,13 @@ class KernelLibraryBuilder
|
|||
addToExportScope(name, member);
|
||||
}
|
||||
}
|
||||
|
||||
Uri computeLibraryUri(Declaration declaration) {
|
||||
Declaration current = declaration;
|
||||
do {
|
||||
if (current is LibraryBuilder) return current.uri;
|
||||
current = current.parent;
|
||||
} while (current != null);
|
||||
return unhandled("no library parent", "${declaration.runtimeType}",
|
||||
declaration.charOffset, declaration.fileUri);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue