@@ -3489,77 +3489,24 @@ ip_ruby_cmd_core(arg)
34893489 return ret ;
34903490}
34913491
3492- #define SUPPORT_NESTED_CONST_AS_IP_RUBY_CMD_RECEIVER 1
3493-
34943492static VALUE
34953493ip_ruby_cmd_receiver_const_get (name )
34963494 char * name ;
34973495{
3498- volatile VALUE klass = rb_cObject ;
3499- #if 0
3500- char * head , * tail ;
3501- #endif
3502- int state ;
3503-
3504- #if SUPPORT_NESTED_CONST_AS_IP_RUBY_CMD_RECEIVER
3505- klass = rb_eval_string_protect (name , & state );
3506- if (state ) {
3507- return Qnil ;
3508- } else {
3509- return klass ;
3510- }
3511- #else
3512- return rb_const_get (klass , rb_intern (name ));
3513- #endif
3514-
3515- /* TODO!!!!!! */
3516- /* support nest of classes/modules */
3517-
3518- /* return rb_eval_string(name); */
3519- /* return rb_eval_string_protect(name, &state); */
3520-
3521- #if 0 /* doesn't work!! (fail to autoload?) */
3522- /* duplicate */
3523- head = name = strdup (name );
3524-
3525- /* has '::' at head ? */
3526- if (* head == ':' ) head += 2 ;
3527- tail = head ;
3528-
3529- /* search */
3530- while (* tail ) {
3531- if (* tail == ':' ) {
3532- * tail = '\0' ;
3533- klass = rb_const_get (klass , rb_intern (head ));
3534- tail += 2 ;
3535- head = tail ;
3536- } else {
3537- tail ++ ;
3538- }
3539- }
3540-
3541- free (name );
3542- return rb_const_get (klass , rb_intern (head ));
3543- #endif
3496+ return rb_path2class (name );
35443497}
35453498
35463499static VALUE
35473500ip_ruby_cmd_receiver_get (str )
35483501 char * str ;
35493502{
35503503 volatile VALUE receiver ;
3551- #if !SUPPORT_NESTED_CONST_AS_IP_RUBY_CMD_RECEIVER
35523504 int state ;
3553- #endif
35543505
35553506 if (str [0 ] == ':' || ('A' <= str [0 ] && str [0 ] <= 'Z' )) {
35563507 /* class | module | constant */
3557- #if SUPPORT_NESTED_CONST_AS_IP_RUBY_CMD_RECEIVER
3558- receiver = ip_ruby_cmd_receiver_const_get (str );
3559- #else
35603508 receiver = rb_protect (ip_ruby_cmd_receiver_const_get , (VALUE )str , & state );
35613509 if (state ) return Qnil ;
3562- #endif
35633510 } else if (str [0 ] == '$' ) {
35643511 /* global variable */
35653512 receiver = rb_gv_get (str );
0 commit comments