FIR: Do not retrieve file for callable until it's needed
This commit is contained in:
@@ -434,11 +434,6 @@ internal object CheckVisibility : CheckerStage() {
|
|||||||
val containingDeclarations = callInfo.containingDeclarations
|
val containingDeclarations = callInfo.containingDeclarations
|
||||||
val session = callInfo.session
|
val session = callInfo.session
|
||||||
val provider = session.firProvider
|
val provider = session.firProvider
|
||||||
val candidateFile = when (symbol) {
|
|
||||||
is FirClassLikeSymbol<*> -> provider.getFirClassifierContainerFileIfAny(symbol)
|
|
||||||
is FirCallableSymbol<*> -> provider.getFirCallableContainerFile(symbol)
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
val ownerId = symbol.getOwnerId()
|
val ownerId = symbol.getOwnerId()
|
||||||
val visible = when (declaration.visibility) {
|
val visible = when (declaration.visibility) {
|
||||||
JavaVisibilities.PACKAGE_VISIBILITY -> {
|
JavaVisibilities.PACKAGE_VISIBILITY -> {
|
||||||
@@ -450,6 +445,11 @@ internal object CheckVisibility : CheckerStage() {
|
|||||||
Visibilities.PRIVATE, Visibilities.PRIVATE_TO_THIS -> {
|
Visibilities.PRIVATE, Visibilities.PRIVATE_TO_THIS -> {
|
||||||
if (declaration.session == callInfo.session) {
|
if (declaration.session == callInfo.session) {
|
||||||
if (ownerId == null || declaration is FirConstructor && declaration.isFromSealedClass) {
|
if (ownerId == null || declaration is FirConstructor && declaration.isFromSealedClass) {
|
||||||
|
val candidateFile = when (symbol) {
|
||||||
|
is FirClassLikeSymbol<*> -> provider.getFirClassifierContainerFileIfAny(symbol)
|
||||||
|
is FirCallableSymbol<*> -> provider.getFirCallableContainerFile(symbol)
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
// Top-level: visible in file
|
// Top-level: visible in file
|
||||||
candidateFile == useSiteFile
|
candidateFile == useSiteFile
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user