fix struct flattening parent node mismatch

This commit is contained in:
Irmen de Jong 2021-04-05 00:30:42 +02:00
parent b4700af2f5
commit 75d5117a2d
3 changed files with 2 additions and 5 deletions

View File

@ -22,9 +22,7 @@ internal class AstVariousTransforms(private val program: Program) : AstWalker()
val decls = decl.flattenStructMembers()
decls.add(decl)
val result = AnonymousScope(decls, decl.position)
return listOf(IAstModification.ReplaceNode(
decl, result, parent
))
return listOf(IAstModification.ReplaceNode(decl, result, parent))
}
return noModifications

View File

@ -30,6 +30,7 @@ internal class VariousCleanups(val errors: IErrorReporter): AstWalker() {
val idx = into.statements.indexOf(scope)
if(idx>=0) {
into.statements.addAll(idx+1, scope.statements)
scope.statements.forEach { it.parent = into as Node }
into.statements.remove(scope)
}
}

View File

@ -2,8 +2,6 @@
TODO
====
- fix crash parent node mismatch with -noopt (textelite)
- implement new 'unused' in CallGraph for more node types
- allow inlining of subroutines with params