forked from arcjet/gravity
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add a bunch more codegen and instruction handling #9
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
Open
sd2k
wants to merge
18
commits into
sd2k/phated/instructions
Choose a base branch
from
outlier-example
base: sd2k/phated/instructions
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c44abd0 to
9eac815
Compare
a0e1184 to
d0490ae
Compare
…rcjet#108) Prior to this commit, the `writeString` function would return the previous error (from the `realloc.Call` function) if the write failed, which would be nil. This commit fixes that by returning a new error instead. It also fixes a typo in the comment on the function doc comment. --------- Co-authored-by: Blaine <[email protected]>
…cjet#107) Start the refactoring of codegen parts into the library, where it can be tested and more easily changed. It moves the `Bindings` struct into the library, and adds a new `Wasm` struct responsible for generating code to embed or inline the WebAssembly file. As part of this, `GoIdentifier` has become an owned type, so it was changed to hold strings instead of references. This doesn't really affect performance since references were always passed to `format!()` which would allocate a new string anyway. --------- Co-authored-by: blaine-arcjet <[email protected]>
Refactor the import and factory generation code to a more modular approach. There are now two steps: 1. The import analysis step, which analyzes the imports in the world and generates a list of interfaces and standalone types in an intermediate representation. 2. The import code generation step, which takes the intermediate representation plus the WIT functions, and generates the Go code for the imports. The goal is to make the code more modular and easier to maintain and test. --------- Co-authored-by: Blaine <[email protected]>
Refactor the `Bindings` struct to export the `generate` method.
This change replaces the previous string-specific option handling with a generic method using reflection to check for zero values. It supports optional types beyond just strings by using `reflect.ValueOf().IsZero()` to determine emptiness.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enough to get quite a complicated WIT file working.
Still no resources yet but soon hopefully!