Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
compiler/fir/java/src/org/jetbrains/kotlin/fir/scopes/java/FirJavaEnhancementScope.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license | ||
* that can be found in the license/LICENSE.txt file. | ||
*/ | ||
|
||
package org.jetbrains.kotlin.fir.scopes.java | ||
|
||
import org.jetbrains.kotlin.fir.FirSession | ||
import org.jetbrains.kotlin.fir.scopes.FirScope | ||
import org.jetbrains.kotlin.fir.scopes.ProcessorAction | ||
import org.jetbrains.kotlin.fir.scopes.impl.FirAbstractProviderBasedScope | ||
import org.jetbrains.kotlin.fir.symbols.ConeCallableSymbol | ||
import org.jetbrains.kotlin.fir.symbols.ConeFunctionSymbol | ||
import org.jetbrains.kotlin.fir.symbols.ConePropertySymbol | ||
import org.jetbrains.kotlin.name.Name | ||
|
||
class FirJavaEnhancementScope( | ||
session: FirSession, | ||
private val unsubstituted: FirScope | ||
) : FirAbstractProviderBasedScope(session, lookupInFir = true) { | ||
|
||
private val enhancements = mutableMapOf<ConeCallableSymbol, ConeCallableSymbol>() | ||
|
||
private fun createFunctionEnhancement(original: ConeFunctionSymbol, name: Name): ConeFunctionSymbol { | ||
// TODO | ||
return original | ||
} | ||
|
||
override fun processPropertiesByName(name: Name, processor: (ConePropertySymbol) -> ProcessorAction): ProcessorAction { | ||
return unsubstituted.processPropertiesByName(name, processor) | ||
} | ||
|
||
override fun processFunctionsByName(name: Name, processor: (ConeFunctionSymbol) -> ProcessorAction): ProcessorAction { | ||
unsubstituted.processFunctionsByName(name) { original -> | ||
val function = enhancements.getOrPut(original) { createFunctionEnhancement(original, name) } | ||
processor(function as ConeFunctionSymbol) | ||
} | ||
|
||
return unsubstituted.processFunctionsByName(name, processor) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters