From 3e366f6b2dbd1d6c153556166fad15330650521c Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Wed, 17 Feb 2016 18:05:48 +0300 Subject: [PATCH] Minor. cleanup --- .../resolve/QualifiedExpressionResolver.kt | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt index ec7b89447df..1dada6b7a0f 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/QualifiedExpressionResolver.kt @@ -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"); * you may not use this file except in compliance with the License. @@ -407,19 +407,16 @@ class QualifiedExpressionResolver(val symbolUsageValidator: SymbolUsageValidator ): Qualifier? { val name = expression.getReferencedNameAsName() - val qualifierDescriptor = when { - receiver is PackageQualifier -> { + val qualifierDescriptor = when (receiver) { + is PackageQualifier -> { val childPackageFQN = receiver.packageView.fqName.child(name) receiver.packageView.module.getPackage(childPackageFQN).check { !it.isEmpty() } ?: receiver.packageView.memberScope.getContributedClassifier(name, KotlinLookupLocation(expression)) } - receiver is ClassQualifier -> - receiver.scope.getContributedClassifier(name, KotlinLookupLocation(expression)) - receiver == null -> - context.scope.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)) + is ClassQualifier -> receiver.scope.getContributedClassifier(name, KotlinLookupLocation(expression)) + null -> context.scope.findClassifier(name, KotlinLookupLocation(expression)) ?: + context.scope.ownerDescriptor.module.getPackage(FqName.ROOT.child(name)).check { !it.isEmpty() } + is ReceiverValue -> receiver.type.memberScope.memberScopeAsImportingScope().findClassifier(name, KotlinLookupLocation(expression)) else -> null } @@ -515,12 +512,9 @@ class QualifiedExpressionResolver(val symbolUsageValidator: SymbolUsageValidator ) { path.foldRight(packageView) { qualifierPart, currentView -> storeResult(trace, qualifierPart.expression, currentView, shouldBeVisibleFrom = null, position = position) - val parentView = currentView.containingDeclaration - assert(parentView != null) { - "Containing Declaration must be not null for package with fqName: ${currentView.fqName}, " + - "path: ${path.joinToString()}, packageView fqName: ${packageView.fqName}" - } - parentView!! + currentView.containingDeclaration + ?: error("Containing Declaration must be not null for package with fqName: ${currentView.fqName}, " + + "path: ${path.joinToString()}, packageView fqName: ${packageView.fqName}") } }