Open chisandrei opened 7 months ago
I tracked this down to the bc-> AST mapping being wrong when the block is a constant block.
Next step is to fix that
The problem is that OCBytecodeToASTCache>>#generateForNode: does not add any entry for compiledBlocks
I think we have to analyse all pushes, find when a constant block ist pushend and add the mapping pc -> AST from that
Just as a side-note, CleanBlockClosure>>#doPrintOn:
gets the source node of a compiled block using self sourceNode value
instead of self sourceNode. For constant blocks
sourceNodereturns a
RBReturnNodeand sending
value` to that returns the correct node. This results in the source code actually being ok when printing it
We currently have a workaround implemented by Andrei. @chisandrei it can be interesting to share it here.
The workaround is just calling self compiledBlock ast value
instead of self compiledBlock ast
when handling a RBReturnNode
.
Thanks!
Is it expected that this fails in Pharo 11/12 and works in Pharo 10?
In Pharo 10 the returned source code is
[1]
, while in Pharo 11/12 it is^[1]
. The node of the block isRBBlockNode
in Pharo 10 andRBReturnNode
in Pharo 11/12To work in Pharo 11/12 we can send value to the sourceNode.