Skip to content

Commit

Permalink
FIR: Drop unused AbstractFirOverrideScope::create*Copy
Browse files Browse the repository at this point in the history
  • Loading branch information
dzharkov committed Nov 6, 2020
1 parent 2e4c41c commit e434a1c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ package org.jetbrains.kotlin.fir.java.scopes

import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.builder.FirSimpleFunctionBuilder
import org.jetbrains.kotlin.fir.declarations.builder.FirValueParameterBuilder
import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty
import org.jetbrains.kotlin.fir.declarations.synthetic.buildSyntheticProperty
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.java.JavaTypeParameterStack
import org.jetbrains.kotlin.fir.java.declarations.*
import org.jetbrains.kotlin.fir.resolve.FirJavaSyntheticNamesProvider
Expand All @@ -24,7 +21,6 @@ import org.jetbrains.kotlin.fir.scopes.impl.AbstractFirUseSiteMemberScope
import org.jetbrains.kotlin.fir.symbols.CallableId
import org.jetbrains.kotlin.fir.symbols.impl.*
import org.jetbrains.kotlin.fir.types.isUnit
import org.jetbrains.kotlin.fir.types.jvm.FirJavaTypeRef
import org.jetbrains.kotlin.name.Name

class JavaClassUseSiteMemberScope(
Expand Down Expand Up @@ -132,32 +128,6 @@ class JavaClassUseSiteMemberScope(
}
}

override fun createFunctionCopy(firSimpleFunction: FirSimpleFunction, newSymbol: FirNamedFunctionSymbol): FirSimpleFunctionBuilder {
if (firSimpleFunction !is FirJavaMethod) return super.createFunctionCopy(firSimpleFunction, newSymbol)
return FirJavaMethodBuilder().apply {
session = firSimpleFunction.session
source = firSimpleFunction.source
symbol = newSymbol
name = firSimpleFunction.name
visibility = firSimpleFunction.visibility
modality = firSimpleFunction.modality
returnTypeRef = firSimpleFunction.returnTypeRef
isStatic = firSimpleFunction.status.isStatic
status = firSimpleFunction.status
}
}

override fun createValueParameterCopy(parameter: FirValueParameter, newDefaultValue: FirExpression?): FirValueParameterBuilder {
if (parameter !is FirJavaValueParameter) return super.createValueParameterCopy(parameter, newDefaultValue)
return FirJavaValueParameterBuilder().apply {
session = parameter.session
source = parameter.source
name = parameter.name
returnTypeRef = parameter.returnTypeRef as FirJavaTypeRef
isVararg = parameter.isVararg
}
}

override fun processPropertiesByName(name: Name, processor: (FirVariableSymbol<*>) -> Unit) {
// Do not generate accessors at all?
if (name.isSpecial) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@ package org.jetbrains.kotlin.fir.scopes.impl
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.declarations.*
import org.jetbrains.kotlin.fir.declarations.builder.FirPropertyBuilder
import org.jetbrains.kotlin.fir.declarations.builder.FirSimpleFunctionBuilder
import org.jetbrains.kotlin.fir.declarations.builder.FirValueParameterBuilder
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.fir.scopes.FirTypeScope
import org.jetbrains.kotlin.fir.scopes.FirOverrideChecker
import org.jetbrains.kotlin.fir.scopes.FirTypeScope
import org.jetbrains.kotlin.fir.symbols.AbstractFirBasedSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirNamedFunctionSymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirPropertySymbol
import org.jetbrains.kotlin.fir.symbols.impl.FirVariableSymbol

abstract class AbstractFirOverrideScope(
val session: FirSession,
Expand Down Expand Up @@ -65,55 +60,4 @@ abstract class AbstractFirOverrideScope(
return override
}

protected open fun createFunctionCopy(
firSimpleFunction: FirSimpleFunction,
newSymbol: FirNamedFunctionSymbol
): FirSimpleFunctionBuilder =
FirSimpleFunctionBuilder().apply {
source = firSimpleFunction.source
session = firSimpleFunction.session
resolvePhase = firSimpleFunction.resolvePhase
origin = FirDeclarationOrigin.SubstitutionOverride
returnTypeRef = firSimpleFunction.returnTypeRef
receiverTypeRef = firSimpleFunction.receiverTypeRef
name = firSimpleFunction.name
status = firSimpleFunction.status
symbol = newSymbol
}

protected open fun createValueParameterCopy(parameter: FirValueParameter, newDefaultValue: FirExpression?): FirValueParameterBuilder =
FirValueParameterBuilder().apply {
source = parameter.source
session = parameter.session
resolvePhase = parameter.resolvePhase
origin = FirDeclarationOrigin.SubstitutionOverride
returnTypeRef = parameter.returnTypeRef
name = parameter.name
symbol = FirVariableSymbol(parameter.symbol.callableId)
defaultValue = newDefaultValue
isCrossinline = parameter.isCrossinline
isNoinline = parameter.isNoinline
isVararg = parameter.isVararg
}

protected open fun createPropertyCopy(
firProperty: FirProperty,
newSymbol: FirPropertySymbol
): FirPropertyBuilder =
FirPropertyBuilder().apply {
source = firProperty.source
session = firProperty.session
resolvePhase = firProperty.resolvePhase
origin = FirDeclarationOrigin.SubstitutionOverride
returnTypeRef = firProperty.returnTypeRef
receiverTypeRef = firProperty.receiverTypeRef
isVar = firProperty.isVar
isLocal = firProperty.isLocal
getter = firProperty.getter
setter = firProperty.setter
name = firProperty.name
status = firProperty.status
symbol = newSymbol
}

}

0 comments on commit e434a1c

Please sign in to comment.