feat: enhance safe_pop error diagnostics with context#151
feat: enhance safe_pop error diagnostics with context#151Gitjay11 wants to merge 3 commits intoarxlang:mainfrom
Conversation
OSL ChatGPT ReviewerNOTE: This is generated by an AI program, so some comments may not make sense. src/irx/builders/llvmliteir.py
|
OSL ChatGPT ReviewerNOTE: This is generated by an AI program, so some comments may not make sense. src/irx/builders/llvmliteir.py
|
OSL ChatGPT ReviewerNOTE: This is generated by an AI program, so some comments may not make sense. src/irx/builders/llvmliteir.py
|
OSL ChatGPT ReviewerNOTE: This is generated by an AI program, so some comments may not make sense. src/irx/builders/llvmliteir.py
|
fixes: #145
This PR enhances the safe_pop() utility in llvmliteir.py to provide better error diagnostics during the LLVM IR generation process. Previously, safe_pop() would silently return None on an empty stack, which made it difficult to trace which AST visitor failed to push a required value. This change implements "Fail Fast" behavior by allowing an optional context string that triggers a descriptive IndexError upon stack underflow.
Key Changes:
This PR is a:
Additional information:
By making this change, developers will see exactly which AST node failed to produce a result on the stack, cutting down debugging time significantly for visitor implementation bugs.