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 int parseInitImpl(
QoreValue& val, QoreParseContext& parse_context);
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; }
107 DLLLOCAL QoreClosureBase* evalBackground(
ExceptionSink* xsink)
const;
109 DLLLOCAL
const LVarSet* getVList()
const {
110 return uf->getVList();
114 DLLLOCAL
bool needsScan()
const {
115 return uf->needsScan();
118 DLLLOCAL UserClosureFunction* getFunction()
const {
122 DLLLOCAL QoreClosureParseNode* refSelf()
const {
124 return const_cast<QoreClosureParseNode*
>(
this);
DLLEXPORT void ref() const
increments the reference count
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
the implementation of Qore's object data type, reference counted, dynamically-allocated only
Definition: QoreObject.h:60
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only
Definition: QoreProgram.h:127
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275