remove eval stack options

This commit is contained in:
Irmen de Jong
2023-07-15 11:05:25 +02:00
parent b3cb9b7fe2
commit 84925ab69c
28 changed files with 209 additions and 328 deletions
@@ -111,8 +111,6 @@ class StatementOptimizer(private val program: Program,
// remove obvious dangling elses (else after a return)
if(ifElse.elsepart.isNotEmpty() && ifElse.truepart.statements.singleOrNull() is Return) {
val elsePart = AnonymousScope(ifElse.elsepart.statements, ifElse.elsepart.position)
if(options.slowCodegenWarnings)
errors.warn("else can be omitted", ifElse.elsepart.position)
return listOf(
IAstModification.ReplaceNode(ifElse.elsepart, AnonymousScope(mutableListOf(), ifElse.elsepart.position), ifElse),
IAstModification.InsertAfter(ifElse, elsePart, parent as IStatementContainer)