mirror of
https://github.com/irmen/prog8.git
synced 2025-01-12 04:30:03 +00:00
added warning about using X as sub parameter
This commit is contained in:
parent
e89788eeab
commit
c40fc584d6
@ -16,33 +16,24 @@ sub start() {
|
||||
byte b1
|
||||
|
||||
|
||||
;v1=foo()
|
||||
address =c64.MEMBOT(1, 40000.w) ; ok!
|
||||
address =c64.MEMBOT(1, address) ; ok!
|
||||
address =c64.MEMBOT(1, memaddr) ; ok!
|
||||
|
||||
;address =c64.MEMBOT(1, 40000.w) ; ok!
|
||||
;address =c64.MEMBOT(1, address) ; ok!
|
||||
;address =c64.MEMBOT(1, memaddr) ; ok!i
|
||||
;address =c64.MEMBOT(1, wordarray[1]) ; @todo nice error about loading X register from stack
|
||||
|
||||
;A, Y =c64.GETADR() ; ok!
|
||||
;Y, A =c64.GETADR() ; ok!
|
||||
;address = c64flt.GETADRAY() ; ok!
|
||||
;memaddr = c64flt.GETADRAY() ; ok!
|
||||
;wordarray[1] = c64flt.GETADRAY() ; ok!
|
||||
;v1, v2 =c64.GETADR() ; ok!
|
||||
;address =c64.IOBASE() ; ok!
|
||||
;A = c64.CHRIN() ; ok !
|
||||
;X = c64.CHRIN() ; ok !
|
||||
;Y = c64.CHRIN() ; ok!
|
||||
;v1 = c64.CHRIN() ; ok !
|
||||
A, Y =c64.GETADR() ; ok!
|
||||
Y, A =c64.GETADR() ; ok!
|
||||
address = c64flt.GETADRAY() ; ok!
|
||||
memaddr = c64flt.GETADRAY() ; ok!
|
||||
wordarray[1] = c64flt.GETADRAY() ; ok!
|
||||
v1, v2 =c64.GETADR() ; ok!
|
||||
address =c64.IOBASE() ; ok!
|
||||
A = c64.CHRIN() ; ok !
|
||||
X = c64.CHRIN() ; ok !
|
||||
Y = c64.CHRIN() ; ok!
|
||||
v1 = c64.CHRIN() ; ok !
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
sub foo() -> float {
|
||||
return 1 ; @todo fix error: '1' as byte or float literal (not ubyte)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -693,6 +693,11 @@ class AstChecker(private val namespace: INameScope,
|
||||
for (arg in args.withIndex().zip(target.parameters)) {
|
||||
if(arg.first.value.resultingDatatype(namespace, heap) != arg.second.type)
|
||||
checkResult.add(ExpressionError("argument ${arg.first.index+1} has invalid type, expected ${arg.second.type}", position))
|
||||
|
||||
if(target.asmParameterRegisters[arg.first.index].registerOrPair in setOf(RegisterOrPair.AX, RegisterOrPair.XY, RegisterOrPair.X)) {
|
||||
if(arg.first.value !is LiteralValue && arg.first.value !is IdentifierReference)
|
||||
printWarning("calling a subroutine that expects X as a parameter is problematic, more so when providing complex arguments. If you see a compiler error/crash about this later, try to simplify this call", position)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user