mirror of
https://github.com/irmen/prog8.git
synced 2025-02-19 11:31:07 +00:00
add unittest for aa%bb (without space) to be parsed correctly as modulo, not directive
This commit is contained in:
parent
ccc11e49d2
commit
779a5606a7
@ -14,6 +14,7 @@ import prog8.ast.statements.VarDecl
|
|||||||
import prog8.code.core.DataType
|
import prog8.code.core.DataType
|
||||||
import prog8.code.core.Position
|
import prog8.code.core.Position
|
||||||
import prog8.code.target.C64Target
|
import prog8.code.target.C64Target
|
||||||
|
import prog8.code.target.Cx16Target
|
||||||
import prog8.code.target.VMTarget
|
import prog8.code.target.VMTarget
|
||||||
import prog8tests.helpers.ErrorReporterForTests
|
import prog8tests.helpers.ErrorReporterForTests
|
||||||
import prog8tests.helpers.compileText
|
import prog8tests.helpers.compileText
|
||||||
@ -493,5 +494,22 @@ main {
|
|||||||
(right2.left as? IdentifierReference)?.nameInSource shouldBe listOf("x")
|
(right2.left as? IdentifierReference)?.nameInSource shouldBe listOf("x")
|
||||||
(right2.right as? NumericLiteral)?.number shouldBe 10.0
|
(right2.right as? NumericLiteral)?.number shouldBe 10.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test("modulo is not directive") {
|
||||||
|
val src="""
|
||||||
|
main {
|
||||||
|
sub start() {
|
||||||
|
ubyte bb1 = 199
|
||||||
|
ubyte bb2 = 12
|
||||||
|
ubyte @shared bb3 = bb1%bb2
|
||||||
|
}
|
||||||
|
}"""
|
||||||
|
|
||||||
|
val result=compileText(Cx16Target(), optimize=false, src, writeAssembly=false)!!
|
||||||
|
val st = result.compilerAst.entrypoint.statements
|
||||||
|
st.size shouldBe 6
|
||||||
|
val value = (st[5] as Assignment).value as BinaryExpression
|
||||||
|
value.operator shouldBe "%"
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -2,17 +2,10 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
- add unittest for aa%bb (without space) to be parsed correctly as modulo
|
|
||||||
ubyte bb1 = 199
|
|
||||||
ubyte bb2 = 12
|
|
||||||
ubyte bb3 = bb1%bb2
|
|
||||||
txt.print_ub(bb3)
|
|
||||||
|
|
||||||
|
|
||||||
- fix bitshift.p8
|
|
||||||
- make internalCast() not complain anymore about signed <-> unsigned conversions
|
|
||||||
- add crc8 and crc16 and crc32 to math
|
- add crc8 and crc16 and crc32 to math
|
||||||
- fix crc* bench routines to no longer depend on the kernal rom version (use a bin file)
|
- fix crc* bench routines to no longer depend on the kernal rom version (use a bin file)
|
||||||
|
- make internalCast() not complain anymore about signed <-> unsigned conversions
|
||||||
|
- fix bitshift.p8
|
||||||
|
|
||||||
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
|
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user