Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This pull request implements function call support for the WebAssembly code generator, enabling the compiler to emit WASM call instructions for plain identifier-based function calls. The implementation includes function parameter lowering, forward reference support, and proper handling of void vs. value-returning functions in expression contexts.
Changes:
- Function parameters are mapped to WASM local indices 0..n, with body locals starting at n
- Pre-scan builds a function name-to-index map for forward reference resolution
- Function calls are lowered to WASM
callinstructions with positional arguments - Drop instruction emission is correctly handled based on whether expressions produce values and context
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| core/wasm-codegen/src/lib.rs | Adds pre-scan call to build function name-to-index map before compilation |
| core/wasm-codegen/src/errors.rs | Introduces CodegenError enum for function call lowering errors |
| core/wasm-codegen/src/compiler.rs | Implements function parameter lowering, call instruction emission, and Drop logic refinement |
| core/wasm-codegen/Cargo.toml | Adds thiserror dependency for error types |
| tests/src/codegen/wasm/validation.rs | Adds 18 validation tests covering parameters, calls, Drop logic, and edge cases |
| tests/src/codegen/wasm/base.rs | Adds integration tests with execution validation for parameters and calls |
| tests/test_data/codegen/wasm/base/fn_params/ | Test data for function parameter tests |
| tests/test_data/codegen/wasm/base/fn_calls/ | Test data for function call tests |
| CHANGELOG.md | Documents new functionality and links PR #136 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
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.
Closes #136