File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ void caller_builder_callback(spidir_builder_handle_t builder, void* ctx) {
3838
3939 spidir_value_t args [] = {ptr , ival };
4040
41+ ASSERT (spidir_funcref_get_kind (func_ctx -> extfunc ) ==
42+ SPIDIR_FUNCREF_EXTERNAL );
43+ ASSERT (spidir_funcref_is_external (func_ctx -> extfunc ));
44+ ASSERT (spidir_funcref_get_kind (func_ctx -> infunc ) ==
45+ SPIDIR_FUNCREF_INTERNAL );
46+ ASSERT (spidir_funcref_is_internal (func_ctx -> infunc ));
47+
4148 spidir_builder_build_call (builder , func_ctx -> extfunc , 2 , args );
4249 spidir_value_t ext_ret =
4350 spidir_builder_build_call (builder , func_ctx -> extfunc2 , 2 , args );
Original file line number Diff line number Diff line change @@ -236,6 +236,22 @@ spidir_funcref_get_kind(spidir_funcref_t func) {
236236 return func .id >> 32 ;
237237}
238238
239+ /// Queries whether a function reference points to an internal function.
240+ ///
241+ /// @param[in] func The reference to query.
242+ /// @return True if `func` refers to an internal function.
243+ static inline bool spidir_funcref_is_internal (spidir_funcref_t func ) {
244+ return spidir_funcref_get_kind (func ) == SPIDIR_FUNCREF_INTERNAL ;
245+ }
246+
247+ /// Queries whether a function reference points to an external function.
248+ ///
249+ /// @param[in] func The reference to query.
250+ /// @return True if `func` refers to an external function.
251+ static inline bool spidir_funcref_is_external (spidir_funcref_t func ) {
252+ return spidir_funcref_get_kind (func ) == SPIDIR_FUNCREF_EXTERNAL ;
253+ }
254+
239255/// Returns the module-internal function pointed to by a reference previously
240256/// created with `spidir_funcref_make_internal`.
241257///
You can’t perform that action at this time.
0 commit comments