bmx-ng / bcc

A next-generation bcc parser for BlitzMax
zlib License
33 stars 12 forks source link

"exit" inside functions not always caught by bcc #633

Open GWRon opened 1 year ago

GWRon commented 1 year ago

This code:

SuperStrict
Framework Brl.StandardIO

Function CallFunc()
    exit
End Function

Correctly results in:

[  9%] Processing:local_subfunc.bmx
Compile Error: Exit statement must appear inside a loop.
[/Testcodes/bmx_tests/local_subfunc.bmx;5;0]
Compilation failed.

While this code here:

SuperStrict
Framework Brl.StandardIO

For local i:int = 0 until 100
    CallFunc()
Next

Function CallFunc()
    exit
End Function

results in:

[  9%] Processing:local_subfunc.bmx
[ 91%] Compiling:local_subfunc.bmx.console.release.linux.x64.c
/Testcodes/bmx_tests/.bmx/local_subfunc.bmx.console.release.linux.x64.c: In function ‘_m_local_subfunc_CallFunc’:
/Testcodes/bmx_tests/.bmx/local_subfunc.bmx.console.release.linux.x64.c:3:9: error: break statement not within loop or switch
    3 |         break;
      |         ^~~~~
Compilation failed.
Build Error: failed to compile (256)