mirror of
https://github.com/irmen/prog8.git
synced 2024-12-26 14:29:35 +00:00
don't remove subroutines in a block marked with "force_output"
This commit is contained in:
parent
edf9a500d3
commit
0e62f5b759
@ -28,7 +28,8 @@ internal class UnusedCodeRemover(private val program: Program,
|
|||||||
val entrypoint = program.entrypoint()
|
val entrypoint = program.entrypoint()
|
||||||
program.modules.forEach {
|
program.modules.forEach {
|
||||||
callgraph.forAllSubroutines(it) { sub ->
|
callgraph.forAllSubroutines(it) { sub ->
|
||||||
if (sub !== entrypoint && !sub.isAsmSubroutine && (callgraph.calledBy[sub].isNullOrEmpty() || sub.containsNoCodeNorVars())) {
|
val forceOutput = "force_output" in sub.definingBlock().options()
|
||||||
|
if (sub !== entrypoint && !forceOutput && !sub.isAsmSubroutine && (callgraph.calledBy[sub].isNullOrEmpty() || sub.containsNoCodeNorVars())) {
|
||||||
removals.add(IAstModification.Remove(sub, sub.definingScope()))
|
removals.add(IAstModification.Remove(sub, sub.definingScope()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user