test: 增加 Demo22(函数重载)
This commit is contained in:
parent
7dca18b6f3
commit
538005b7dc
10
.run/Demo22.run.xml
Normal file
10
.run/Demo22.run.xml
Normal 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>
|
||||||
46
playground/Demo/Demo22/Main.snow
Normal file
46
playground/Demo/Demo22/Main.snow
Normal 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
|
||||||
Loading…
x
Reference in New Issue
Block a user