wit-parser: Add spans to function parameters#2445
Merged
alexcrichton merged 1 commit intobytecodealliance:mainfrom Feb 9, 2026
Merged
wit-parser: Add spans to function parameters#2445alexcrichton merged 1 commit intobytecodealliance:mainfrom
wit-parser: Add spans to function parameters#2445alexcrichton merged 1 commit intobytecodealliance:mainfrom
Conversation
add and fix tests
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.
#2418
Another follow-up to #2419. This introduces a
Paramstruct to replace(String, Type)inFunction.params, adding aSpanfield that tracks where each parameter name appears in the source WIT file.Changes
wit-parser: Add a publicParamstruct withname,ty, andspanfields. The span is captured from the parameter name'sId::spanduring AST resolution. Thespanfield is skipped during serialization, preserving the existing JSON format.wit-component: Add aParamSignaturesnewtype inencoding/types.rsthat wraps&[Param]with customHash/PartialEqimplementations comparing onlynameandty, ignoringspan. This is needed becauseFunctionKeyuses these traits to deduplicate component function types. Without it, two functions with identical signatures but different source locations would produce separate type entries in the encoded component. An alternative would be to haveFunctionKeyuse&[Param]directly and then add the custom impls directly to it.wasm-wave,wit-dylib,wit-encoder: Update param construction and iteration to use the newParamstruct.Tests
param_spans_point_to_names: Verifies that resolved param spans point exactly to the parameter names in source text.param_spans_preserved_through_merge: Verifies that param spans remain valid (is_known()) after merging twoResolveinstances.