Skip to content

Commit

Permalink
Merge pull request #586 from smeup/bugfix/LS24003689/data-reference-b…
Browse files Browse the repository at this point in the history
…y-using-api-directive

Bugfix/ls24003689/data reference by using api directive
  • Loading branch information
lanarimarco authored Aug 2, 2024
2 parents 8864680 + 4dcd3c0 commit 107eece
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,21 @@ open class BaseCompileTimeInterpreter(
val type = it.block().findType(declName, conf)
if (type != null) return type
}
it.directive() != null -> {
// API Directives
if (it.directive().dir_api() != null) {
val apiDirective = it.directive().dir_api()
val apiId = apiDirective.toApiId(conf)
val type = apiId.loadAndUse { api ->
api.let {
it.compilationUnit.dataDefinitions.firstOrNull { def ->
def.name.equals(declName, ignoreCase = true)
}
}?.type
}
if (type != null) return type
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,14 @@ open class MULANGT70CompilationDirectiveTest : MULANGTTest() {
val expected = listOf("HELLO THERE")
assertEquals(expected, "smeup/MU711006".outputOf(configuration = smeupConfig))
}

/**
* Data Definition with LIKE of another variable imported with API directive
* @see #LS24003689
*/
@Test
fun executeMUDRNRAPU00103() {
val expected = listOf("HELLO THERE")
assertEquals(expected, "smeup/MUDRNRAPU00103".outputOf(configuration = smeupConfig))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
D FOO S LIKE(£DECCD)

/API QILEGEN,£DEC

C EVAL FOO = 'HELLO THERE'
C FOO DSPLY

0 comments on commit 107eece

Please sign in to comment.