aardappel / lobster

The Lobster Programming Language
http://strlen.com/lobster
2.24k stars 121 forks source link

Crash on compile error when Compile max_errors > 1 #260

Closed MortimerSnerd closed 11 months ago

MortimerSnerd commented 11 months ago

Only happens if you pass --errors to the command line, or you're calling Compile() directly and pass a max_errors > 1.

Example program:

def do_something(v): 
   // . instead of comma after second float3 parameter
   gl_translate(float3{v.x, v.y. v.z})

The crash is because line 106 in ParseStatements() calls children.back() right after error recovery, but it is empty.

Not a high priority, I just changed my call to do max_errors of 1 - I can't recall if I've seen more than one error in any case, so I had passed in 10 on a lark, not because it was necessary.

aardappel commented 11 months ago

Interesting, yeah that code has not been tested much, I'll have a look :)

aardappel commented 11 months ago

Fixed: https://github.com/aardappel/lobster/commit/ee47b6bcec0b48cccb1be2077e30ee2f622de426