mirror of
https://github.com/irmen/prog8.git
synced 2024-11-18 19:12:44 +00:00
also deal with zero args
This commit is contained in:
parent
b7fffbb6df
commit
5b56e0462d
@ -135,17 +135,23 @@ internal class AstIdentifiersChecker(private val errors: IErrorReporter,
|
||||
private fun visitFunctionCall(call: IFunctionCall) {
|
||||
when (val target = call.target.targetStatement(program)) {
|
||||
is Subroutine -> {
|
||||
if(call.args.size != target.parameters.size)
|
||||
errors.err("invalid number of arguments", call.args[0].position)
|
||||
if(call.args.size != target.parameters.size) {
|
||||
val pos = (if(call.args.any()) call.args[0] else (call as Node)).position
|
||||
errors.err("invalid number of arguments", pos)
|
||||
}
|
||||
}
|
||||
is BuiltinFunctionStatementPlaceholder -> {
|
||||
val func = BuiltinFunctions.getValue(target.name)
|
||||
if(call.args.size != func.parameters.size)
|
||||
errors.err("invalid number of arguments", call.args[0].position)
|
||||
if(call.args.size != func.parameters.size) {
|
||||
val pos = (if(call.args.any()) call.args[0] else (call as Node)).position
|
||||
errors.err("invalid number of arguments", pos)
|
||||
}
|
||||
}
|
||||
is Label -> {
|
||||
if(call.args.isNotEmpty())
|
||||
errors.err("cannot use arguments when calling a label", call.args[0].position)
|
||||
if(call.args.isNotEmpty()) {
|
||||
val pos = (if(call.args.any()) call.args[0] else (call as Node)).position
|
||||
errors.err("cannot use arguments when calling a label", pos)
|
||||
}
|
||||
}
|
||||
null -> {}
|
||||
else -> throw FatalAstException("weird call target")
|
||||
|
@ -1,10 +1,14 @@
|
||||
%import textio
|
||||
%import test_stack
|
||||
%import string
|
||||
%zeropage dontuse
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
|
||||
string.copy()
|
||||
|
||||
ubyte @shared dummy
|
||||
word b1 = 1111
|
||||
byte b2 = 22
|
||||
|
Loading…
Reference in New Issue
Block a user