The WebAssembly specification is not very clear on what a well-formed constant looks like, or how many constant instructions it may allow. As such, right now write_constant implementations for offsets and other values end up creating an entire function just to call it and receive its value.
This makes would would otherwise be 1 line (the expression of the constant) turn into at least 5 lines. It would be great if all this noise could be removed without breaking any unspoken rules.
The WebAssembly specification is not very clear on what a well-formed constant looks like, or how many constant instructions it may allow. As such, right now
write_constant
implementations for offsets and other values end up creating an entire function just to call it and receive its value.This makes would would otherwise be 1 line (the expression of the constant) turn into at least 5 lines. It would be great if all this noise could be removed without breaking any unspoken rules.
https://github.com/Rerumu/Wasynth/blob/master/codegen-luajit/src/translator.rs#L51 https://github.com/Rerumu/Wasynth/blob/master/codegen-luau/src/translator.rs#L50