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(
|
||||
property: FirProperty,
|
||||
crossinline f: () -> T
|
||||
|
||||
+5
-9
@@ -179,15 +179,11 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
}
|
||||
dataFlowAnalyzer.enterField(field)
|
||||
return withFullBodyResolve {
|
||||
context.withTowerDataMode(FirTowerDataMode.CONSTRUCTOR_HEADER) {
|
||||
context.withContainer(field) {
|
||||
withPrimaryConstructorParameters(includeProperties = true) {
|
||||
field.transformChildren(transformer, withExpectedType(returnTypeRef))
|
||||
}
|
||||
if (field.initializer != null) {
|
||||
storeVariableReturnType(field)
|
||||
}
|
||||
}
|
||||
context.withField(field) {
|
||||
field.transformChildren(transformer, withExpectedType(returnTypeRef))
|
||||
}
|
||||
if (field.initializer != null) {
|
||||
storeVariableReturnType(field)
|
||||
}
|
||||
transformer.replaceDeclarationResolvePhaseIfNeeded(field, transformerPhase)
|
||||
dataFlowAnalyzer.exitField(field)
|
||||
|
||||
Reference in New Issue
Block a user