You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary
Generate stubs with a RuntimeException from invalid PIE code
Todo
Figure out how to implement this
Figure out how to test this
Add e2e tests
Implement
Add to documentation
Reason
Useful while developing and you want to test some code while other, unrelated code still has errors. See this blog post for detailed reasoning.
Description
When generating Java code from PIE code with errors, generate a stub that throws a NotImplementedException. If the error is in an expression, still generate code for all expressions before it.
Implementation
Probably requires removing all with in the compiler and handling strategy failure gracefully. For example, use these strategies:
p2j-ast-exp-or-fail: java_exp -> p2j-ast-exp <+ p2j-ast-fail
p2j-ast-fail: pie_code -> ([], {| throw new InvalidPieCodeException("Could not generate Java code: PIE source code at $filename:$line has an error") |} )
with
<add-import> "mb.pie.dsl.compiler.InvalidPieCodeException"
; (filename, line) := get-source-location(pie-code)
Testing is not possible within the current test project, as that will fail the Spoofax build if the PIE code has errors. This might be configurable though.
Related issues
This issue changes what code to generate when the PIE code has errors. Refuse to compile if there are static errors #91 proposes to give the option to refuse compiling PIE code with errors. These changes are orthogonal: both can be implemented independently.
Summary
Generate stubs with a RuntimeException from invalid PIE code
Todo
Reason
Useful while developing and you want to test some code while other, unrelated code still has errors. See this blog post for detailed reasoning.
Description
When generating Java code from PIE code with errors, generate a stub that throws a NotImplementedException. If the error is in an expression, still generate code for all expressions before it.
Implementation
Probably requires removing all
within the compiler and handling strategy failure gracefully. For example, use these strategies:Testing is not possible within the current test project, as that will fail the Spoofax build if the PIE code has errors. This might be configurable though.
Related issues