32 #ifndef _QORE_QOREPARSELISTNODE_H
34 #define _QORE_QOREPARSELISTNODE_H
43 class QoreParseListNode :
public ParseNode {
45 typedef std::vector<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), vtype(old.vtype), typeInfo(old.typeInfo), finalized(old.finalized), vlist(old.vlist) {
51 values.reserve(old.values.size());
52 lvec.reserve(old.lvec.size());
54 for (
unsigned i = 0; i < old.values.size(); ++i) {
55 add(copy_value_and_resolve_lvar_refs(old.values[i], xsink), old.lvec[i]);
61 DLLLOCAL ~QoreParseListNode() {
62 for (
auto& i : values)
66 DLLLOCAL
void add(
QoreValue v,
const QoreProgramLocation* loc) {
71 if (v.
hasNode() && v.hasEffect())
73 }
else if (has_effect() && !v.hasEffect()) {
81 assert(vtypes.empty());
83 values.erase(values.begin());
84 lvec.erase(lvec.begin());
89 assert(i < values.size());
93 DLLLOCAL
const QoreValue get(
size_t i)
const {
94 assert(i < values.size());
98 DLLLOCAL
QoreValue& getReference(
size_t i) {
99 assert(i < values.size());
103 DLLLOCAL
const QoreProgramLocation* getLocation(
size_t i)
const {
104 assert(i < lvec.size());
114 DLLLOCAL
size_t size()
const {
115 return values.size();
118 DLLLOCAL
bool empty()
const {
119 return values.empty();
122 DLLLOCAL
void setFinalized() {
127 DLLLOCAL
bool isFinalized()
const {
131 DLLLOCAL
bool isVariableList()
const {
135 DLLLOCAL
void setVariableList() {
140 DLLLOCAL
void finalizeBlock(
int start_line,
int end_line);
142 DLLLOCAL nvec_t& getValues() {
146 DLLLOCAL
const nvec_t& getValues()
const {
150 DLLLOCAL
const type_vec_t& getValueTypes()
const {
154 DLLLOCAL QoreParseListNode* listRefSelf()
const {
156 return const_cast<QoreParseListNode*
>(
this);
165 DLLLOCAL
virtual const char* getTypeName()
const {
169 DLLLOCAL QoreParseListNode* copyBlank()
const {
170 QoreParseListNode* n =
new QoreParseListNode(loc);
173 n->finalized = finalized;
178 DLLLOCAL
bool parseInitIntern(LocalVar* oflag,
int pflag,
int& lvids,
const QoreTypeInfo*& typeInfo);
181 typedef std::vector<const QoreProgramLocation*> lvec_t;
186 const QoreTypeInfo* vtype =
nullptr;
188 const QoreTypeInfo* typeInfo;
190 bool finalized =
false;
194 DLLLOCAL
virtual const QoreTypeInfo* getTypeInfo()
const {
198 DLLLOCAL
virtual void parseInitImpl(
QoreValue& val, LocalVar *oflag,
int pflag,
int &lvids,
const QoreTypeInfo *&returnTypeInfo);