File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -535,6 +535,11 @@ var LibraryEmbind = {
535
535
const printer = new TsPrinter ( moduleDefinitions ) ;
536
536
printer . print ( ) ;
537
537
} ,
538
+
539
+ // Stub functions used by eval, but not needed for TS generation:
540
+ $makeLegalFunctionName : ( ) => assert ( false , 'stub function should not be called' ) ,
541
+ $newFunc : ( ) => assert ( false , 'stub function should not be called' ) ,
542
+ $runDestructors : ( ) => assert ( false , 'stub function should not be called' ) ,
538
543
} ;
539
544
540
545
DEFAULT_LIBRARY_FUNCS_TO_INCLUDE . push ( '$embindEmitTypes' ) ;
Original file line number Diff line number Diff line change
1
+ #include < emscripten/bind.h>
2
+ #include < emscripten/val.h>
3
+
4
+ using namespace emscripten ;
5
+
6
+ int global_fn (int , int ) { return 0 ; }
7
+
8
+ EMSCRIPTEN_BINDINGS (Test) {
9
+ function (" global_fn" , &global_fn);
10
+ }
11
+
12
+ int main () {
13
+ val::global (" window" ).call <val>(" setTimeout" );
14
+ // Main should not be run during TypeScript generation.
15
+ abort ();
16
+ return 0 ;
17
+ }
Original file line number Diff line number Diff line change @@ -2915,6 +2915,12 @@ def test_embind_tsgen(self):
2915
2915
self.assertNotExists('out.js')
2916
2916
self.assertFileContents(test_file('other/embind_tsgen.d.ts'), actual)
2917
2917
2918
+ def test_embind_tsgen_val(self):
2919
+ # Check that any dependencies from val still works with TS generation enabled.
2920
+ self.run_process([EMCC, test_file('other/embind_tsgen_val.cpp'),
2921
+ '-lembind', '--embind-emit-tsd', 'embind_tsgen_val.d.ts'])
2922
+ self.assertExists('embind_tsgen_val.d.ts')
2923
+
2918
2924
def test_emconfig(self):
2919
2925
output = self.run_process([emconfig, 'LLVM_ROOT'], stdout=PIPE).stdout.strip()
2920
2926
self.assertEqual(output, config.LLVM_ROOT)
You can’t perform that action at this time.
0 commit comments