本文整理汇总了C++中VNode::isBlockStart方法的典型用法代码示例。如果您正苦于以下问题:C++ VNode::isBlockStart方法的具体用法?C++ VNode::isBlockStart怎么用?C++ VNode::isBlockStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VNode
的用法示例。
在下文中一共展示了VNode::isBlockStart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: push_local_var
LocalVar* push_local_var(const char* name, const QoreProgramLocation& loc, const QoreTypeInfo* typeInfo, bool is_arg, int n_refs, bool top_level) {
QoreProgram* pgm = getProgram();
LocalVar* lv = pgm->createLocalVar(name, typeInfo);
QoreString ls;
loc.toString(ls);
//printd(5, "push_local_var() lv: %p name: %s type: %s %s\n", lv, name, typeInfo->getName(), ls.getBuffer());
bool found_block = false;
// check stack for duplicate entries
bool avs = parse_check_parse_option(PO_ASSUME_LOCAL);
if (is_arg) {
lv->parseAssigned();
if (pgm->checkWarning(QP_WARN_DUPLICATE_LOCAL_VARS | QP_WARN_DUPLICATE_BLOCK_VARS) || avs) {
VNode* vnode = getVStack();
while (vnode) {
if (!found_block && vnode->isBlockStart())
found_block = true;
if (!strcmp(vnode->getName(), name)) {
if (!found_block) {
QoreStringNode* desc = new QoreStringNodeMaker("local variable '%s' was already declared in the same block", name);
if (avs) {
vnode->appendLocation(*desc);
parseException(loc, "PARSE-ERRPR", desc);
}
else {
vnode->appendLocation(*desc);
qore_program_private::makeParseWarning(getProgram(), loc, QP_WARN_DUPLICATE_BLOCK_VARS, "DUPLICATE-BLOCK-VARIABLE", desc);
}
}
else if (top_level || !vnode->isTopLevel()) {
QoreStringNode* desc = new QoreStringNodeMaker("local variable '%s' was already declared in this lexical scope", name);
vnode->appendLocation(*desc);
qore_program_private::makeParseWarning(getProgram(), loc, QP_WARN_DUPLICATE_LOCAL_VARS, "DUPLICATE-LOCAL-VARIABLE", desc);
}
break;
}
vnode = vnode->nextSearch();
}
}
}
//printd(5, "push_local_var(): pushing var %s\n", name);
new VNode(lv, &loc, n_refs, top_level);
return lv;
}