[JS IR] Enable directives for IR box tests
This commit is contained in:
@@ -790,7 +790,7 @@ abstract class BasicBoxTest(
|
||||
incrementalData.header = incrementalService.headerMetadata
|
||||
}
|
||||
|
||||
processJsProgram(translationResult.program, units.filterIsInstance<TranslationUnit.SourceFile>().map { it.file })
|
||||
processJsProgram(translationResult.program, units)
|
||||
checkSourceMap(outputFile, translationResult.program, remap)
|
||||
}
|
||||
|
||||
@@ -816,11 +816,15 @@ abstract class BasicBoxTest(
|
||||
}
|
||||
}
|
||||
|
||||
private fun processJsProgram(program: JsProgram, psiFiles: List<KtFile>) {
|
||||
psiFiles.asSequence()
|
||||
.map { it.text }
|
||||
.forEach { DirectiveTestUtils.processDirectives(program, it) }
|
||||
program.verifyAst()
|
||||
protected fun processJsProgram(program: JsProgram, units: List<TranslationUnit>) {
|
||||
units.filterIsInstance<TranslationUnit.SourceFile>()
|
||||
.forEach { DirectiveTestUtils.processDirectives(program, it.file.text, targetBackend) }
|
||||
|
||||
// TODO: For now the IR backend generates JS code that doesn't pass verification,
|
||||
// TODO: so we temporarily disabled AST verification.
|
||||
if (targetBackend == TargetBackend.JS) {
|
||||
program.verifyAst()
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkSourceMap(outputFile: File, program: JsProgram, remap: Boolean) {
|
||||
|
||||
@@ -347,6 +347,8 @@ abstract class BasicIrBoxTest(
|
||||
logger.logFile("Output d.ts", dtsFile)
|
||||
dtsFile.write(compiledModule.tsDefinitions ?: error("No ts definitions"))
|
||||
}
|
||||
|
||||
compiledOutput.jsProgram?.let { processJsProgram(it, units) }
|
||||
}
|
||||
|
||||
if (runIrPir) {
|
||||
@@ -368,6 +370,7 @@ abstract class BasicIrBoxTest(
|
||||
verifySignatures = !skipMangleVerification,
|
||||
)
|
||||
compiledModule.outputs!!.writeTo(pirOutputFile, config)
|
||||
processJsProgram(compiledModule.outputs!!.jsProgram!!, units)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user