forked from bytecodealliance/wasmtime
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support multiple versions in
bindgen!
(bytecodealliance#7172)
This commit fixes a bug in the `bindgen!` macro where when faced with multiple packages that differ only in version number invalid bindings were generated. The fix here is to add version number information to package module names if necessary in situations such as this. This required some refactoring internally to have a single source of truth for what the name of a module should be and avoid having it implicitly calculated in two locations.
- Loading branch information
1 parent
e746081
commit f481dd9
Showing
5 changed files
with
149 additions
and
104 deletions.
There are no files selected for viewing
This file contains 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
5 changes: 5 additions & 0 deletions
5
crates/component-macro/tests/codegen/multiversion/deps/v1/root.wit
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package my:dep@0.1.0; | ||
|
||
interface a { | ||
x: func(); | ||
} |
5 changes: 5 additions & 0 deletions
5
crates/component-macro/tests/codegen/multiversion/deps/v2/root.wit
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package my:dep@0.2.0; | ||
|
||
interface a { | ||
x: func(); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package foo:bar; | ||
|
||
world foo { | ||
import my:dep/a@0.1.0; | ||
import my:dep/a@0.2.0; | ||
} |
This file contains 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