Diff for /parser3/src/classes/reflection.C between versions 1.34 and 1.37

version 1.34, 2015/10/22 11:45:36 version 1.37, 2015/10/26 01:03:42
Line 333  static void _dynamical(Request& r, Metho Line 333  static void _dynamical(Request& r, Metho
         }          }
 }  }
   
   static void _is(Request& r, MethodParams& params) {
           const String& type=params.as_string(0, "class name must be string");
           const String& name=params.as_string(params.count()-1, "element name must be string");
           Value *context=params.count()==3 ? &(params.as_no_junction(1, "context must not be code")) : r.get_method_frame()->caller();
           Value *value=context ? context->get_element(name) : 0;
   
           if(value) {
                   if(type == "code" || type == "method") {
                           Junction *junction=value->get_junction();
                           r.write_no_lang(VBool::get(junction && ((junction->code==0) ^ (type == "code"))) );
                   } else {
                           r.write_no_lang(VBool::get( value->is(type.cstr()) ));
                   }
           } else
                   r.write_no_lang(VBool::get(type == "void"));
   }
   
 static void _copy(Request& r, MethodParams& params) {  static void _copy(Request& r, MethodParams& params) {
         HashStringValue* src=params.as_no_junction(0, "source must not be code").get_hash();          HashStringValue* src=params.as_no_junction(0, "source must not be code").get_hash();
   
Line 406  MReflection::MReflection(): Methoded("re Line 423  MReflection::MReflection(): Methoded("re
         // ^reflection:dynamical[[object or class, caller if absent]]          // ^reflection:dynamical[[object or class, caller if absent]]
         add_native_method("dynamical", Method::CT_STATIC, _dynamical, 0, 1);          add_native_method("dynamical", Method::CT_STATIC, _dynamical, 0, 1);
   
           // ^reflection:is[class_name|code|method;[context;]element_name]
           add_native_method("is", Method::CT_STATIC, _is, 2, 3);
   
         // ^reflection:copy[src;dst]          // ^reflection:copy[src;dst]
         add_native_method("copy", Method::CT_STATIC, _copy, 2, 2);          add_native_method("copy", Method::CT_STATIC, _copy, 2, 2);
   

Removed from v.1.34  
changed lines
  Added in v.1.37


E-mail: