Creating a BaselineOf from a ConfigurationOf>>#baselineXyz:
I'm trying to write a rewrite rule, but can't quite get it. I first want to remove `spec blessing: #baseline.` I tried the following with no effect: RBParseTreeRewriter new replace: '`@expr blessing: `#lit' with: ''; executeTree: methodTree; tree. NB: If I try to edit the expression instead of remove, by passing something like '`@expr assert: `#lit' for #with:, it works What am I missing here? Thanks! ----- Cheers, Sean -- View this message in context: http://forum.world.st/Creating-a-BaselineOf-from-a-ConfigurationOf-baselineX... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Hi Sean, I didn't tried too much but you may first have to match the node in the parse tree. Something like this: | node | node := (RBParseTreeRewriter treeMatching: '`@expr blessing: `#lit' in: (YourClass >> #baseline01:) parseTree). (node parent removeNode: node) newSource. Cheers, Hernán 2017-06-04 0:48 GMT-03:00 Sean P. DeNigris <sean@clipperadams.com>:
I'm trying to write a rewrite rule, but can't quite get it.
I first want to remove `spec blessing: #baseline.`
I tried the following with no effect:
RBParseTreeRewriter new replace: '`@expr blessing: `#lit' with: ''; executeTree: methodTree; tree.
NB: If I try to edit the expression instead of remove, by passing something like '`@expr assert: `#lit' for #with:, it works
What am I missing here?
Thanks!
----- Cheers, Sean -- View this message in context: http://forum.world.st/ Creating-a-BaselineOf-from-a-ConfigurationOf-baselineXyz-tp4949192.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Hi Sean, 2017-06-04 5:48 GMT+02:00 Sean P. DeNigris <sean@clipperadams.com>:
I'm trying to write a rewrite rule, but can't quite get it.
I first want to remove `spec blessing: #baseline.`
I tried the following with no effect:
RBParseTreeRewriter new replace: '`@expr blessing: `#lit' with: ''; executeTree: methodTree; tree.
This works for me, but ...
NB: If I try to edit the expression instead of remove, by passing something like '`@expr assert: `#lit' for #with:, it works
What am I missing here?
Thanks!
keep in mind some odds about the caching on ast nodes. Working with the tree rewriter directly on the method ast (MyClass>>#myMethod) ast - will modify the "cached" method ast, that means, on code browser, you do not see the change. - the #source method of the ast, again only shows a cached source (MyClass>>#myMethod) ast source -> "old source" - printing the formatted code will finally step into the (modified) method source nodes (MyClass>>#myMethod) ast formattedCode -> "new source code"
----- Cheers, Sean -- View this message in context: http://forum.world.st/ Creating-a-BaselineOf-from-a-ConfigurationOf-baselineXyz-tp4949192.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
participants (3)
-
Hernán Morales Durand -
Nicolai Hess -
Sean P. DeNigris