mirror of
https://github.com/irmen/prog8.git
synced 2025-01-13 10:29:52 +00:00
fix function parameter datatype checks
This commit is contained in:
parent
30e2bdad79
commit
f9ed92dc3a
@ -24,11 +24,6 @@ sub start() {
|
|||||||
c64.CHROUT(memubytearray[1])
|
c64.CHROUT(memubytearray[1])
|
||||||
c64.CHROUT(ubytearray[X])
|
c64.CHROUT(ubytearray[X])
|
||||||
c64.CHROUT(memubytearray[X])
|
c64.CHROUT(memubytearray[X])
|
||||||
c64.CHROUT(b1) ; @todo fix compiler crash incompatible data types
|
|
||||||
c64.CHROUT(mb1) ; @todo fix compiler crash incompatible data types
|
|
||||||
c64.CHROUT(bytearray[1]) ; @todo fix compiler crash incompatible data types
|
|
||||||
c64.CHROUT(membytearray[1]) ; @todo fix compiler crash incompatible data types
|
|
||||||
c64.CHROUT(wordarray[1]) ; @todo fix compiler crash incompatible data types
|
|
||||||
|
|
||||||
testsub(X)
|
testsub(X)
|
||||||
testsub(ub1)
|
testsub(ub1)
|
||||||
@ -37,11 +32,6 @@ sub start() {
|
|||||||
testsub(memubytearray[1])
|
testsub(memubytearray[1])
|
||||||
testsub(ubytearray[X])
|
testsub(ubytearray[X])
|
||||||
testsub(memubytearray[X])
|
testsub(memubytearray[X])
|
||||||
testsub(b1) ; @todo should give datatype error
|
|
||||||
testsub(mb1) ; @todo should give datatype error
|
|
||||||
testsub(bytearray[1]) ; @todo should give datatype error
|
|
||||||
testsub(membytearray[1]) ; @todo should give datatype error
|
|
||||||
testsub(wordarray[1]) ; @todo should give datatype error
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -31,22 +31,22 @@ enum class DataType {
|
|||||||
ARRAY_W,
|
ARRAY_W,
|
||||||
ARRAY_F;
|
ARRAY_F;
|
||||||
|
|
||||||
fun assignableTo(type: DataType) =
|
fun assignableTo(targetType: DataType) =
|
||||||
when(this) {
|
when(this) {
|
||||||
UBYTE -> type in NumericDatatypes
|
UBYTE -> targetType == UBYTE || targetType == UWORD || targetType == FLOAT
|
||||||
BYTE -> type in NumericDatatypes
|
BYTE -> targetType == BYTE || targetType == WORD || targetType == FLOAT
|
||||||
UWORD -> type in NumericDatatypes
|
UWORD -> targetType == UWORD || targetType == FLOAT
|
||||||
WORD -> type in NumericDatatypes
|
WORD -> targetType == WORD || targetType == FLOAT
|
||||||
FLOAT -> type in NumericDatatypes
|
FLOAT -> targetType == FLOAT
|
||||||
STR -> type == STR || type==STR_S || type == UWORD
|
STR -> targetType == STR || targetType==STR_S || targetType == UWORD
|
||||||
STR_P -> type == STR_P || type==STR_PS || type == UWORD
|
STR_P -> targetType == STR_P || targetType==STR_PS || targetType == UWORD
|
||||||
STR_S -> type == STR || type==STR_S || type == UWORD
|
STR_S -> targetType == STR || targetType==STR_S || targetType == UWORD
|
||||||
STR_PS -> type == STR_P || type==STR_PS || type == UWORD
|
STR_PS -> targetType == STR_P || targetType==STR_PS || targetType == UWORD
|
||||||
ARRAY_UB -> type == UWORD
|
ARRAY_UB -> targetType == UWORD
|
||||||
ARRAY_B -> type == UWORD
|
ARRAY_B -> targetType == UWORD
|
||||||
ARRAY_UW -> type == UWORD
|
ARRAY_UW -> targetType == UWORD
|
||||||
ARRAY_W -> type == UWORD
|
ARRAY_W -> targetType == UWORD
|
||||||
ARRAY_F -> type == UWORD
|
ARRAY_F -> targetType == UWORD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user