Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/ls24003177/comptime definestmt #556

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,18 @@ open class BaseCompileTimeInterpreter(
}

private fun Cspec_fixedContext.findType(declName: String, conf: ToAstConfiguration): Type? {
val ast = this.toAst(conf)
if (ast is StatementThatCanDefineData) {
val dataDefinition = ast.dataDefinition()
dataDefinition.forEach {
if (it.name == declName) {
return it.type
}
return when (val ast = this.toAst(conf)) {
is DefineStmt -> {
if (declName != ast.newVarName) return null
val type = findType(rContext().statement(), ast.originalName, conf)
type
}
is StatementThatCanDefineData -> {
val dataDefinition = ast.dataDefinition()
dataDefinition.firstOrNull { it.name == declName }?.type
}
else -> null
}
return null
}

private fun Parm_fixedContext.findType(conf: ToAstConfiguration): Type? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,14 @@ open class MULANGT02ConstAndDSpecTest : MULANGTTest() {
val expected = listOf("ok")
assertEquals(expected, "smeup/MUDRNRAPU00221".outputOf(configuration = smeupConfig))
}

/**
* Comptime DEFINE support
* @see #LS24003177
*/
@Test
fun executeMUDRNRAPU00222() {
val expected = listOf("ok")
assertEquals(expected, "smeup/MUDRNRAPU00222".outputOf(configuration = smeupConfig))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
D £DBG_Str S 2

D CSDS DS
D $OAVT1 LIKE(§OAVT1)

C *LIKE DEFINE £OAVT1 §OAVT1

C *ENTRY PLIST
C PARM £OAVT1 2

C EVAL £DBG_Str='ok'
C £DBG_Str DSPLY