Closed TitanNano closed 5 years ago
Ratel is currently using the Arena
from toolshed. What you want to do is get the particular Arena
on which the AST has been allocated, then use that to construct nodes, lists etc.
@maciejhirsz do you have any advice on how to get this arena? Does Ratel expose it?
The parsed Module
can give you a reference to it. It's &
not &mut
, but Arena
allows allocations with shared pointers (it's not Sync
and cannot be shared across threads though).
Thank you.
I'm trying to create some nodes of my own, in order to get a few parts of the AST into the same data structure. Unfortunately there seems to be an issue with the definition of the life of
Node
which makes it impossible for me to create a node inside my code.There are some more details in this thread I opened in the rust forum. https://users.rust-lang.org/t/lifetime-of-callback-arguments/25609/12
I'm trying to construct a node at this point,
https://github.com/TitanNano/rusty/blob/a8105d1f799a1f0eb6e185e9a59063cd1ac353a8/src/traveler.rs#L344-L349
But the compiler tells me that my node content doesn't live long enough. Is there something that can be done, so I'm able to construct new nodes?