PlutoLang / Pluto

A superset of Lua 5.4 with a focus on general-purpose programming.
https://pluto-lang.org/docs/Introduction
MIT License
338 stars 20 forks source link

Improve try catch #818

Closed XmiliaH closed 2 months ago

XmiliaH commented 2 months ago

Improve the try catch block.

Currently the try catch block has a bug where mixed return and fallthrough in a try block will always return, even in the fallthrough case.

Furthermore, try blocks did not allow for break, continue, and gotos to jump out of the body.

Now, the try block function will return a return type and up to two extra results for the one and two argument returns. Some of the return types are

Sainan commented 2 months ago

This was probably already some of the most cursed code, and this is definitely not making it any less cursed, but tests are passing, so it "looks good to me".