@@ -3571,7 +3571,7 @@ DUK_INTERNAL const char *duk_get_type_name(duk_hthread *thr, duk_idx_t idx) {
35713571
35723572 return duk__type_names [type_tag ];
35733573}
3574- #endif
3574+ #endif /* DUK_USE_VERBOSE_ERRORS && DUK_USE_PARANOID_ERRORS */
35753575
35763576DUK_INTERNAL duk_small_uint_t duk_get_class_number (duk_hthread * thr , duk_idx_t idx ) {
35773577 duk_tval * tv ;
@@ -3809,12 +3809,31 @@ DUK_EXTERNAL duk_bool_t duk_is_function(duk_hthread *thr, duk_idx_t idx) {
38093809 DUK_ASSERT_CTX_VALID (thr );
38103810
38113811 tv = duk_get_tval_or_unused (thr , idx );
3812+ if (DUK_TVAL_IS_OBJECT (tv )) {
3813+ duk_hobject * h ;
3814+ h = DUK_TVAL_GET_OBJECT (tv );
3815+ DUK_ASSERT (h != NULL );
3816+ return DUK_HOBJECT_HAS_CALLABLE (h ) ? 1 : 0 ;
3817+ }
38123818 if (DUK_TVAL_IS_LIGHTFUNC (tv )) {
38133819 return 1 ;
38143820 }
3815- return duk__obj_flag_any_default_false (thr ,
3816- idx ,
3817- DUK_HOBJECT_FLAG_CALLABLE );
3821+ return 0 ;
3822+ }
3823+
3824+ DUK_INTERNAL duk_bool_t duk_is_callable_tval (duk_hthread * thr , duk_tval * tv ) {
3825+ DUK_ASSERT_CTX_VALID (thr );
3826+
3827+ if (DUK_TVAL_IS_OBJECT (tv )) {
3828+ duk_hobject * h ;
3829+ h = DUK_TVAL_GET_OBJECT (tv );
3830+ DUK_ASSERT (h != NULL );
3831+ return DUK_HOBJECT_HAS_CALLABLE (h ) ? 1 : 0 ;
3832+ }
3833+ if (DUK_TVAL_IS_LIGHTFUNC (tv )) {
3834+ return 1 ;
3835+ }
3836+ return 0 ;
38183837}
38193838
38203839DUK_EXTERNAL duk_bool_t duk_is_constructable (duk_hthread * thr , duk_idx_t idx ) {
@@ -3823,12 +3842,16 @@ DUK_EXTERNAL duk_bool_t duk_is_constructable(duk_hthread *thr, duk_idx_t idx) {
38233842 DUK_ASSERT_CTX_VALID (thr );
38243843
38253844 tv = duk_get_tval_or_unused (thr , idx );
3845+ if (DUK_TVAL_IS_OBJECT (tv )) {
3846+ duk_hobject * h ;
3847+ h = DUK_TVAL_GET_OBJECT (tv );
3848+ DUK_ASSERT (h != NULL );
3849+ return DUK_HOBJECT_HAS_CONSTRUCTABLE (h ) ? 1 : 0 ;
3850+ }
38263851 if (DUK_TVAL_IS_LIGHTFUNC (tv )) {
38273852 return 1 ;
38283853 }
3829- return duk__obj_flag_any_default_false (thr ,
3830- idx ,
3831- DUK_HOBJECT_FLAG_CONSTRUCTABLE );
3854+ return 0 ;
38323855}
38333856
38343857DUK_EXTERNAL duk_bool_t duk_is_c_function (duk_hthread * thr , duk_idx_t idx ) {
0 commit comments