mirror of
https://github.com/irmen/prog8.git
synced 2025-02-16 22:30:46 +00:00
fix error when trying to post-inc/decrement a character in a string
This commit is contained in:
parent
444e97b00b
commit
64d8943b7d
@ -1328,7 +1328,7 @@ internal class AstChecker(private val program: Program,
|
||||
if(target !is VarDecl || target.type== VarDeclType.CONST) {
|
||||
errors.err("can only increment or decrement a variable", postIncrDecr.position)
|
||||
} else if(target.datatype !in NumericDatatypes) {
|
||||
errors.err("can only increment or decrement a byte/float/word variable", postIncrDecr.position)
|
||||
errors.err("cannot increment/decrement this", postIncrDecr.position)
|
||||
}
|
||||
}
|
||||
} else if(postIncrDecr.target.arrayindexed != null) {
|
||||
@ -1339,8 +1339,8 @@ internal class AstChecker(private val program: Program,
|
||||
}
|
||||
else {
|
||||
val dt = (target as VarDecl).datatype
|
||||
if(dt !in NumericDatatypes && dt !in ArrayDatatypes)
|
||||
errors.err("can only increment or decrement a byte/float/word", postIncrDecr.position)
|
||||
if(dt !in NumericDatatypes && dt !in ArrayDatatypes && dt!=DataType.STR)
|
||||
errors.err("cannot increment/decrement this", postIncrDecr.position)
|
||||
}
|
||||
}
|
||||
// else if(postIncrDecr.target.memoryAddress != null) { } // a memory location can always be ++/--
|
||||
|
Loading…
x
Reference in New Issue
Block a user