Annotation of parser3/src/types/pa_vjunction.h, revision 1.33
1.3 paf 1: /** @file
1.4 paf 2: Parser: @b junction class decl.
1.3 paf 3:
1.31 moko 4: Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com)
1.12 paf 5: Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1 paf 6: */
7:
8: #ifndef PA_VJUNCTION_H
9: #define PA_VJUNCTION_H
1.14 paf 10:
1.33 ! misha 11: #define IDENT_PA_VJUNCTION_H "$Id: pa_vjunction.h,v 1.32 2012/05/23 16:26:41 moko Exp $"
1.20 paf 12:
13: // include
1.1 paf 14:
15: #include "pa_value.h"
1.20 paf 16: #include "pa_junction.h"
1.1 paf 17:
1.30 misha 18: #define JUNCTION_CLASS_NAME "junction"
19: static const String junction_class_name(JUNCTION_CLASS_NAME);
20:
1.4 paf 21: /// junction is method+self+context, implemented with Junction
1.20 paf 22: class VJunction: public Value {
1.1 paf 23: public: // VJunction
24:
1.30 misha 25: override const char* type() const { return JUNCTION_CLASS_NAME; }
1.13 paf 26:
27: /// VJunction: 0
1.20 paf 28: override VStateless_class *get_class() { return 0; }
1.8 parser 29:
1.18 paf 30: /// VJunction: false
1.20 paf 31: override bool is_defined() const { return false; }
1.8 parser 32:
1.18 paf 33: /// VJunction: false
1.32 moko 34: override bool as_bool() const { return false; }
1.18 paf 35:
36: /// VJunction: false
1.32 moko 37: override Value& as_expr_result();
1.1 paf 38:
1.5 paf 39: /// VJunction: method, root,self,rcontext, code
1.23 paf 40: override Junction* get_junction() { return &fjunction; }
1.1 paf 41:
1.33 ! misha 42: #ifndef OPTIMIZE_BYTECODE_GET_ELEMENT__SPECIAL
1.30 misha 43: // VJunction: CLASS, CLASS_NAME
44: override Value* get_element(const String& aname);
1.33 ! misha 45: #endif
1.30 misha 46:
1.1 paf 47: public: // usage
48:
1.23 paf 49: /// Code-Junction constructor
50: VJunction(Value& aself,
51: const Method* amethod,
52: VMethodFrame* amethod_frame,
53: Value* arcontext,
54: WContext* awcontext,
55: ArrayOperation* acode): fjunction(aself, amethod, amethod_frame, arcontext, awcontext, acode) {}
56:
57: /// Method-Junction or Getter-Junction constructor
58: VJunction(Value& aself,
59: const Method* amethod,
1.26 misha 60: bool ais_getter=false,
61: String* aauto_name=0
62: ): fjunction(aself, amethod, ais_getter, aauto_name) {}
1.23 paf 63:
64: const Junction& junction() const { return fjunction; }
1.1 paf 65:
1.27 misha 66: inline VJunction *get(Value& aself){
67: return &(fjunction.self)==&aself?this:new VJunction(aself, fjunction.method);
68: }
69:
1.28 misha 70: void reattach(WContext *new_wcontext);
71:
1.1 paf 72: private:
73:
1.23 paf 74: Junction fjunction;
1.1 paf 75: };
76:
77:
78: #endif
E-mail: