FIR: minor code cleanup
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ abstract class FirAbstractSimpleImportingScope(
|
|||||||
|
|
||||||
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {
|
override fun processClassifiersByNameWithSubstitution(name: Name, processor: (FirClassifierSymbol<*>, ConeSubstitutor) -> Unit) {
|
||||||
val imports = simpleImports[name] ?: return
|
val imports = simpleImports[name] ?: return
|
||||||
processImportsByName(null, imports) { symbol ->
|
processImportsByName(name = null, imports) { symbol ->
|
||||||
processor(symbol, ConeSubstitutor.Empty)
|
processor(symbol, ConeSubstitutor.Empty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-6
@@ -78,8 +78,8 @@ private fun FirScope.getFirstClassifierOrNull(
|
|||||||
session: FirSession,
|
session: FirSession,
|
||||||
bodyResolveComponents: BodyResolveComponents
|
bodyResolveComponents: BodyResolveComponents
|
||||||
): Pair<FirClassifierSymbol<*>, ConeSubstitutor>? {
|
): Pair<FirClassifierSymbol<*>, ConeSubstitutor>? {
|
||||||
var successful = false
|
var isSuccessResult = false
|
||||||
var ambiguity = false
|
var isAmbiguousResult = false
|
||||||
var result: Pair<FirClassifierSymbol<*>, ConeSubstitutor>? = null
|
var result: Pair<FirClassifierSymbol<*>, ConeSubstitutor>? = null
|
||||||
processClassifiersByNameWithSubstitution(callInfo.name) { symbol, substitution ->
|
processClassifiersByNameWithSubstitution(callInfo.name) { symbol, substitution ->
|
||||||
val classifierDeclaration = symbol.fir
|
val classifierDeclaration = symbol.fir
|
||||||
@@ -103,15 +103,15 @@ private fun FirScope.getFirstClassifierOrNull(
|
|||||||
isSuccessCandidate = false
|
isSuccessCandidate = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result == null || (!successful && isSuccessCandidate)) {
|
if (result == null || (!isSuccessResult && isSuccessCandidate)) {
|
||||||
successful = isSuccessCandidate
|
isSuccessResult = isSuccessCandidate
|
||||||
result = symbol to substitution
|
result = symbol to substitution
|
||||||
} else {
|
} else {
|
||||||
ambiguity = true
|
isAmbiguousResult = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.takeUnless { ambiguity }
|
return result.takeUnless { isAmbiguousResult }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun processSyntheticConstructors(
|
private fun processSyntheticConstructors(
|
||||||
|
|||||||
+1
@@ -34,6 +34,7 @@ class FirCompanionGenerationTransformer(val session: FirSession) : FirTransforme
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun transformFile(file: FirFile, data: Nothing?): FirFile {
|
override fun transformFile(file: FirFile, data: Nothing?): FirFile {
|
||||||
|
// I don't want to use laziness here to prevent possible multi-threading problems
|
||||||
generatedDeclarationProvider = session.generatedDeclarationsSymbolProvider ?: return file
|
generatedDeclarationProvider = session.generatedDeclarationsSymbolProvider ?: return file
|
||||||
return file.transformDeclarations(this, data)
|
return file.transformDeclarations(this, data)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user