@@ -54,7 +54,7 @@ static SEXP s_dot_Methods, s_skeleton, s_expression, s_function,
5454 s_missing , s_generic_dot_skeleton , s_subset_gets , s_element_gets ,
5555 s_argument , s_allMethods , s_base ;
5656static SEXP R_FALSE , R_TRUE ;
57- static bool table_dispatch_on = 1 ;
57+ static bool table_dispatch_on = true ;
5858
5959/* precomputed skeletons for special primitive calls */
6060static SEXP R_short_skeletons , R_empty_skeletons ;
@@ -1172,11 +1172,13 @@ SEXP R_dispatchGeneric(SEXP fname, SEXP ev, SEXP fdef)
11721172
11731173SEXP R_set_method_dispatch (SEXP onOff )
11741174{
1175- bool prev = table_dispatch_on , value = asBool (onOff );
1175+ int value = asLogical (onOff );
11761176 if (value == NA_LOGICAL ) /* just return previous*/
1177- value = prev ;
1178- table_dispatch_on = value ;
1179- if (value != prev ) {
1177+ return ScalarLogical (table_dispatch_on );
1178+ // else
1179+ bool prev = table_dispatch_on ;
1180+ table_dispatch_on = (bool )value ;
1181+ if (table_dispatch_on != prev ) {
11801182 R_set_standardGeneric_ptr (
11811183 (table_dispatch_on ? R_dispatchGeneric : R_standardGeneric ),
11821184 Methods_Namespace );
0 commit comments