Fix: predeclared functions would sometimes fail

This commit is contained in:
Johan B.W. de Vries 2025-02-09 15:03:47 +01:00
parent a184d4c5e3
commit ed09d37213
4 changed files with 22 additions and 20 deletions

View File

@ -369,16 +369,11 @@ parseblock indent:
parsefunc: parsefunc:
calc funcname lexident calc funcname lexident
calc char peek
calc iseoblock eq char "/"
if iseoblock
return
/
trace funcname trace funcname
emit "def " emit "def "
emit funcname emit funcname
emit "(" emit "("
set first "1" set isnotfirst ""
forever forever
calc char peek calc char peek
calc isspace eq char " " calc isspace eq char " "
@ -388,13 +383,11 @@ parsefunc:
/ /
skip skip
calc var lexident calc var lexident
calc isfirst eq first "1"
calc isnotfirst not isfirst
if isnotfirst if isnotfirst
emit ", " emit ", "
/ /
emit var emit var
set first "0" set isnotfirst "1"
/ /
calc char peek calc char peek
calc iseoblock eq char "/" calc iseoblock eq char "/"

View File

@ -1,11 +0,0 @@
func result/
main:
declare result
calc result func "Success"
emit result
/
func result:
return result
/

View File

@ -0,0 +1,10 @@
func/
main:
check func : "The function should return 1, even though it is not defined yet"
emit "Success"
/
func:
return "1"
/

View File

@ -0,0 +1,10 @@
func arg/
main:
check func "1" : "The function should return 1, even though it is not defined yet"
emit "Success"
/
func arg:
return arg
/