Simpify phase building
This commit is contained in:
@@ -33,19 +33,22 @@ private fun makeJsModulePhase(
|
|||||||
name: String,
|
name: String,
|
||||||
description: String,
|
description: String,
|
||||||
prerequisite: Set<AnyNamedPhase> = emptySet()
|
prerequisite: Set<AnyNamedPhase> = emptySet()
|
||||||
) = makeIrModulePhase<JsIrBackendContext>(lowering, name, description, prerequisite, actions = setOf(validationAction, defaultDumper))
|
) = makeCustomJsModulePhase(
|
||||||
|
op = { context, moduleFragment -> lowering(context).lower(moduleFragment) },
|
||||||
|
name = name,
|
||||||
|
description = description,
|
||||||
|
prerequisite = prerequisite
|
||||||
|
)
|
||||||
|
|
||||||
private fun makeCustomJsModulePhase(
|
private fun makeCustomJsModulePhase(
|
||||||
op: (JsIrBackendContext, IrModuleFragment) -> Unit,
|
op: (JsIrBackendContext, IrModuleFragment) -> Unit,
|
||||||
description: String,
|
description: String,
|
||||||
name: String,
|
name: String,
|
||||||
prerequisite: Set<AnyNamedPhase> = emptySet()
|
prerequisite: Set<AnyNamedPhase> = emptySet()
|
||||||
) = namedIrModulePhase(
|
) = SameTypeNamedPhaseWrapper(
|
||||||
name,
|
name = name,
|
||||||
description,
|
description = description,
|
||||||
prerequisite,
|
prerequisite = prerequisite,
|
||||||
actions = setOf(defaultDumper, validationAction),
|
|
||||||
nlevels = 0,
|
|
||||||
lower = object : SameTypeCompilerPhase<JsIrBackendContext, IrModuleFragment> {
|
lower = object : SameTypeCompilerPhase<JsIrBackendContext, IrModuleFragment> {
|
||||||
override fun invoke(
|
override fun invoke(
|
||||||
phaseConfig: PhaseConfig,
|
phaseConfig: PhaseConfig,
|
||||||
@@ -56,7 +59,12 @@ private fun makeCustomJsModulePhase(
|
|||||||
op(context, input)
|
op(context, input)
|
||||||
return input
|
return input
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
preconditions = emptySet(),
|
||||||
|
postconditions = emptySet(),
|
||||||
|
stickyPostconditions = emptySet(),
|
||||||
|
actions = setOf(defaultDumper, validationAction),
|
||||||
|
nlevels = 0
|
||||||
)
|
)
|
||||||
|
|
||||||
sealed class Lowering(val name: String) {
|
sealed class Lowering(val name: String) {
|
||||||
|
|||||||
Reference in New Issue
Block a user