mirror of
https://github.com/irmen/prog8.git
synced 2024-11-22 00:31:56 +00:00
fix too greedy expression simplification
could cause problems when variables occur multiple times in the same expression. Fixes #101
This commit is contained in:
parent
cc81d6fe82
commit
6218c1c00b
@ -979,10 +979,7 @@ class FunctionCallExpression(override var target: IdentifierReference,
|
||||
}
|
||||
|
||||
override fun copy() = FunctionCallExpression(target.copy(), args.map { it.copy() }.toMutableList(), position)
|
||||
override val isSimple =
|
||||
target.nameInSource.size==1
|
||||
&& target.nameInSource[0] in arrayOf("msb", "lsb", "peek", "peekw", "mkword")
|
||||
&& args.all { it.isSimple }
|
||||
override val isSimple = false
|
||||
|
||||
override fun replaceChildNode(node: Node, replacement: Node) {
|
||||
if(node===target)
|
||||
@ -1142,7 +1139,7 @@ class BuiltinFunctionCall(override var target: IdentifierReference,
|
||||
}
|
||||
|
||||
override fun copy() = BuiltinFunctionCall(target.copy(), args.map { it.copy() }.toMutableList(), position)
|
||||
override val isSimple = name in arrayOf("msb", "lsb", "peek", "peekw", "set_carry", "set_irqd", "clear_carry", "clear_irqd")
|
||||
override val isSimple = false
|
||||
|
||||
override fun replaceChildNode(node: Node, replacement: Node) {
|
||||
if(node===target)
|
||||
|
Loading…
Reference in New Issue
Block a user