File tree Expand file tree Collapse file tree
crates/spidermonkey-embedding-splicer/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -525,13 +525,13 @@ impl JsBindgen<'_> {
525525 fn imports_bindgen ( & mut self , guest_imports : & Vec < String > ) {
526526 for ( key, impt) in & self . resolve . worlds [ self . world ] . imports {
527527 let import_name = self . resolve . name_world_key ( key) ;
528- if !guest_imports. contains ( & import_name)
529- && !import_name. starts_with ( & self . local_package_name )
530- {
531- continue ;
532- }
533528 match & impt {
534529 WorldItem :: Function ( f) => {
530+ if !guest_imports. contains ( & import_name)
531+ && !import_name. starts_with ( & self . local_package_name )
532+ {
533+ continue ;
534+ }
535535 self . import_bindgen ( import_name, f, false , None ) ;
536536 }
537537 WorldItem :: Interface {
@@ -577,15 +577,21 @@ impl JsBindgen<'_> {
577577 uwriteln ! ( self . src, "\n export class import_{name} {{" ) ;
578578 }
579579
580- for ( _, func) in functions {
581- self . import_bindgen (
582- import_name. clone ( ) ,
583- func,
584- true ,
585- iface_name. clone ( ) ,
586- ) ;
580+ if guest_imports. contains ( & import_name)
581+ || import_name. starts_with ( & self . local_package_name )
582+ {
583+ for ( _, func) in functions {
584+ self . import_bindgen (
585+ import_name. clone ( ) ,
586+ func,
587+ true ,
588+ iface_name. clone ( ) ,
589+ ) ;
590+ }
587591 }
588592
593+ // TODO: Resource tree-shaking, which requires resource use checks against used
594+ // functions.
589595 if let Some ( ty) = resource {
590596 let lower_camel = & self . resolve . types [ ty]
591597 . name
You can’t perform that action at this time.
0 commit comments