JoeStrout / miniscript

source code of both C# and C++ implementations of the MiniScript scripting language
MIT License
280 stars 64 forks source link

[C++] An error only kills the immediate function, but not its caller #181

Open marcgurevitx opened 2 months ago

marcgurevitx commented 2 months ago

If an error occurs inside a function (1) the error is reported, (2) the function interrupts, (3) the caller of the function continues to run.

f = function
    print "f 1"
    ERROR
    print "f 2"
end function

g = function
    print "g 1"
    f
    print "g 2"
end function

g

Running the program prints:

g 1
f 1
Runtime Error: Undefined Identifier: 'ERROR' is unknown in this context [line 4]
g 2

Not observed in Mini Micro.