|
|
| version 1.50, 2016/09/13 22:30:30 | version 1.52, 2016/09/19 22:27:57 |
|---|---|
| Line 156 static void _base(Request& r, MethodPara | Line 156 static void _base(Request& r, MethodPara |
| } | } |
| // classes with fields only, like env & console or without base | // classes with fields only, like env & console or without base |
| r.write_no_lang(*VVoid::get()); | r.write_value(*VVoid::get()); |
| } | } |
| Line 193 static void _methods(Request& r, MethodP | Line 193 static void _methods(Request& r, MethodP |
| static VJunction &method_junction(Value &self, Method &method, const String *name=0){ | static VJunction &method_junction(Value &self, Method &method, const String *name=0){ |
| if(method.native_code) | if(method.native_code) |
| throw Exception(PARSER_RUNTIME, name, "method should not be native"); | throw Exception(PARSER_RUNTIME, name, "method must not be native"); |
| // if(dynamic_cast<VObject*>(&self)) | if(!(dynamic_cast<VObject*>(&self) || dynamic_cast<VClass*>(&self))) |
| // throw Exception(PARSER_RUNTIME, 0, "self should be parser object"); | throw Exception(PARSER_RUNTIME, 0, "self must be parser object or class"); |
| return *method.get_vjunction(self); | return *method.get_vjunction(self); |
| } | } |
| Line 210 static void _method(Request& r, MethodPa | Line 210 static void _method(Request& r, MethodPa |
| r.write_no_lang(method_junction(self, *method)); | r.write_no_lang(method_junction(self, *method)); |
| return; | return; |
| } | } |
| throw Exception(PARSER_RUNTIME, 0, "param should be method junction"); | throw Exception(PARSER_RUNTIME, 0, "param must be method junction"); |
| } | } |
| if(params.count()==1) | if(params.count()==1) |
| throw Exception(PARSER_RUNTIME, 0, "method name should be specified"); | throw Exception(PARSER_RUNTIME, 0, "method name must be specified"); |
| const String& name=params.as_string(1, "method name must be string"); | const String& name=params.as_string(1, "method name must be string"); |
| Value& self=params.count()>2 ? params.as_no_junction(2, "self must be object, not junction") : source; | |
| 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(method_junction(self, *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) ); |
| return; | return; |
| } | } |
| } | } |
| throw Exception(PARSER_RUNTIME, &name, "method not found in class '%s'", source.type()); | r.write_value(*VVoid::get()); |
| } | } |
| static void _fields(Request& r, MethodParams& params) { | static void _fields(Request& r, MethodParams& params) { |