FIR: introduce BodyResolveContext.forEnumEntry

This commit is contained in:
Mikhail Glukhikh
2021-03-10 14:28:32 +03:00
parent 2db413d535
commit b4cec3fb5d
2 changed files with 7 additions and 3 deletions
@@ -439,6 +439,10 @@ class BodyResolveContext(
}
}
inline fun <T> forEnumEntry(
crossinline f: () -> T
): T = withTowerDataMode(FirTowerDataMode.CONSTRUCTOR_HEADER, f)
inline fun <T> withAnonymousInitializer(
anonymousInitializer: FirAnonymousInitializer,
crossinline f: () -> T
@@ -107,8 +107,8 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
override fun transformEnumEntry(enumEntry: FirEnumEntry, data: ResolutionMode): CompositeTransformResult<FirDeclaration> {
if (enumEntry.resolvePhase == transformerPhase) return enumEntry.compose()
transformer.replaceDeclarationResolvePhaseIfNeeded(enumEntry, transformerPhase)
context.withTowerDataMode(FirTowerDataMode.CONSTRUCTOR_HEADER) {
return (enumEntry.transformChildren(this, data) as FirEnumEntry).compose()
return context.forEnumEntry {
(enumEntry.transformChildren(this, data) as FirEnumEntry).compose()
}
}
@@ -127,7 +127,7 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
if (returnTypeRef !is FirImplicitTypeRef && implicitTypeOnly) return property.compose()
if (property.resolvePhase == transformerPhase) return property.compose()
if (property.resolvePhase == FirResolvePhase.BODY_RESOLVE || property.resolvePhase == transformerPhase) {
return@withTypeParametersOf property.compose()
return property.compose()
}
dataFlowAnalyzer.enterProperty(property)