mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 23:29:55 +00:00
fix invalid assignment reordering
This commit is contained in:
parent
ef6e364339
commit
a6d0aecd66
@ -806,6 +806,9 @@ data class AssignTarget(val register: Register?,
|
||||
return (if(withTypePrefix) "1address::" else "") +address.asIntegerValue.toString()
|
||||
return if(withTypePrefix) "???::???" else "???"
|
||||
}
|
||||
|
||||
fun isMemoryMapped(namespace: INameScope): Boolean =
|
||||
memoryAddress!=null || (identifier?.targetVarDecl(namespace)?.type==VarDeclType.MEMORY)
|
||||
}
|
||||
|
||||
|
||||
|
@ -160,7 +160,7 @@ private class StatementReorderer(private val namespace: INameScope, private val
|
||||
val result = mutableListOf<IStatement>()
|
||||
val stmtIter = statements.iterator()
|
||||
for(stmt in stmtIter) {
|
||||
if(stmt is Assignment) {
|
||||
if(stmt is Assignment && !stmt.targets.any { it.isMemoryMapped(namespace) }) {
|
||||
val constval = stmt.value.constValue(namespace, heap)
|
||||
if(constval!=null) {
|
||||
val (sorted, trailing) = sortConstantAssignmentSequence(stmt, stmtIter)
|
||||
|
@ -1,9 +1,15 @@
|
||||
%zeropage basicsafe
|
||||
|
||||
~ main {
|
||||
&uword COLORS = $d020
|
||||
|
||||
sub start() {
|
||||
|
||||
%asmbinary "LICENSE", 100, 200
|
||||
COLORS=12345
|
||||
COLORS=12346
|
||||
@(COLORS) = 54
|
||||
|
||||
return
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user