When a syntax error occurred after the /API directive, the ErrorEvent.sourceReference.sourceId was UNKNOWN.
Regression due to #573.
The reason for this regression is that the loading and usage of the API must follow a well-defined pattern, which the author of the fix in #573 could not know. This pattern was implemented only in the CompilationUnit.includeApi function. To avoid misuse of API, I have added the new ApiId.loadAndUse function, which ensures the safe loading and usage of the API.
Refactor Test Functions
In the context of this implementation, these useful test functions:
executePgmCallBackTest
executeSourceLineTest
were moved from JarikoCallbackTest to AbstractTest. Consequently, two test units, written specifically for Smeup, were moved from JarikoCallbackTest to SmeupInterpreterTest.
In addition, I have added a validation in both functions where if ErrorEvent.sourceReference.sourceId is UNKNOWN, an error is thrown.
Overall, this implementation improves the handling of RPG programs with the /API directive.
Checklist:
[X] There are tests regarding this feature
[X] The code follows the Kotlin conventions (run ./gradlew ktlintCheck)
[X] The code passes all tests (run ./gradlew check)
[ ] There is specific documentation in the docs directory
Description
Fix Issue
When a syntax error occurred after the
/API
directive, theErrorEvent.sourceReference.sourceId
wasUNKNOWN
.Regression due to #573.
The reason for this regression is that the loading and usage of the
API
must follow a well-defined pattern, which the author of the fix in #573 could not know. This pattern was implemented only in theCompilationUnit.includeApi
function. To avoid misuse ofAPI
, I have added the newApiId.loadAndUse
function, which ensures the safe loading and usage of theAPI
.Refactor Test Functions
In the context of this implementation, these useful test functions:
executePgmCallBackTest
executeSourceLineTest
were moved from
JarikoCallbackTest
toAbstractTest
. Consequently, two test units, written specifically for Smeup, were moved fromJarikoCallbackTest
toSmeupInterpreterTest
.In addition, I have added a validation in both functions where if
ErrorEvent.sourceReference.sourceId
isUNKNOWN
, an error is thrown.Overall, this implementation improves the handling of RPG programs with the
/API
directive.Checklist:
./gradlew ktlintCheck
)./gradlew check
)docs
directory