|
|
| version 1.99, 2025/10/04 15:51:54 | version 1.103, 2026/04/24 20:14:33 |
|---|---|
| Line 126 static void _create(Request& r, MethodPa | Line 126 static void _create(Request& r, MethodPa |
| static void _classes(Request& r, MethodParams&) { | static void _classes(Request& r, MethodParams&) { |
| VHash& result=*new VHash; | VHash& result=*new VHash; |
| for(HashString<VStateless_class*>::Iterator i(r.classes()); i; i.next()){ | for(OrderedHashString<VStateless_class*>::Iterator i(r.classes()); i; i.next()){ |
| result.hash().put(i.key(), i.value()->get_methods().count()>0 ? new VString(class_type_methoded) : VVoid::get() ); | result.hash().put(i.key(), i.value()->get_methods().count()>0 ? new VString(class_type_methoded) : VVoid::get() ); |
| } | } |
| r.write(result); | r.write(result); |
| Line 475 static void _mixin(Request& r, MethodPar | Line 475 static void _mixin(Request& r, MethodPar |
| if(params.count()>1) | if(params.count()>1) |
| if(HashStringValue* options=params.as_hash(1, "mixin options")) { | if(HashStringValue* options=params.as_hash(1, "mixin options")) { |
| int valid_options=0; | |
| for(HashStringValue::Iterator i(*options); i; i.next() ){ | for(HashStringValue::Iterator i(*options); i; i.next() ){ |
| String::Body key=i.key(); | String::Body key=i.key(); |
| Value* value=i.value(); | Value* value=i.value(); |
| if(key == "to") { | if(key == "to") { |
| vtarget=value; | vtarget=value; |
| valid_options++; | |
| } else if(key == "name") { | } else if(key == "name") { |
| name=&value->as_string(); | name=&value->as_string(); |
| valid_options++; | |
| } else if(key == "methods") { | } else if(key == "methods") { |
| copy_methods=r.process(*value).as_bool(); | copy_methods=r.process(*value).as_bool(); |
| valid_options++; | |
| } else if(key == "fields") { | } else if(key == "fields") { |
| copy_fields=r.process(*value).as_bool(); | copy_fields=r.process(*value).as_bool(); |
| valid_options++; | |
| } else if(key == "overwrite") { | } else if(key == "overwrite") { |
| overwrite=r.process(*value).as_bool(); | overwrite=r.process(*value).as_bool(); |
| valid_options++; | } else |
| } | throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); |
| } | } |
| if(valid_options!=options->count()) | |
| throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); | |
| } | } |
| if(!vtarget) | if(!vtarget) |
| Line 543 static void _override(Request& r, Method | Line 536 static void _override(Request& r, Method |
| const Method* method=j ? j->method : 0; | const Method* method=j ? j->method : 0; |
| if(!method) | if(!method) |
| throw Exception(PARSER_RUNTIME, 0, "param must be method junction"); | throw Exception(PARSER_RUNTIME, 0, "param must be method junction"); |
| if(method->native_code) | |
| throw Exception(PARSER_RUNTIME, 0, "param must not be native method"); | |
| const String *name=method->name; | const String *name=method->name; |
| Value* vtarget=0; | Value* vtarget=0; |
| if(params.count()>1) | if(params.count()>1) |
| if(HashStringValue* options=params.as_hash(1, "override options")) { | if(HashStringValue* options=params.as_hash(1, "override options")) { |
| int valid_options=0; | |
| for(HashStringValue::Iterator i(*options); i; i.next() ){ | for(HashStringValue::Iterator i(*options); i; i.next() ){ |
| if(i.key() == "to") { | if(i.key() == "to") { |
| vtarget=i.value(); | vtarget=i.value(); |
| valid_options++; | |
| } else if(i.key() == "name") { | } else if(i.key() == "name") { |
| name=&i.value()->as_string(); | name=&i.value()->as_string(); |
| valid_options++; | } else |
| } | throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); |
| } | } |
| if(valid_options!=options->count()) | |
| throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); | |
| } | } |
| if(!vtarget) | if(!vtarget) |
| Line 607 static void _tainting(Request& r, Method | Line 598 static void _tainting(Request& r, Method |
| } | } |
| } | } |
| struct LocalsInfo { HashStringValue* args; HashStringValue* locals; }; | |
| static void collect_local(const String::Body& key, Value* value, LocalsInfo* info) { | |
| if(!info->args->contains(key) && (key != "result")) | |
| info->locals->put(key, value->get_junction() ? VVoid::get() : value); | |
| } | |
| static void _stack(Request& r, MethodParams& params) { | static void _stack(Request& r, MethodParams& params) { |
| bool show_args=false; | bool show_args=false; |
| bool show_locals=false; | bool show_locals=false; |
| Line 616 static void _stack(Request& r, MethodPar | Line 614 static void _stack(Request& r, MethodPar |
| if(params.count()>0) | if(params.count()>0) |
| if(HashStringValue* options=params.as_hash(0, "stack options")) { | if(HashStringValue* options=params.as_hash(0, "stack options")) { |
| int valid_options=0; | |
| for(HashStringValue::Iterator i(*options); i; i.next() ){ | for(HashStringValue::Iterator i(*options); i; i.next() ){ |
| String::Body key=i.key(); | String::Body key=i.key(); |
| Value* value=i.value(); | Value* value=i.value(); |
| if(key == "args") { | if(key == "args") { |
| show_args=r.process(*value).as_bool(); | show_args=r.process(*value).as_bool(); |
| valid_options++; | |
| } else if(key == "locals") { | } else if(key == "locals") { |
| show_locals=r.process(*value).as_bool(); | show_locals=r.process(*value).as_bool(); |
| valid_options++; | |
| } else if(key == "limit") { | } else if(key == "limit") { |
| limit=r.process(*value).as_int(); | limit=r.process(*value).as_int(); |
| valid_options++; | |
| } else if(key == "offset") { | } else if(key == "offset") { |
| offset=r.process(*value).as_int(); | offset=r.process(*value).as_int(); |
| valid_options++; | } else |
| } | throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); |
| } | } |
| if(valid_options!=options->count()) | |
| throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); | |
| } | } |
| limit+=offset; | limit+=offset; |
| Line 686 static void _stack(Request& r, MethodPar | Line 676 static void _stack(Request& r, MethodPar |
| VHash& vlocals=*new VHash; | VHash& vlocals=*new VHash; |
| HashStringValue* locals=vlocals.get_hash(); | HashStringValue* locals=vlocals.get_hash(); |
| if(VParserMethodFrame* frame=dynamic_cast<VParserMethodFrame*>(caller)) | if(VParserMethodFrame* frame=dynamic_cast<VParserMethodFrame*>(caller)){ |
| for(HashString<Value*>::Iterator h(frame->my); h; h.next()){ | LocalsInfo linfo = { args, locals }; |
| String::Body key=h.key(); | frame->my.for_each(collect_local, &linfo); |
| Value* value=h.value(); | } |
| if(!args->contains(key) && (key != "result")){ | |
| locals->put(key, value->get_junction() ? VVoid::get() : value); | |
| } | |
| } | |
| HASH_PUT_CSTR(*current, "locals", &vlocals); | HASH_PUT_CSTR(*current, "locals", &vlocals); |
| } | } |