mirror of
https://github.com/irmen/prog8.git
synced 2025-02-21 10:29:03 +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) {
|
if(target !is VarDecl || target.type== VarDeclType.CONST) {
|
||||||
errors.err("can only increment or decrement a variable", postIncrDecr.position)
|
errors.err("can only increment or decrement a variable", postIncrDecr.position)
|
||||||
} else if(target.datatype !in NumericDatatypes) {
|
} 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) {
|
} else if(postIncrDecr.target.arrayindexed != null) {
|
||||||
@ -1339,8 +1339,8 @@ internal class AstChecker(private val program: Program,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
val dt = (target as VarDecl).datatype
|
val dt = (target as VarDecl).datatype
|
||||||
if(dt !in NumericDatatypes && dt !in ArrayDatatypes)
|
if(dt !in NumericDatatypes && dt !in ArrayDatatypes && dt!=DataType.STR)
|
||||||
errors.err("can only increment or decrement a byte/float/word", postIncrDecr.position)
|
errors.err("cannot increment/decrement this", postIncrDecr.position)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else if(postIncrDecr.target.memoryAddress != null) { } // a memory location can always be ++/--
|
// else if(postIncrDecr.target.memoryAddress != null) { } // a memory location can always be ++/--
|
||||||
|
Loading…
x
Reference in New Issue
Block a user