mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 11:31:57 +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;
|
library fasta.declaration;
|
||||||
|
|
||||||
import '../problems.dart' show unhandled, unsupported;
|
import '../problems.dart' show unsupported;
|
||||||
|
|
||||||
import 'library_builder.dart' show LibraryBuilder;
|
|
||||||
|
|
||||||
abstract class Declaration {
|
abstract class Declaration {
|
||||||
/// Used when multiple things with the same name are declared within the same
|
/// Used when multiple things with the same name are declared within the same
|
||||||
|
@ -62,15 +60,6 @@ abstract class Declaration {
|
||||||
|
|
||||||
bool get isTypeVariable => false;
|
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.
|
/// Applies [patch] to this declaration.
|
||||||
void applyPatch(Declaration patch) {
|
void applyPatch(Declaration patch) {
|
||||||
unsupported("${runtimeType}.applyPatch", charOffset, fileUri);
|
unsupported("${runtimeType}.applyPatch", charOffset, fileUri);
|
||||||
|
|
|
@ -890,10 +890,10 @@ class KernelLibraryBuilder
|
||||||
if (scope.local[name] == declaration) {
|
if (scope.local[name] == declaration) {
|
||||||
isLocal = true;
|
isLocal = true;
|
||||||
preferred = declaration;
|
preferred = declaration;
|
||||||
hiddenUri = other.computeLibraryUri();
|
hiddenUri = computeLibraryUri(other);
|
||||||
} else {
|
} else {
|
||||||
uri = declaration.computeLibraryUri();
|
uri = computeLibraryUri(declaration);
|
||||||
otherUri = other.computeLibraryUri();
|
otherUri = computeLibraryUri(other);
|
||||||
if (declaration is LoadLibraryBuilder) {
|
if (declaration is LoadLibraryBuilder) {
|
||||||
isLoadLibrary = true;
|
isLoadLibrary = true;
|
||||||
preferred = declaration;
|
preferred = declaration;
|
||||||
|
@ -1139,3 +1139,13 @@ class KernelLibraryBuilder
|
||||||
addToExportScope(name, member);
|
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