void VarRefDeclNode::parseInitCommon(LocalVar *oflag, int pflag, int &lvids, bool is_new) { if (!typeInfo) { typeInfo = parseTypeInfo->resolveAndDelete(loc); parseTypeInfo = 0; } #ifdef DEBUG else assert(!parseTypeInfo); #endif parseInitIntern(oflag, pflag, lvids, typeInfo, is_new); }
int StatementBlock::parseInitImpl(LocalVar* oflag, int pflag) { QORE_TRACE("StatementBlock::parseInitImpl"); printd(4, "StatementBlock::parseInitImpl(b=%p, oflag=%p)\n", this, oflag); BlockStartHelper bsh; int lvids = parseInitIntern(oflag, pflag & ~PF_TOP_LEVEL, statement_list.end()); // this call will pop all local vars off the stack setupLVList(lvids); //printd(5, "StatementBlock::parseInitImpl(this=%p): done (lvars=%p, %d vars, vstack = %p)\n", this, lvars, lvids, getVStack()); return 0; }
void TopLevelStatementBlock::parseInit(int64 po) { QORE_TRACE("TopLevelStatementBlock::parseInit"); //printd(5, "TopLevelStatementBlock::parseInit(rns=%p) first=%d\n", &rns, first); if (!first && lvars) { // push already-registered local variables on the stack for (unsigned i = 0; i < lvars->size(); ++i) push_top_level_local_var(lvars->lv[i], loc); } // resolve global variables before initializing the top-level statements qore_root_ns_private::parseResolveGlobalVars(); int lvids = parseInitIntern(0, PF_TOP_LEVEL, hwm); //printd(5, "TopLevelStatementBlock::parseInit(rns=%p) first=%d, lvids=%d\n", &rns, first, lvids); if (!first && lvids) { parseException("ILLEGAL-TOP-LEVEL-LOCAL-VARIABLE", "local variables declared with 'my' in the top-level block of a Program object can only be declared in the very first code block parsed"); // discard variables immediately for (int i = 0; i < lvids; ++i) pop_local_var(); } // now initialize root namespace and functions before local variables are popped off the stack qore_root_ns_private::parseInit(); if (first) { // if parsing a module, then initialize the init function QoreModuleDefContext* qmd = get_module_def_context(); if (qmd) qmd->parseInit(); // this call will pop all local vars off the stack setupLVList(lvids); first = false; } else if (lvars) { for (unsigned i = 0; i < lvars->size(); ++i) pop_local_var(); } assert(!getVStack()); //printd(5, "TopLevelStatementBlock::parseInitTopLevel(this=%p): done (lvars=%p, %d vars, vstack = %p)\n", this, lvars, lvids, getVStack()); return; }
AbstractQoreNode* VarRefNode::parseInitImpl(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&outTypeInfo) { parseInitIntern(oflag, pflag, lvids, 0); bool is_assignment = pflag & PF_FOR_ASSIGNMENT; // this expression returns nothing if it's a new local variable // so if we're not assigning we return nothingTypeInfo as the // return type if (!is_assignment && new_decl) { assert(!outTypeInfo); outTypeInfo = nothingTypeInfo; } else outTypeInfo = parseGetTypeInfo(); return this; }
AbstractQoreNode *QorePreIncrementOperatorNode::parseInitImpl(LocalVar* oflag, int pflag, int& lvids, const QoreTypeInfo*& outTypeInfo) { parseInitIntern(op_str.getBuffer(), oflag, pflag, lvids, outTypeInfo); // version for local var return (typeInfo == bigIntTypeInfo || typeInfo == softBigIntTypeInfo) ? makeSpecialization<QoreIntPreIncrementOperatorNode>() : this; }
AbstractQoreNode *QoreDivideEqualsOperatorNode::parseInitImpl(LocalVar *oflag, int pflag, int &lvids, const QoreTypeInfo *&typeInfo) { parseInitIntern(op_str.getBuffer(), oflag, pflag, lvids, typeInfo); return this; }