Minor. cleanup

This commit is contained in:
Stanislav Erokhin
2016-02-17 18:05:48 +03:00
parent 45de06ac0c
commit 3e366f6b2d
@@ -1,5 +1,5 @@
/* /*
* Copyright 2010-2015 JetBrains s.r.o. * Copyright 2010-2016 JetBrains s.r.o.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -407,19 +407,16 @@ class QualifiedExpressionResolver(val symbolUsageValidator: SymbolUsageValidator
): Qualifier? { ): Qualifier? {
val name = expression.getReferencedNameAsName() val name = expression.getReferencedNameAsName()
val qualifierDescriptor = when { val qualifierDescriptor = when (receiver) {
receiver is PackageQualifier -> { is PackageQualifier -> {
val childPackageFQN = receiver.packageView.fqName.child(name) val childPackageFQN = receiver.packageView.fqName.child(name)
receiver.packageView.module.getPackage(childPackageFQN).check { !it.isEmpty() } ?: receiver.packageView.module.getPackage(childPackageFQN).check { !it.isEmpty() } ?:
receiver.packageView.memberScope.getContributedClassifier(name, KotlinLookupLocation(expression)) receiver.packageView.memberScope.getContributedClassifier(name, KotlinLookupLocation(expression))
} }
receiver is ClassQualifier -> is ClassQualifier -> receiver.scope.getContributedClassifier(name, KotlinLookupLocation(expression))
receiver.scope.getContributedClassifier(name, KotlinLookupLocation(expression)) null -> context.scope.findClassifier(name, KotlinLookupLocation(expression)) ?:
receiver == null -> context.scope.ownerDescriptor.module.getPackage(FqName.ROOT.child(name)).check { !it.isEmpty() }
context.scope.findClassifier(name, KotlinLookupLocation(expression)) ?: is ReceiverValue -> receiver.type.memberScope.memberScopeAsImportingScope().findClassifier(name, KotlinLookupLocation(expression))
context.scope.ownerDescriptor.module.getPackage(FqName.ROOT.child(name)).check { !it.isEmpty() }
receiver is ReceiverValue ->
receiver.type.memberScope.memberScopeAsImportingScope().findClassifier(name, KotlinLookupLocation(expression))
else -> null else -> null
} }
@@ -515,12 +512,9 @@ class QualifiedExpressionResolver(val symbolUsageValidator: SymbolUsageValidator
) { ) {
path.foldRight(packageView) { qualifierPart, currentView -> path.foldRight(packageView) { qualifierPart, currentView ->
storeResult(trace, qualifierPart.expression, currentView, shouldBeVisibleFrom = null, position = position) storeResult(trace, qualifierPart.expression, currentView, shouldBeVisibleFrom = null, position = position)
val parentView = currentView.containingDeclaration currentView.containingDeclaration
assert(parentView != null) { ?: error("Containing Declaration must be not null for package with fqName: ${currentView.fqName}, " +
"Containing Declaration must be not null for package with fqName: ${currentView.fqName}, " + "path: ${path.joinToString()}, packageView fqName: ${packageView.fqName}")
"path: ${path.joinToString()}, packageView fqName: ${packageView.fqName}"
}
parentView!!
} }
} }