FIR: extract BodyResolveContext.withField
This commit is contained in:
+14
@@ -388,6 +388,20 @@ class BodyResolveContext(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline fun <T> withField(
|
||||||
|
field: FirField,
|
||||||
|
crossinline f: () -> T
|
||||||
|
): T {
|
||||||
|
return withTowerDataMode(FirTowerDataMode.CONSTRUCTOR_HEADER) {
|
||||||
|
withContainer(field) {
|
||||||
|
withTowerDataCleanup {
|
||||||
|
getPrimaryConstructorAllParametersScope()?.let { addLocalScope(it) }
|
||||||
|
f()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline fun <T> withProperty(
|
inline fun <T> withProperty(
|
||||||
property: FirProperty,
|
property: FirProperty,
|
||||||
crossinline f: () -> T
|
crossinline f: () -> T
|
||||||
|
|||||||
+5
-9
@@ -179,15 +179,11 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
|||||||
}
|
}
|
||||||
dataFlowAnalyzer.enterField(field)
|
dataFlowAnalyzer.enterField(field)
|
||||||
return withFullBodyResolve {
|
return withFullBodyResolve {
|
||||||
context.withTowerDataMode(FirTowerDataMode.CONSTRUCTOR_HEADER) {
|
context.withField(field) {
|
||||||
context.withContainer(field) {
|
field.transformChildren(transformer, withExpectedType(returnTypeRef))
|
||||||
withPrimaryConstructorParameters(includeProperties = true) {
|
}
|
||||||
field.transformChildren(transformer, withExpectedType(returnTypeRef))
|
if (field.initializer != null) {
|
||||||
}
|
storeVariableReturnType(field)
|
||||||
if (field.initializer != null) {
|
|
||||||
storeVariableReturnType(field)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
transformer.replaceDeclarationResolvePhaseIfNeeded(field, transformerPhase)
|
transformer.replaceDeclarationResolvePhaseIfNeeded(field, transformerPhase)
|
||||||
dataFlowAnalyzer.exitField(field)
|
dataFlowAnalyzer.exitField(field)
|
||||||
|
|||||||
Reference in New Issue
Block a user