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

compiler/module: Catch panics properly. #108

Closed
wants to merge 1 commit into from
Closed

compiler/module: Catch panics properly. #108

wants to merge 1 commit into from

Conversation

roman-kashitsyn
Copy link

Currently, if a compiler panics, the error is recorded into a local
variable defined in the scope of a Compile* function. This variable
however has no direct relation to the return value of the function.
So if a panic actually happens, the last return statement is not
executed and the function just returns empty default values.

This behaviour results in errors being silently discurded, the
concequences of such errors are typically discovered much later during
execution (e.g., as index out of bounds panics in vm.go).

After this change, panics in Compile* functions are always propagated
to the caller as errors.

Currently, if a compiler panics, the error is recorded into a local
variable defined in the scope of a Compile* function.  This variable
however has no direct relation to the return value of the function.
So if a panic actually happens, the last `return` statement is not
executed and the function just returns empty default values.

This behaviour results in errors being silently discurded, the
concequences of such errors are typically discovered much later during
execution (e.g., as index out of bounds panics in vm.go).

After this change, panics in Compile* functions are always propagated
to the caller as errors.
@roman-kashitsyn
Copy link
Author

Ok, seems to be a duplicate of #103

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