Converted method to property
This commit is contained in:
+2
-2
@@ -26,8 +26,8 @@ import java.util.Collections
|
||||
* Scope lazily delegates requests to class object scope.
|
||||
*/
|
||||
public class ClassObjectMixinScope(private val classObjectDescriptor: ClassDescriptor) : AbstractScopeAdapter() {
|
||||
|
||||
override fun getWorkerScope() = classObjectDescriptor.getDefaultType().getMemberScope()
|
||||
override val workerScope: JetScope
|
||||
get() = classObjectDescriptor.getDefaultType().getMemberScope()
|
||||
|
||||
override fun getImplicitReceiversHierarchy() = listOf(classObjectDescriptor.getThisAsReceiverParameter())
|
||||
}
|
||||
|
||||
+2
-4
@@ -27,7 +27,7 @@ import kotlin.List
|
||||
import kotlin.Set
|
||||
import kotlin.Collection
|
||||
|
||||
public abstract class WritableScopeWithImports(private val workerScope: JetScope,
|
||||
public abstract class WritableScopeWithImports(override val workerScope: JetScope,
|
||||
protected val redeclarationHandler: RedeclarationHandler,
|
||||
private val debugName: String) : AbstractScopeAdapter(), WritableScope {
|
||||
|
||||
@@ -38,8 +38,6 @@ public abstract class WritableScopeWithImports(private val workerScope: JetScope
|
||||
|
||||
private var lockLevel: WritableScope.LockLevel = WritableScope.LockLevel.WRITING
|
||||
|
||||
override fun getWorkerScope() = workerScope
|
||||
|
||||
override fun changeLockLevel(lockLevel: WritableScope.LockLevel): WritableScope {
|
||||
if (lockLevel.ordinal() < this.lockLevel.ordinal()) {
|
||||
throw IllegalStateException("cannot lower lock level from " + this.lockLevel + " to " + lockLevel + " at " + toString())
|
||||
@@ -217,7 +215,7 @@ public abstract class WritableScopeWithImports(private val workerScope: JetScope
|
||||
printAdditionalScopeStructure(p)
|
||||
|
||||
p.print("worker = ")
|
||||
getWorkerScope().printScopeStructure(p.withholdIndentOnce())
|
||||
workerScope.printScopeStructure(p.withholdIndentOnce())
|
||||
|
||||
if (getImports().isEmpty()) {
|
||||
p.println("imports = {}")
|
||||
|
||||
+12
-12
@@ -24,46 +24,46 @@ import org.jetbrains.jet.utils.Printer
|
||||
* Introduces a simple wrapper for internal scope.
|
||||
*/
|
||||
public abstract class AbstractScopeAdapter : JetScope {
|
||||
protected abstract fun getWorkerScope(): JetScope
|
||||
protected abstract val workerScope: JetScope
|
||||
|
||||
override fun getImplicitReceiversHierarchy(): List<ReceiverParameterDescriptor> {
|
||||
return getWorkerScope().getImplicitReceiversHierarchy()
|
||||
return workerScope.getImplicitReceiversHierarchy()
|
||||
}
|
||||
|
||||
override fun getFunctions(name: Name): Collection<FunctionDescriptor> {
|
||||
return getWorkerScope().getFunctions(name)
|
||||
return workerScope.getFunctions(name)
|
||||
}
|
||||
|
||||
override fun getPackage(name: Name): PackageViewDescriptor? {
|
||||
return getWorkerScope().getPackage(name)
|
||||
return workerScope.getPackage(name)
|
||||
}
|
||||
|
||||
override fun getClassifier(name: Name): ClassifierDescriptor? {
|
||||
return getWorkerScope().getClassifier(name)
|
||||
return workerScope.getClassifier(name)
|
||||
}
|
||||
|
||||
override fun getProperties(name: Name): Collection<VariableDescriptor> {
|
||||
return getWorkerScope().getProperties(name)
|
||||
return workerScope.getProperties(name)
|
||||
}
|
||||
|
||||
override fun getLocalVariable(name: Name): VariableDescriptor? {
|
||||
return getWorkerScope().getLocalVariable(name)
|
||||
return workerScope.getLocalVariable(name)
|
||||
}
|
||||
|
||||
override fun getContainingDeclaration(): DeclarationDescriptor {
|
||||
return getWorkerScope().getContainingDeclaration()
|
||||
return workerScope.getContainingDeclaration()
|
||||
}
|
||||
|
||||
override fun getDeclarationsByLabel(labelName: Name): Collection<DeclarationDescriptor> {
|
||||
return getWorkerScope().getDeclarationsByLabel(labelName)
|
||||
return workerScope.getDeclarationsByLabel(labelName)
|
||||
}
|
||||
|
||||
override fun getAllDescriptors(): Collection<DeclarationDescriptor> {
|
||||
return getWorkerScope().getAllDescriptors()
|
||||
return workerScope.getAllDescriptors()
|
||||
}
|
||||
|
||||
override fun getOwnDeclaredDescriptors(): Collection<DeclarationDescriptor> {
|
||||
return getWorkerScope().getOwnDeclaredDescriptors()
|
||||
return workerScope.getOwnDeclaredDescriptors()
|
||||
}
|
||||
|
||||
override fun printScopeStructure(p: Printer) {
|
||||
@@ -71,7 +71,7 @@ public abstract class AbstractScopeAdapter : JetScope {
|
||||
p.pushIndent()
|
||||
|
||||
p.print("worker =")
|
||||
getWorkerScope().printScopeStructure(p.withholdIndentOnce())
|
||||
workerScope.printScopeStructure(p.withholdIndentOnce())
|
||||
|
||||
p.popIndent()
|
||||
p.println("}")
|
||||
|
||||
+1
-3
@@ -23,9 +23,7 @@ import org.jetbrains.jet.lang.descriptors.ReceiverParameterDescriptor
|
||||
import org.jetbrains.jet.lang.resolve.name.Name
|
||||
import java.util.Collections
|
||||
|
||||
public class InnerClassesScopeWrapper(private val workerScope: JetScope) : AbstractScopeAdapter() {
|
||||
|
||||
override fun getWorkerScope() = workerScope
|
||||
public class InnerClassesScopeWrapper(override val workerScope: JetScope) : AbstractScopeAdapter() {
|
||||
|
||||
override fun getClassifier(name: Name) = workerScope.getClassifier(name) as? ClassDescriptor
|
||||
|
||||
|
||||
@@ -19,5 +19,6 @@ package org.jetbrains.jet.lang.resolve.scopes
|
||||
import org.jetbrains.jet.storage.NotNullLazyValue
|
||||
|
||||
public class LazyScopeAdapter(private val scope: NotNullLazyValue<JetScope>) : AbstractScopeAdapter() {
|
||||
override fun getWorkerScope() = scope()
|
||||
override val workerScope: JetScope
|
||||
get() = scope()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user