|
|
| version 1.64, 2016/11/01 23:10:41 | version 1.66, 2016/11/24 14:59:32 |
|---|---|
| Line 78 static void _create(Request& r, MethodPa | Line 78 static void _create(Request& r, MethodPa |
| max_params_count=method->max_numbered_params_count; | max_params_count=method->max_numbered_params_count; |
| } else { | } else { |
| max_params_count=method->params_names?method->params_names->count():0; | max_params_count=method->params_count; |
| } | } |
| if(nparams>max_params_count) | if(nparams>max_params_count) |
| Line 90 static void _create(Request& r, MethodPa | Line 90 static void _create(Request& r, MethodPa |
| nparams); | nparams); |
| Value &object = r.construct(*vclass, *method); | Value &object = r.construct(*vclass, *method); |
| VConstructorFrame frame(*method, r.get_method_frame(), object); | |
| Value* v[100]; | CONSTRUCTOR_FRAME_ACTION(*method, r.get_method_frame(), object, { |
| if(nparams>0){ | Value* v[100]; |
| for(int i=0; i<nparams; i++) | if(nparams>0){ |
| v[i]=&r.process(params[i+2]); | for(int i=0; i<nparams; i++) |
| frame.store_params((Value**)&v, nparams); | v[i]=&r.process(params[i+2]); |
| } else { | frame.store_params((Value**)&v, nparams); |
| frame.empty_params(); | } else { |
| } | frame.empty_params(); |
| r.call(frame); | } |
| object.enable_default_setter(); | r.call(frame); |
| r.write(frame.result()); | object.enable_default_setter(); |
| r.write(frame.result()); | |
| }); | |
| } | } |
| Line 258 static void _field(Request& r, MethodPar | Line 259 static void _field(Request& r, MethodPar |
| static void _method_info(Request& r, MethodParams& params) { | static void _method_info(Request& r, MethodParams& params) { |
| const Method* method; | const Method* method; |
| VStateless_class* vclass=0; | |
| VHash& result=*new VHash; | |
| HashStringValue* hash=result.get_hash(); | |
| if(Junction *j=params[0].get_junction()){ | if(Junction *j=params[0].get_junction()){ |
| if(!(method=j->method)) | if(!(method=j->method)) |
| throw Exception(PARSER_RUNTIME, 0, "param must be class name or method junction"); | throw Exception(PARSER_RUNTIME, 0, "param must be class name or method junction"); |
| hash->put(method_name, new VString(*method->name)); | |
| } else { | } else { |
| const String& class_name=params.as_string(0, "param must be class name or method junction"); | const String& class_name=params.as_string(0, "param must be class name or method junction"); |
| if(!(vclass=r.get_class(class_name))) | VStateless_class* vclass=r.get_class(class_name); |
| if(!vclass) | |
| throw Exception(PARSER_RUNTIME, &class_name, "class is undefined"); | throw Exception(PARSER_RUNTIME, &class_name, "class is undefined"); |
| if(params.count()==1) | if(params.count()==1) |
| Line 274 static void _method_info(Request& r, Met | Line 281 static void _method_info(Request& r, Met |
| const String& method_name=params.as_string(1, "method name must be string"); | const String& method_name=params.as_string(1, "method name must be string"); |
| if(!(method=vclass->get_method(method_name))) | if(!(method=vclass->get_method(method_name))) |
| throw Exception(PARSER_RUNTIME, &method_name, "method not found in class '%s'", vclass->type()); | throw Exception(PARSER_RUNTIME, &method_name, "method not found in class '%s'", vclass->type()); |
| } | |
| VHash& result=*new VHash; | |
| HashStringValue* hash=result.get_hash(); | |
| hash->put(method_name, new VString(*method->name)); | |
| Method* base_method; | Method* base_method; |
| if(vclass && vclass->base() && (base_method=vclass->base()->get_method(*method->name))){ | if(vclass && vclass->base() && (base_method=vclass->base()->get_method(*method->name))){ |
| VStateless_class* c=vclass->base()->get_class(); | VStateless_class* c=vclass->base()->get_class(); |
| while(c->base() && base_method==c->base()->get_method(*method->name)) | while(c->base() && base_method==c->base()->get_method(*method->name)) |
| c=c->base()->get_class(); | c=c->base()->get_class(); |
| hash->put((base_method==method) ? method_inherited : method_overridden, new VString(*new String(c->type()))); | hash->put((base_method==method) ? method_inherited : method_overridden, new VString(*new String(c->type()))); |
| } | |
| } | } |
| Value* call_type=0; | Value* call_type=0; |