Skip to content

Commit f1d60ab

Browse files
authored
Fix JsCast::instanceof() not respecting JS namespaces (#4241)
1 parent 5926c87 commit f1d60ab

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
* Only emit `table.fill` instructions if the bulk-memory proposal is enabled.
6464
[#4237](https://github.com/rustwasm/wasm-bindgen/pull/4237)
6565

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

6871
## [0.2.95](https://github.com/rustwasm/wasm-bindgen/compare/0.2.94...0.2.95)

crates/macro-support/src/parser.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,11 @@ impl ConvertToAst<(&ast::Program, BindgenAttrs)> for syn::ForeignItemType {
708708
.map_or_else(|| self.ident.to_string(), |s| s.to_string());
709709
let typescript_type = attrs.typescript_type().map(|s| s.0.to_string());
710710
let is_type_of = attrs.is_type_of().cloned();
711-
let shim = format!("__wbg_instanceof_{}_{}", self.ident, ShortHash(&self.ident));
711+
let shim = format!(
712+
"__wbg_instanceof_{}_{}",
713+
self.ident,
714+
ShortHash((attrs.js_namespace().map(|(ns, _)| ns), &self.ident))
715+
);
712716
let mut extends = Vec::new();
713717
let mut vendor_prefixes = Vec::new();
714718
let no_deref = attrs.no_deref().is_some();

0 commit comments

Comments
 (0)