mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
fixed incorrect removal of certain assignments that are NOT double
This commit is contained in:
parent
aec3b82476
commit
ec665e0cc1
@ -415,10 +415,6 @@ open class Assignment(var target: AssignTarget, var value: Expression, override
|
||||
return if(subCast!=null) subCast.expression isSameAs target else castExpr.expression isSameAs target
|
||||
}
|
||||
|
||||
if(target.identifier!=null) {
|
||||
return value.referencesIdentifier(*(target.identifier!!.nameInSource.toTypedArray()))
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ private fun writeAssembly(programAst: Program, errors: ErrorReporter, outputDir:
|
||||
programAst.processAstBeforeAsmGeneration(errors)
|
||||
errors.handle()
|
||||
|
||||
printAst(programAst) // TODO
|
||||
// printAst(programAst)
|
||||
|
||||
CompilationTarget.instance.machine.initializeZeropage(compilerOptions)
|
||||
val assembly = CompilationTarget.instance.asmGenerator(
|
||||
|
@ -494,9 +494,9 @@ internal class BuiltinFunctionsAsmGen(private val program: Program, private val
|
||||
swapArrayValues(elementDt, arrayVarName1, firstVar, arrayVarName2, secondVar)
|
||||
return
|
||||
} else if(firstNum!=null && secondVar!=null) {
|
||||
TODO("swap array num/var")
|
||||
TODO("swap array num/var") // TODO *****************************
|
||||
} else if(firstVar!=null && secondNum!=null) {
|
||||
TODO("swap array var/num")
|
||||
TODO("swap array var/num") // TODO *****************************
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,8 +91,10 @@ internal class UnusedCodeRemover(private val program: Program, private val error
|
||||
val assign1 = stmtPairs[0] as? Assignment
|
||||
val assign2 = stmtPairs[1] as? Assignment
|
||||
if (assign1 != null && assign2 != null && !assign2.isAugmentable) {
|
||||
if (assign1.target.isSameAs(assign2.target, program) && assign1.target.isInRegularRAM(program.namespace))
|
||||
linesToRemove.add(assign1)
|
||||
if (assign1.target.isSameAs(assign2.target, program) && assign1.target.isInRegularRAM(program.namespace)) {
|
||||
if(assign2.target.identifier==null || !assign2.value.referencesIdentifier(*(assign2.target.identifier!!.nameInSource.toTypedArray())))
|
||||
linesToRemove.add(assign1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,18 @@ main {
|
||||
ubyte ub
|
||||
byte bb
|
||||
|
||||
uw = 21111
|
||||
uw >>= 6
|
||||
txt.print_uwbin(uw as uword, true)
|
||||
txt.chrout('\n')
|
||||
uw = 21111
|
||||
uw >>= 7
|
||||
txt.print_uwbin(uw as uword, true)
|
||||
txt.chrout('\n')
|
||||
uw = 21111
|
||||
uw >>= 8 ; TODO fix this shift!
|
||||
txt.print_uwbin(uw as uword, true)
|
||||
txt.chrout('\n')
|
||||
uw = 21111
|
||||
uw >>= 9 ; TODO fix this shift!
|
||||
txt.print_uwbin(uw as uword, true)
|
||||
|
Loading…
Reference in New Issue
Block a user