Skip to content

Commit

Permalink
Merge pull request #560 from smeup/bugfix/comptime-ds-like-ds
Browse files Browse the repository at this point in the history
Bugfix/comptime ds like ds
  • Loading branch information
lanarimarco authored Jul 8, 2024
2 parents 214fe64 + 331421f commit f4d404d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,19 @@ open class BaseCompileTimeInterpreter(
if (type != null) return type
}
it.dcl_ds() != null -> {
val type = it.dcl_ds().parm_fixed().find { it.ds_name().text.equals(declName, ignoreCase = true) }?.findType(conf)
// First look for the entire DS, if no match search in each of its fields
val type = if (it.dcl_ds().name.equals(declName, ignoreCase = true)) {
it.dcl_ds().toAst(
conf = conf,
knownDataDefinitions = knownDataDefinitions,
fileDefinitions = fileDefinitions,
parentDataDefinitions = emptyList()
)?.type
} else {
it.dcl_ds().parm_fixed().find {
it.ds_name().text.equals(declName, ignoreCase = true)
}?.findType(conf)
}
if (type != null) return type
}
it.dspec() != null -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,4 +392,14 @@ open class MULANGT02ConstAndDSpecTest : MULANGTTest() {
val expected = listOf("ok")
assertEquals(expected, "smeup/MUDRNRAPU00224".outputOf(configuration = smeupConfig))
}

/**
* Comptime DS with EXTNAME and comptime DEFINE support resolution in the same test
* @see #LS24003177, #LS24003185
*/
@Test
fun executeMUDRNRAPU00225() {
val expected = listOf("ok")
assertEquals(expected, "smeup/MUDRNRAPU00225".outputOf(configuration = smeupConfig))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
D £DBG_Str S 2

D B£SLOT E DS EXTNAME(B£SLOT0F) INZ
D CSLOTS S LIKE(B£SLOT) DIM(200)
D* skiera ordinata delle chiavi
D CSLOTADS DS
D CSLOTA LIKE(CSDS)
D DIM(%ELEM(CSLOTS)) ASCEND
D* CSLOTKA OVERLAY(CSLOTA:01) LIKE(CKEY) Chiave ordinamento
D CSLOTNA OVERLAY(CSLOTA:*NEXT) LIKE(CSNR) Puntatore a CSLOTS

D CSDS DS
D $OAVT1 LIKE(§OAVT1)
D $OAVP1 LIKE(§OAVP1)
D $OAVT2 LIKE(§OAVT2)
D $OAVP2 LIKE(§OAVP2)
D $OAVAT LIKE(§OAVAT)
D CSNR 5S 0

C *ENTRY PLIST
C PARM £OAVT1 2
C PARM £OAVP1 10
C PARM £OAVT2 2
C PARM £OAVP2 10
C PARM £OAVAT 15

C *LIKE DEFINE £OAVT1 §OAVT1
C *LIKE DEFINE £OAVP1 §OAVP1
C *LIKE DEFINE £OAVT2 §OAVT2
C *LIKE DEFINE £OAVP2 §OAVP2
C *LIKE DEFINE £OAVAT §OAVAT

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

0 comments on commit f4d404d

Please sign in to comment.