mirror of
https://github.com/irmen/prog8.git
synced 2024-08-20 05:29:02 +00:00
don't remove 'duplicate' assignments that aren't removable (i.e. not literalvalues)
This commit is contained in:
parent
03d0411679
commit
b57c02b0ba
@ -20,7 +20,6 @@ import kotlin.math.floor
|
||||
todo inline subroutines that are only called a few times (3?) and that are "sufficiently small" (0-3 statements)
|
||||
|
||||
todo analyse for unreachable code and remove that (f.i. code after goto or return that has no label so can never be jumped to)
|
||||
|
||||
*/
|
||||
|
||||
class StatementOptimizer(private val namespace: INameScope, private val heap: HeapValues) : IAstProcessor {
|
||||
@ -76,7 +75,7 @@ class StatementOptimizer(private val namespace: INameScope, private val heap: He
|
||||
var previousAssignmentLine: Int? = null
|
||||
for (i in 0 until statements.size) {
|
||||
val stmt = statements[i] as? Assignment
|
||||
if (stmt != null) {
|
||||
if (stmt != null && stmt.value is LiteralValue) {
|
||||
if (previousAssignmentLine == null) {
|
||||
previousAssignmentLine = i
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user