Druid can, for instruction, track the expression in the interpreter from it was created:
But if some optimization replaces this instruction with another equivalent, the source is lost.
For example, here the subtraction 1 was changed by an addition -1:
This is happening because some instructions are being instantiated without origin and originAST:
This happens mostly inside the optimizations. They replace instructions with origin with new ones without.
We should keep the origin of an instruction when it is replace:by: a new one (without origin).
To focus on this refactor, I searched the senders of #operands:result: (used to instantiate instructions) and filtered some methods. Maybe help:
Druid can, for instruction, track the expression in the interpreter from it was created:
But if some optimization replaces this instruction with another equivalent, the source is lost. For example, here the
subtraction 1
was changed by anaddition -1
:This is happening because some instructions are being instantiated without
origin
andoriginAST
:This happens mostly inside the optimizations. They replace instructions with origin with new ones without.
We should keep the origin of an instruction when it is
replace:by:
a new one (without origin).To focus on this refactor, I searched the senders of
#operands:result:
(used to instantiate instructions) and filtered some methods. Maybe help: