Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible issue when getting the #sourceNode for ConstantBlockClosure #16494

Open
chisandrei opened this issue Apr 19, 2024 · 2 comments
Open

Comments

@chisandrei
Copy link
Contributor

Is it expected that this fails in Pharo 11/12 and works in Pharo 10?

blocks := OrderedCollection  new.
(FBDExamples>>#exampleSimpleBlock) innerCompiledBlocksDo: [ :aBlock | 
    blocks add: aBlock  ].
    
self assert: blocks first sourceNode sourceCode = '[1]'.

In Pharo 10 the returned source code is [1], while in Pharo 11/12 it is ^[1].
The node of the block is RBBlockNode in Pharo 10 and RBReturnNode in Pharo 11/12

To work in Pharo 11/12 we can send value to the sourceNode.

self assert: blocks first sourceNode value sourceCode = '[1]'.
@MarcusDenker
Copy link
Member

I tracked this down to the bc-> AST mapping being wrong when the block is a constant block.

Next step is to fix that

@MarcusDenker
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants