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