I'm working on getting a c# lib.rs for witx-bindgen. Just started really and have a question about how to use the self.locals
. In lowering I create a local that I need to "free" after the call, in the lifting. I guess I want to use self.locals.insert("pinnedArray");
to create the local but how do I get a reference to that in Instruction::ListCanonLift
?
I should add that I'm starting with the C implementation, so locals
is locals: Ns,
in its struct FunctionBindgen<'a>
. I'm new to Rust in general, so not sure what I should be looking for. I mean some of this code is specific to the C implementation, but the general idea of wanting to use a local in the lowering and lifting I would think is universal.
I've just put stuff on self
I guess thats ok if there is a new self
for every function?
@Scott Waye I don't think there's much too strict about this, the locals
idea was just me trying to make it easier to generate temporary names for variables for languages like C where everything needs to be unique. That's not necessarily required of all generators and it largely depends otherwise on the shape of the code that you're generating and the lanugage that you're generating for (I don't know enough about C# to say anything myself)
Scott Waye has marked this topic as resolved.
Last updated: Nov 22 2024 at 16:03 UTC