fix warning about testing multiple values

This commit is contained in:
Irmen de Jong 2021-12-30 00:49:36 +01:00
parent a65404e63a
commit 9f8c70b326
3 changed files with 10 additions and 3 deletions

View File

@ -99,7 +99,8 @@ internal class VariousCleanups(val program: Program, val errors: IErrorReporter)
val rightBinExpr = expr.right as? BinaryExpression
if(leftBinExpr!=null && leftBinExpr.operator=="==" && rightBinExpr!=null && rightBinExpr.operator=="==") {
if(leftBinExpr.right is NumericLiteralValue && rightBinExpr.right is NumericLiteralValue) {
errors.warn("consider using 'in' or 'when' to test for multiple values", expr.position)
if(leftBinExpr.left isSameAs rightBinExpr.left)
errors.warn("consider using 'in' or 'when' to test for multiple values", expr.position)
}
}
}

View File

@ -3,7 +3,8 @@ TODO
For next compiler release (7.6)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
- make (an option) to let 64tass produce a listing file as well as output.
Blocked by an official Commander-x16 v39 release
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -16,7 +17,6 @@ Future
- make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as ``v_``
then we can get rid of the instruction lists in the machinedefinitions as well?
- fix the asm-labels problem (github issue #62)
- make (an option) to let 64tass produce a listing file as well as output.
- simplifyConditionalExpression() should not split expression if it still results in stack-based evaluation
- simplifyConditionalExpression() sometimes introduces needless assignment to r9 tempvar
- get rid of all TODO's in the code

View File

@ -3,6 +3,12 @@
main {
sub start() {
ubyte xx
ubyte yy
if xx==0 or xx==4 {
xx++
}
txt.nl()
}
}