mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-17 23:11:23 +00:00
* Enable nested namespace (#951) * Specify the namespace as array (#951) * added an example to the document Co-authored-by: Alex Crichton <alex@alexcrichton.com>
This commit is contained in:
@ -1998,7 +1998,7 @@ impl<'a> Context<'a> {
|
||||
|
||||
JsImportName::VendorPrefixed { name, prefixes } => {
|
||||
self.imports_post.push_str("const l");
|
||||
self.imports_post.push_str(&name);
|
||||
self.imports_post.push_str(name);
|
||||
self.imports_post.push_str(" = ");
|
||||
switch(&mut self.imports_post, name, "", prefixes);
|
||||
self.imports_post.push_str(";\n");
|
||||
|
@ -898,7 +898,7 @@ impl<'a> Context<'a> {
|
||||
"import of `{}` through js namespace `{}` isn't supported \
|
||||
right now when it lists a polyfill",
|
||||
item,
|
||||
ns
|
||||
ns.join(".")
|
||||
);
|
||||
}
|
||||
return Ok(JsImport {
|
||||
@ -911,8 +911,12 @@ impl<'a> Context<'a> {
|
||||
}
|
||||
|
||||
let (name, fields) = match import.js_namespace {
|
||||
Some(ns) => (ns, vec![item.to_string()]),
|
||||
None => (item, Vec::new()),
|
||||
Some(ref ns) => {
|
||||
let mut tail = (&ns[1..]).to_owned();
|
||||
tail.push(item.to_string());
|
||||
(ns[0].to_owned(), tail)
|
||||
}
|
||||
None => (item.to_owned(), Vec::new()),
|
||||
};
|
||||
|
||||
let name = match import.module {
|
||||
|
Reference in New Issue
Block a user