32 #ifndef _QORE_QORECLOSUREPARSENODE_H 34 #define _QORE_QORECLOSUREPARSENODE_H 36 #include "qore/intern/ParseNode.h" 41 class ThreadSafeLocalVarRuntimeEnvironment;
43 class ClosureParseEnvironment {
46 VNode* high_water_mark;
47 ClosureParseEnvironment* prev;
50 DLLLOCAL ClosureParseEnvironment(LVarSet* n_vlist) : vlist(n_vlist), high_water_mark(getVStack()) {
51 prev = thread_get_closure_parse_env();
52 thread_set_closure_parse_env(
this);
55 DLLLOCAL ~ClosureParseEnvironment() {
56 thread_set_closure_parse_env(prev);
59 DLLLOCAL VNode* getHighWaterMark() {
60 return high_water_mark;
63 DLLLOCAL
void add(LocalVar* var) {
69 class QoreClosureNode;
70 class QoreObjectClosureNode;
72 class QoreClosureParseNode :
public ParseNode {
73 friend class QoreClosureParseNodeBackground;
75 UserClosureFunction* uf;
76 bool lambda, in_method;
80 DLLLOCAL
virtual void parseInitImpl(
QoreValue& val, LocalVar* oflag,
int pflag,
int& lvids,
const QoreTypeInfo*& typeInfo);
81 DLLLOCAL
virtual const QoreTypeInfo* getTypeInfo()
const {
82 return runTimeClosureTypeInfo;
85 DLLLOCAL QoreClosureNode* evalClosure()
const;
86 DLLLOCAL QoreObjectClosureNode* evalObjectClosure()
const;
89 DLLLOCAL QoreClosureParseNode(
const QoreProgramLocation* loc, UserClosureFunction* n_uf,
bool n_lambda =
false);
91 DLLLOCAL ~QoreClosureParseNode() {
97 DLLLOCAL
virtual const char* getTypeName()
const;
98 DLLLOCAL
static const char* getStaticTypeName() {
99 return "function closure";
102 DLLLOCAL
bool isLambda()
const {
return lambda; }
106 DLLLOCAL QoreClosureBase* evalBackground(
ExceptionSink* xsink)
const;
108 DLLLOCAL
const LVarSet* getVList()
const {
109 return uf->getVList();
113 DLLLOCAL
bool needsScan()
const {
114 return uf->needsScan();
117 DLLLOCAL UserClosureFunction* getFunction()
const {
121 DLLLOCAL QoreClosureParseNode* refSelf()
const {
123 return const_cast<QoreClosureParseNode*
>(
this);
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:81
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:262
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only ...
Definition: QoreProgram.h:126
the implementation of Qore's object data type, reference counted, dynamically-allocated only ...
Definition: QoreObject.h:61
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:46