Annotation of parser3/src/types/pa_vstateless_class.C, revision 1.16
1.8 paf 1: /** @file
2: Parser: stateless class.
3:
1.12 paf 4: Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.13 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)\
1.14 paf 6: */
1.8 paf 7:
1.16 ! paf 8: static const char* IDENT_VSTATELESS_CLASS_C="$Date: 2002/08/01 11:41:24 $";
1.2 paf 9:
10: #include "pa_vstateless_class.h"
11: #include "pa_vstring.h"
12:
13: void VStateless_class::add_native_method(
14: const char *cstr_name,
1.7 paf 15: Method::Call_type call_type,
1.2 paf 16: Native_code_ptr native_code,
17: int min_numbered_params_count, int max_numbered_params_count) {
18:
1.4 paf 19: String& name=*NEW String(pool(), cstr_name);
1.2 paf 20:
21: Method& method=*NEW Method(pool(),
22: name,
1.7 paf 23: call_type,
1.2 paf 24: min_numbered_params_count, max_numbered_params_count,
25: 0/*params_names*/, 0/*locals_names*/,
26: 0/*parser_code*/, native_code
27: );
28: add_method(name, method);
1.16 ! paf 29: }
! 30:
! 31: /// VStateless_class: $CLASS, $method
! 32: Value *VStateless_class::get_element(const String& aname, Value *aself, bool looking_up) {
! 33: // $CLASS
! 34: if(aname==CLASS_NAME)
! 35: return this;
! 36:
! 37: // $method=junction(self+class+method)
! 38: if(Method *method=static_cast<Method *>(fmethods.get(aname)))
! 39: return new(aname.pool()) VJunction(
! 40: *new(aname.pool()) Junction(aname.pool(), *aself, method, 0,0,0,0));
! 41: if(fbase)
! 42: return fbase->get_element(aname, aself, looking_up);
! 43: return 0;
1.2 paf 44: }
E-mail: