File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,7 @@ mergeInto(LibraryManager.library, {
133
133
argTypes = argTypes || [ ] ;
134
134
// When the function takes numbers and returns a number, we can just return
135
135
// the original function
136
- var numericArgs = argTypes . every ( ( type ) => type === 'number' ) ;
136
+ var numericArgs = argTypes . every ( ( type ) => type === 'number' || type === 'boolean' ) ;
137
137
var numericRet = returnType !== 'string' ;
138
138
if ( numericRet && numericArgs && ! opts ) {
139
139
return getCFunc ( ident ) ;
Original file line number Diff line number Diff line change @@ -6990,6 +6990,20 @@ def test_ccall(self):
6990
6990
if self .maybe_closure ():
6991
6991
self .do_core_test ('test_ccall.cpp' )
6992
6992
6993
+ def test_ccall_cwrap_fast_path (self ):
6994
+ self .emcc_args .append ('-Wno-return-stack-address' )
6995
+ self .set_setting ('EXPORTED_RUNTIME_METHODS' , ['ccall' , 'cwrap' ])
6996
+ self .set_setting ('WASM_ASYNC_COMPILATION' , 0 )
6997
+ self .set_setting ('ASSERTIONS' , 0 )
6998
+ create_file ('post.js' , '''
6999
+ var printBool = Module['cwrap']('print_bool', null, ['boolean']);
7000
+ out(Module['_print_bool'] === printBool); // the function should be the exact raw function in the module rather than a wrapped one
7001
+ ''' )
7002
+ self .emcc_args += ['--post-js' , 'post.js' ]
7003
+
7004
+ self .set_setting ('EXPORTED_FUNCTIONS' , ['_print_bool' ])
7005
+ self .do_runf (test_file ('core/test_ccall.cpp' ), 'true' )
7006
+
6993
7007
def test_EXPORTED_RUNTIME_METHODS (self ):
6994
7008
self .set_setting ('DEFAULT_LIBRARY_FUNCS_TO_INCLUDE' , ['$dynCall' ])
6995
7009
self .do_core_test ('EXPORTED_RUNTIME_METHODS.c' )
You can’t perform that action at this time.
0 commit comments