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

Add _NEWHANDLER option for ON ERROR GOTO... #531

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

RhoSigma-QB64
Copy link
Member

This adds the _NEWHANDLER keyword to make a clear difference between existing legacy code and new QB64-PE specific code. It was required as the simple addition of a history chain to the legacy ON ERROR GOTO syntax introduced a potential memory leak to existing legacy code.

Now with _NEWHANDLER the possibility for this memory leak still exists and special care should be taken when using it, but at least existing code will not break anymore.

Legacy Syntax:
ON ERROR GOTO {label|0}

Extended QB64-PE Syntax:
ON ERROR GOTO [_LASTHANDLER|_NEWHANDLER label]

where the use of _NEWHANDLER will save the current handler to the history chain before actually setting the new handler, and _LASTHANDLER is used to restore back to the most recently saved handler.
The use of the legacy ON ERROR GOTO 0 will also reset/clear all saved history entries.

- added keyword and adapted compile tests
@RhoSigma-QB64 RhoSigma-QB64 added bug Something isn't working enhancement New feature or request labels Aug 23, 2024
@RhoSigma-QB64 RhoSigma-QB64 self-assigned this Aug 23, 2024
@RhoSigma-QB64 RhoSigma-QB64 merged commit 09f6684 into main Aug 23, 2024
4 checks passed
@RhoSigma-QB64 RhoSigma-QB64 deleted the on-error-streamlining branch August 23, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

2 participants