test: 增加 Demo22(函数重载)

This commit is contained in:
zhangxun 2025-08-06 09:47:54 +08:00
parent 7dca18b6f3
commit 538005b7dc
2 changed files with 56 additions and 0 deletions

10
.run/Demo22.run.xml Normal file
View File

@ -0,0 +1,10 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Demo22" type="Application" factoryName="Application" folderName="Demo">
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.cli.SnowCLI" />
<module name="Snow" />
<option name="PROGRAM_PARAMETERS" value="compile run -d playground/Demo/Demo22 -o target/Demo22 --debug" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -0,0 +1,46 @@
module: Main
import: os
function: main
params:
returns: int
body:
declare x: int = 0
x = inc(x, 1)
println(x)
x = inc(x, 7)
println(x)
return 0
end body
end function
function: inc
params:
declare num: int
returns: int
body:
return num + 1
end body
end function
function: inc
params:
declare num: int
declare v: int
returns: int
body:
return num + v
end body
end function
function: println
params:
declare i1: int
returns: void
body:
os.syscall("PRINTLN",i1)
end body
end function
end module