mirror of
https://github.com/irmen/prog8.git
synced 2024-08-20 05:29:02 +00:00
fixed source code output issue
This commit is contained in:
parent
bd9ebf4603
commit
e947067dcf
@ -288,7 +288,9 @@ class AstToSourceCode(val output: (text: String) -> Unit, val program: Program):
|
|||||||
|
|
||||||
override fun visit(assignment: Assignment) {
|
override fun visit(assignment: Assignment) {
|
||||||
val binExpr = assignment.value as? BinaryExpression
|
val binExpr = assignment.value as? BinaryExpression
|
||||||
if(binExpr!=null && binExpr.left isSameAs assignment.target) {
|
if(binExpr!=null && binExpr.left isSameAs assignment.target
|
||||||
|
&& binExpr.operator !in setOf("and", "or", "xor")
|
||||||
|
&& binExpr.operator !in comparisonOperators) {
|
||||||
// we only support the inplace assignments of the form A = A <operator> <value>
|
// we only support the inplace assignments of the form A = A <operator> <value>
|
||||||
assignment.target.accept(this)
|
assignment.target.accept(this)
|
||||||
output(" ${binExpr.operator}= ")
|
output(" ${binExpr.operator}= ")
|
||||||
|
@ -7,15 +7,14 @@ main {
|
|||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
|
|
||||||
ubyte ub
|
ubyte a = 1
|
||||||
uword uw = $ee44
|
ubyte b = 2
|
||||||
ubyte vlsb = $11
|
ubyte c = 20
|
||||||
ubyte vmsb = $ff
|
ubyte d = 4
|
||||||
|
|
||||||
uw = mkword(vmsb, vlsb) ; todo flip the order of the operands , MSB first
|
a = c % 6
|
||||||
c64scr.print_uwhex(uw, 1)
|
|
||||||
uw = mkword($ee, $22) ; todo flip the order of the operands , MSB first
|
c64scr.print_ub(a)
|
||||||
c64scr.print_uwhex(uw, 1)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user