32#ifndef _QORE_QOREPARSELISTNODE_H
34#define _QORE_QOREPARSELISTNODE_H
43class QoreParseListNode :
public ParseNode {
45 typedef std::deque<QoreValue> nvec_t;
47 DLLLOCAL QoreParseListNode(
const QoreProgramLocation* loc) : ParseNode(loc,
NT_PARSE_LIST, true) {
50 DLLLOCAL QoreParseListNode(
const QoreParseListNode& old,
ExceptionSink* xsink) : ParseNode(old),
51 vtype(old.vtype), typeInfo(old.typeInfo), finalized(old.finalized), vlist(old.vlist) {
52 for (
unsigned i = 0; i < old.values.size(); ++i) {
53 add(copy_value_and_resolve_lvar_refs(old.values[i], xsink), old.lvec[i]);
59 DLLLOCAL ~QoreParseListNode() {
60 for (
auto& i : values)
64 DLLLOCAL
void add(
QoreValue v,
const QoreProgramLocation* loc) {
72 }
else if (has_effect() && !v.
hasEffect()) {
81 assert(vtypes.empty());
92 assert(vtypes.empty());
100 assert(i < values.size());
104 DLLLOCAL
const QoreValue get(
size_t i)
const {
105 assert(i < values.size());
109 DLLLOCAL
QoreValue& getReference(
size_t i) {
110 assert(i < values.size());
114 DLLLOCAL
const QoreProgramLocation* getLocation(
size_t i)
const {
115 assert(i < lvec.size());
125 DLLLOCAL
size_t size()
const {
126 return values.size();
129 DLLLOCAL
bool empty()
const {
130 return values.empty();
133 DLLLOCAL
void setFinalized() {
138 DLLLOCAL
bool isFinalized()
const {
142 DLLLOCAL
bool isVariableList()
const {
146 DLLLOCAL
void setVariableList() {
151 DLLLOCAL
void finalizeBlock(
int start_line,
int end_line);
153 DLLLOCAL nvec_t& getValues() {
157 DLLLOCAL
const nvec_t& getValues()
const {
161 DLLLOCAL
const type_vec_t& getValueTypes()
const {
165 DLLLOCAL QoreParseListNode* listRefSelf()
const {
167 return const_cast<QoreParseListNode*
>(
this);
176 DLLLOCAL
virtual const char* getTypeName()
const {
180 DLLLOCAL QoreParseListNode* copyBlank()
const {
181 QoreParseListNode* n =
new QoreParseListNode(loc);
184 n->finalized = finalized;
189 DLLLOCAL
int parseInitIntern(
bool&
needs_eval, QoreParseContext& parse_context);
192 typedef std::deque<const QoreProgramLocation*> lvec_t;
197 const QoreTypeInfo* vtype =
nullptr;
199 const QoreTypeInfo* typeInfo;
201 bool finalized =
false;
205 DLLLOCAL
virtual const QoreTypeInfo* getTypeInfo()
const {
209 DLLLOCAL
virtual int parseInitImpl(
QoreValue& val, QoreParseContext& parse_context);
DLLLOCAL bool needs_eval() const
returns true if the object needs evaluation to return a value, false if not
Definition: AbstractQoreNode.h:145
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:50
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
DLLEXPORT bool hasEffect() const
return true if the value needs evaluation and has a side effect
Qore's string type supported by the QoreEncoding class.
Definition: QoreString.h:93
std::vector< const QoreTypeInfo * > type_vec_t
vector of type information for parameter lists
Definition: common.h:251
const qore_type_t NT_PARSE_LIST
type value for QoreParseListNode
Definition: node_types.h:84
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:276
DLLEXPORT bool hasNode() const
returns true if the object contains a non-null AbstractQoreNode pointer (ie type == QV_Node && v....