aboutsummaryrefslogtreecommitdiff
path: root/src/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'src/Analysis')
-rw-r--r--src/Analysis/CompilerAPI.kt23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/Analysis/CompilerAPI.kt b/src/Analysis/CompilerAPI.kt
index b2b9a824..66e8a76c 100644
--- a/src/Analysis/CompilerAPI.kt
+++ b/src/Analysis/CompilerAPI.kt
@@ -66,8 +66,8 @@ fun DeclarationDescriptor.isUserCode() =
public fun getPackageInnerScope(descriptor: PackageFragmentDescriptor): JetScope {
val module = descriptor.getContainingDeclaration()
- val packageScope = ChainedScope(descriptor, "Package ${descriptor.getName()} scope", descriptor.getMemberScope(),
- module.getPackage(FqName.ROOT)!!.getMemberScope())
+ val packageView = module.getPackage(descriptor.fqName)
+ val packageScope = packageView!!.getMemberScope()
return packageScope
}
@@ -131,11 +131,20 @@ public fun getPropertyInnerScope(outerScope: JetScope, descriptor: PropertyDescr
fun BindingContext.getResolutionScope(descriptor: DeclarationDescriptor): JetScope {
when (descriptor) {
- is PackageFragmentDescriptor -> return getPackageInnerScope(descriptor)
- is PackageViewDescriptor -> return descriptor.getMemberScope()
- is ClassDescriptor -> return getClassInnerScope(getResolutionScope(descriptor.getContainingDeclaration()), descriptor)
- is FunctionDescriptor -> return getFunctionInnerScope(getResolutionScope(descriptor.getContainingDeclaration()), descriptor)
- is PropertyDescriptor -> return getPropertyInnerScope(getResolutionScope(descriptor.getContainingDeclaration()), descriptor)
+ is PackageFragmentDescriptor ->
+ return getPackageInnerScope(descriptor)
+
+ is PackageViewDescriptor ->
+ return descriptor.getMemberScope()
+
+ is ClassDescriptor ->
+ return getClassInnerScope(getResolutionScope(descriptor.getContainingDeclaration()), descriptor)
+
+ is FunctionDescriptor ->
+ return getFunctionInnerScope(getResolutionScope(descriptor.getContainingDeclaration()), descriptor)
+
+ is PropertyDescriptor ->
+ return getPropertyInnerScope(getResolutionScope(descriptor.getContainingDeclaration()), descriptor)
}
if (descriptor is DeclarationDescriptorNonRoot)