Phaser: Implement dumper and verifier as general actions

This commit is contained in:
Svyatoslav Kuzmich
2019-05-13 15:19:23 +03:00
parent 0702b88bf3
commit b07690fccf
12 changed files with 208 additions and 78 deletions
@@ -33,12 +33,14 @@ private fun validationCallback(context: JsIrBackendContext, module: IrModuleFrag
module.accept(CheckDeclarationParentsVisitor, null)
}
val validationAction = makeVerifyAction(::validationCallback)
private fun makeJsModulePhase(
lowering: (JsIrBackendContext) -> FileLoweringPass,
name: String,
description: String,
prerequisite: Set<AnyNamedPhase> = emptySet()
) = makeIrModulePhase<JsIrBackendContext>(lowering, name, description, prerequisite, verify = ::validationCallback)
) = makeIrModulePhase<JsIrBackendContext>(lowering, name, description, prerequisite, actions = setOf(validationAction, defaultDumper))
private fun makeCustomJsModulePhase(
op: (JsIrBackendContext, IrModuleFragment) -> Unit,
@@ -49,7 +51,7 @@ private fun makeCustomJsModulePhase(
name,
description,
prerequisite,
verify = ::validationCallback,
actions = setOf(defaultDumper, validationAction),
nlevels = 0,
lower = object : SameTypeCompilerPhase<JsIrBackendContext, IrModuleFragment> {
override fun invoke(
@@ -19,7 +19,7 @@ fun compile(
project: Project,
files: List<KtFile>,
configuration: CompilerConfiguration,
phaseConfig: PhaseConfig = PhaseConfig(jsPhases),
phaseConfig: PhaseConfig,
immediateDependencies: List<KlibModuleRef>,
allDependencies: List<KlibModuleRef>,
friendDependencies: List<KlibModuleRef>,