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/ErrorEvent with unknown sourceid #577

Merged
merged 15 commits into from
Jul 23, 2024

Conversation

lanarimarco
Copy link
Collaborator

@lanarimarco lanarimarco commented Jul 23, 2024

Description

Fix Issue

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:

  • There are tests regarding this feature
  • The code follows the Kotlin conventions (run ./gradlew ktlintCheck)
  • The code passes all tests (run ./gradlew check)
  • There is specific documentation in the docs directory

@lanarimarco lanarimarco marked this pull request as ready for review July 23, 2024 13:56
@lanarimarco lanarimarco merged commit 378bb1f into develop Jul 23, 2024
1 check passed
@lanarimarco lanarimarco deleted the bugfix/err_event_unknown_sourceid branch July 23, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant