Fix: predeclared functions would sometimes fail
This commit is contained in:
parent
a184d4c5e3
commit
ed09d37213
@ -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 "/"
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
func result/
|
|
||||||
|
|
||||||
main:
|
|
||||||
declare result
|
|
||||||
calc result func "Success"
|
|
||||||
emit result
|
|
||||||
/
|
|
||||||
|
|
||||||
func result:
|
|
||||||
return result
|
|
||||||
/
|
|
||||||
10
tests/parsingpredeclaredfunction0.lang0
Normal file
10
tests/parsingpredeclaredfunction0.lang0
Normal 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"
|
||||||
|
/
|
||||||
10
tests/parsingpredeclaredfunction1.lang0
Normal file
10
tests/parsingpredeclaredfunction1.lang0
Normal 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
|
||||||
|
/
|
||||||
Loading…
x
Reference in New Issue
Block a user