Annotation of parser3/src/types/pa_vcaller_wrapper.h, revision 1.3
1.1 moko 1: /** @file
2: Parser: VCaller class decl. as wrapper for $caller access
3:
1.3 ! moko 4: Copyright (c) 2001-2020 Art. Lebedev Studio (http://www.artlebedev.com)
1.1 moko 5: */
6:
7: #ifndef PA_VCALLER_WRAPPER_H
8: #define PA_VCALLER_WRAPPER_H
9:
10: #include "pa_value.h"
11: #include "pa_vmethod_frame.h"
12:
1.3 ! moko 13: #define IDENT_PA_VCALLER_WRAPPER_H "$Id: pa_vcaller_wrapper.h,v 1.2 2017/02/07 22:00:46 moko Exp $"
1.1 moko 14:
15: class VCallerWrapper: public Value {
16: VMethodFrame &fcaller;
17:
18: public: // Value
19:
20: override const char* type() const { return "caller"; }
21:
22: /// VCaller: transparent
23: override VStateless_class* get_class() { return caller().get_class(); }
24:
25: /// VCaller: transparent
26: override VStateless_class* base() { return caller().base(); }
27:
28: /// VCaller: empty string to disable $backup[$caller]
29: override const String* get_string() { return &String::Empty; }
30:
31: /// VCaller: method or transparent
32: override Value* get_element(const String& aname) {
33: if(SYMBOLS_EQ(aname,METHOD_SYMBOL))
34: return caller().method.get_vjunction(caller().self());
35:
36: return caller().get_element(aname);
37: }
38:
39: /// VCaller: transparent
40: override const VJunction* put_element(const String& aname, Value* avalue) { return caller().put_element(aname, avalue); }
41:
42: public: // usage
43:
44: VCallerWrapper(VMethodFrame &acaller): fcaller(acaller) {}
45:
46: VMethodFrame &caller() { return fcaller; }
47:
48: };
49:
50: #endif
E-mail: