File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change
1
+ declare function other ( ) : void ;
2
+
3
+ export function thing ( ) : i8 {
4
+ return - 1 ;
5
+ }
Original file line number Diff line number Diff line change
1
+ describe ( "as-bind" , function ( ) {
2
+ it ( "should handle unused imported functions gracefully" , async function ( ) {
3
+ const instance = await AsBind . instantiate ( this . rawModule ) ;
4
+ assert ( instance . exports . thing ( ) === - 1 ) ;
5
+ } ) ;
6
+ } ) ;
Original file line number Diff line number Diff line change @@ -86,6 +86,11 @@ class AsBindTransform extends Transform {
86
86
const typeIds = { } ;
87
87
const importedFunctions = { } ;
88
88
for ( let importedFunction of flatImportedFunctions ) {
89
+ // An imported function with no instances is an unused imported function.
90
+ // Skip it.
91
+ if ( ! importedFunction . instances ) {
92
+ continue ;
93
+ }
89
94
if (
90
95
importedFunction . instances . size > 1 ||
91
96
! importedFunction . instances . has ( "" )
You can’t perform that action at this time.
0 commit comments