Skip to content

Commit

Permalink
Fix JsCast::instanceof() not respecting JS namespaces (#4241)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda authored Oct 31, 2024
1 parent 5926c87 commit f1d60ab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
* Only emit `table.fill` instructions if the bulk-memory proposal is enabled.
[#4237](https://github.com/rustwasm/wasm-bindgen/pull/4237)

* Fixed calls to `JsCast::instanceof()` not respecting JavaScript namespaces.
[#4241](https://github.com/rustwasm/wasm-bindgen/pull/4241)

--------------------------------------------------------------------------------

## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95)
Expand Down
6 changes: 5 additions & 1 deletion crates/macro-support/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,11 @@ impl ConvertToAst<(&ast::Program, BindgenAttrs)> for syn::ForeignItemType {
.map_or_else(|| self.ident.to_string(), |s| s.to_string());
let typescript_type = attrs.typescript_type().map(|s| s.0.to_string());
let is_type_of = attrs.is_type_of().cloned();
let shim = format!("__wbg_instanceof_{}_{}", self.ident, ShortHash(&self.ident));
let shim = format!(
"__wbg_instanceof_{}_{}",
self.ident,
ShortHash((attrs.js_namespace().map(|(ns, _)| ns), &self.ident))
);
let mut extends = Vec::new();
let mut vendor_prefixes = Vec::new();
let no_deref = attrs.no_deref().is_some();
Expand Down

0 comments on commit f1d60ab

Please sign in to comment.