Minor. remove usage of WritableScope
This commit is contained in:
+3
-4
@@ -22,18 +22,17 @@ import org.jetbrains.kotlin.name.FqName;
|
|||||||
import org.jetbrains.kotlin.resolve.scopes.*;
|
import org.jetbrains.kotlin.resolve.scopes.*;
|
||||||
|
|
||||||
public class MutablePackageFragmentDescriptor extends PackageFragmentDescriptorImpl {
|
public class MutablePackageFragmentDescriptor extends PackageFragmentDescriptorImpl {
|
||||||
private final WritableScope scope;
|
private final KtScope scope;
|
||||||
|
|
||||||
public MutablePackageFragmentDescriptor(@NotNull ModuleDescriptor module, @NotNull FqName fqName) {
|
public MutablePackageFragmentDescriptor(@NotNull ModuleDescriptor module, @NotNull FqName fqName) {
|
||||||
super(module, fqName);
|
super(module, fqName);
|
||||||
|
|
||||||
scope = new WritableScopeImpl(KtScope.Empty.INSTANCE$, this, RedeclarationHandler.DO_NOTHING, "Members of " + fqName + " in " + module);
|
scope = new SimpleKtScope(this, "Members of " + fqName + " in " + module);
|
||||||
scope.changeLockLevel(LexicalWritableScope.LockLevel.BOTH);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public WritableScope getMemberScope() {
|
public KtScope getMemberScope() {
|
||||||
return scope;
|
return scope;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.name.Name
|
|||||||
import org.jetbrains.kotlin.types.KotlinType
|
import org.jetbrains.kotlin.types.KotlinType
|
||||||
import org.jetbrains.kotlin.utils.Printer
|
import org.jetbrains.kotlin.utils.Printer
|
||||||
|
|
||||||
public abstract class KtScopeImpl : KtScope {
|
abstract class KtScopeImpl : KtScope {
|
||||||
override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? = null
|
override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? = null
|
||||||
|
|
||||||
override fun getProperties(name: Name, location: LookupLocation): Collection<VariableDescriptor> = emptyList()
|
override fun getProperties(name: Name, location: LookupLocation): Collection<VariableDescriptor> = emptyList()
|
||||||
@@ -51,3 +51,11 @@ public abstract class KtScopeImpl : KtScope {
|
|||||||
// This method should not be implemented here by default: every scope class has its unique structure pattern
|
// This method should not be implemented here by default: every scope class has its unique structure pattern
|
||||||
abstract override fun printScopeStructure(p: Printer)
|
abstract override fun printScopeStructure(p: Printer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SimpleKtScope(val ownerDescriptor: DeclarationDescriptor, val debugName: String): KtScopeImpl() {
|
||||||
|
override fun printScopeStructure(p: Printer) {
|
||||||
|
p.println(javaClass.getSimpleName(), ": ", debugName, " for ", ownerDescriptor, " {")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getContainingDeclaration() = ownerDescriptor
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user