|
|
| version 1.91, 2024/09/17 18:09:59 | version 1.95, 2024/12/07 15:14:56 |
|---|---|
| Line 1 | Line 1 |
| /** @file | /** @file |
| Parser: @b reflection parser class. | Parser: @b reflection parser class. |
| Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) | Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) |
| Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru> | Authors: Konstantin Morshnev <moko@design.ru>, Alexandr Petrosian <paf@design.ru> |
| */ | */ |
| #include "pa_vmethod_frame.h" | #include "pa_vmethod_frame.h" |
| #include "pa_request.h" | #include "pa_request.h" |
| #include "pa_vbool.h" | #include "pa_vbool.h" |
| #include "pa_varray.h" | |
| #include "pa_vobject.h" | #include "pa_vobject.h" |
| volatile const char * IDENT_REFLECTION_C="$Id$"; | volatile const char * IDENT_REFLECTION_C="$Id$"; |
| Line 26 static const String method_overridden("o | Line 27 static const String method_overridden("o |
| static const String method_min_params("min_params"); | static const String method_min_params("min_params"); |
| static const String method_max_params("max_params"); | static const String method_max_params("max_params"); |
| static const String method_extra_param("extra_param"); | static const String method_extra_param("extra_param"); |
| static const String method_named_params("named_params"); | |
| static const String def_class("class"); | static const String def_class("class"); |
| Line 197 static void _def(Request& r, MethodParam | Line 199 static void _def(Request& r, MethodParam |
| // can't use get_class because it will call @autouse[] if the class wasn't loaded | // can't use get_class because it will call @autouse[] if the class wasn't loaded |
| r.write(VBool::get(r.classes().get(name)!=0)); | r.write(VBool::get(r.classes().get(name)!=0)); |
| } else { | } else { |
| throw Exception(PARSER_RUNTIME, &type, "is invalid type, must be '%s'", def_class.cstr()); | throw Exception(PARSER_RUNTIME, &type, "is an invalid type, must be '%s'", def_class.cstr()); |
| } | } |
| } | } |
| Line 361 static void _method_info(Request& r, Met | Line 363 static void _method_info(Request& r, Met |
| if( filespec ) | if( filespec ) |
| hash->put("file", new VString(*filespec)); | hash->put("file", new VString(*filespec)); |
| hash->put(method_max_params, new VInt(method->params_names ? method->params_names->count() : 0)); | hash->put(method_max_params, new VInt(method->params_count + (method->named_params ? 1 : 0))); |
| if(method->params_names) | if(method->params_names) |
| for(size_t i=0; i<method->params_names->count(); i++) | for(size_t i=0; i<method->params_names->count(); i++) |
| Line 369 static void _method_info(Request& r, Met | Line 371 static void _method_info(Request& r, Met |
| if(method->extra_params) | if(method->extra_params) |
| hash->put(method_extra_param, new VString(*method->extra_params)); | hash->put(method_extra_param, new VString(*method->extra_params)); |
| if(method->named_params){ | |
| size_t named_count=method->named_params->count(); | |
| VArray& named_params=*new VArray(named_count); | |
| ArrayValue &array=named_params.array(); | |
| for(int i=0; i<named_count; i++) { | |
| const String& fname=*(*method->named_params)[i]; | |
| array+=new VString(fname); | |
| } | |
| hash->put(method_named_params, &named_params); | |
| } | |
| } | } |
| r.write(result); | r.write(result); |
| Line 652 static void _stack(Request& r, MethodPar | Line 665 static void _stack(Request& r, MethodPar |
| } | } |
| } | } |
| result->put(format(index, 0), &vcurrent); | result->put(pa_uitoa(index), &vcurrent); |
| } | } |
| caller=caller->caller(); | caller=caller->caller(); |
| index++; | index++; |