mirror of
https://github.com/irmen/prog8.git
synced 2025-02-22 16:29:05 +00:00
avoid crash when optimizer has multiple replacements of the same node
This commit is contained in:
parent
6f5b645995
commit
72b6dc3de7
@ -235,7 +235,8 @@ open class VarDecl(val type: VarDeclType,
|
||||
}
|
||||
|
||||
override fun replaceChildNode(node: Node, replacement: Node) {
|
||||
require(replacement is Expression && node===value)
|
||||
// TODO the check that node===value is too strict sometimes, but leaving it out allows for bugs to creep through ... :( Perhaps check when adding the replace if there is already a replace on the same node?
|
||||
require(replacement is Expression)
|
||||
value = replacement
|
||||
replacement.parent = this
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user