|
|
| version 1.56, 2016/09/26 17:02:19 | version 1.58, 2016/09/27 21:11:18 |
|---|---|
| Line 192 static void _methods(Request& r, MethodP | Line 192 static void _methods(Request& r, MethodP |
| r.write_no_lang(result); | r.write_no_lang(result); |
| } | } |
| static VJunction &method_junction(Value &self, Method &method, const String *name=0){ | static VJunction &method_junction(Value &self, Method &method){ |
| if(method.native_code) | if(method.native_code) |
| throw Exception(PARSER_RUNTIME, name, "method must not be native"); | throw Exception(PARSER_RUNTIME, method.name, "method must not be native"); |
| if(!(dynamic_cast<VObject*>(&self) || dynamic_cast<VClass*>(&self))) | if(!(dynamic_cast<VObject*>(&self) || dynamic_cast<VClass*>(&self))) |
| throw Exception(PARSER_RUNTIME, 0, "self must be parser object or class"); | throw Exception(PARSER_RUNTIME, 0, "self must be parser object or class"); |
| Line 221 static void _method(Request& r, MethodPa | Line 221 static void _method(Request& r, MethodPa |
| if(VStateless_class* vclass=source.get_class()) { | if(VStateless_class* vclass=source.get_class()) { |
| if(Method* method=vclass->get_method(name)){ | if(Method* method=vclass->get_method(name)){ |
| r.write_no_lang( params.count()>2 ? method_junction(params.as_no_junction(2, "self must be object, not junction"), *method, &name) : *method->get_vjunction(source) ); | r.write_no_lang( params.count()>2 ? method_junction(params.as_no_junction(2, "self must be object, not junction"), *method) : *method->get_vjunction(source) ); |
| return; | return; |
| } | } |
| } | } |
| Line 363 static void _uid(Request& r, MethodParam | Line 363 static void _uid(Request& r, MethodParam |
| } | } |
| static void _delete(Request&, MethodParams& params) { | static void _delete(Request&, MethodParams& params) { |
| Value* v=¶ms.as_no_junction(0, "param must be object or class, not junction"); | |
| const String& key=params.as_string(1, "field name must be string"); | const String& key=params.as_string(1, "field name must be string"); |
| if(HashStringValue* fields=params[0].get_fields()){ | |
| fields->remove(key); | if(VObject* o=dynamic_cast<VObject*>(v)){ |
| o->get_fields()->remove(key); | |
| } else if(VClass* c=dynamic_cast<VClass*>(v)){ | |
| HashStringProperty &p=*c->get_properties(); | |
| if(Property* property=p.get(key)) | |
| if(property->value) | |
| p.remove(key); | |
| } | } |
| } | } |
| Line 432 static void _mixin(Request& r, MethodPar | Line 439 static void _mixin(Request& r, MethodPar |
| if(copy_methods) | if(copy_methods) |
| for(HashStringMethod::Iterator i(source->get_methods()); i; i.next()){ | for(HashStringMethod::Iterator i(source->get_methods()); i; i.next()){ |
| if(overwrite || !target->get_method(i.key())) | if(overwrite || !target->get_method(i.key())) |
| target->set_method(*new String(i.key(), String::L_TAINTED), i.value()); | target->set_method(*i.value()->name, i.value()); |
| } | } |
| if(copy_fields) | if(copy_fields) |
| for(HashStringProperty::Iterator i(*source->get_properties()); i; i.next()){ | for(HashStringProperty::Iterator i(*source->get_properties()); i; i.next()){ |