smeup / jariko

a JAva virtual machine Rpg Interpreter written in KOtlin
Apache License 2.0
65 stars 11 forks source link

Bugfix/ the compile function hides "data reference not resolved" errors in case of "an operation not implemented" errors #585

Closed lanarimarco closed 3 months ago

lanarimarco commented 3 months ago

Description

Since the compile function was designed to serialize the CompilationUnit, if there is at least one error before serialization, the function must throw an error. However, due to technical reasons, we must serialize the CompilationUnit before calling CompilationUnit.resolveAndValidate, which means we might miss information about unresolved data reference errors.

To address this issue, the compile function has been refactored. If the out parameter is passed as null, it indicates that the method is being used solely for syntax checking. In this case, all errors, including unresolved data references, will be reported before the function throws the final error.

Checklist: