本文整理汇总了C++中SyntaxTree::hasChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ SyntaxTree::hasChildren方法的具体用法?C++ SyntaxTree::hasChildren怎么用?C++ SyntaxTree::hasChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxTree
的用法示例。
在下文中一共展示了SyntaxTree::hasChildren方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compile
//.........这里部分代码省略.........
mnRequiredRegisters.push(0);
std::list<SyntaxTree*>::const_iterator it;
for (it = tree.getChildren().begin(); it != tree.getChildren().end(); it++) {
if ((*it)->type == SyntaxTree::TYPE_ARGUMENT)
mNamesStack.push_back((*it)->str);
else {// BLOCK
compile(**it, output, target);
output.set(regIndex, mnRequiredRegisters.top());
}
}
// return nil (Rollback)
output << OP_RETURN_NIL;
output.set(jumpPos, (index_t) output.getSize());
while (mNamesStack.size() > mActivationFramePointer.top())
mNamesStack.pop_back();
mnRequiredRegisters.pop();
mActivationFramePointer.pop();
return loc;
}
case SyntaxTree::TYPE_RETURN:
{
if (mDeclareOnly.top()) {
compile(*tree.left(), output, 0);
return target;
}
if (tree.hasChildren()) {
location_t result = compile(*tree.left(), output, target);
output << OP_RETURN << result;
return result;
} else {
output << OP_RETURN_NIL;
return target;
}
}
case SyntaxTree::TYPE_FUNCTION_CALL:
{
if (mDeclareOnly.top()) {
std::list<SyntaxTree*>::const_iterator it;
for (it = tree.getChildren().begin(); it != tree.getChildren().end(); it++)
compile(**it, output, -1);
return target;
}
// Lookup for the callable in the names stack
OpCode callOp = OP_CALL_SF_G;
location_t loc = 0; // useless initialization
HostFunctionGroupID hfgID = 0;
FunctionID fID = 0;
if (findLocalName(tree.str, loc))
callOp = OP_CALL_SF_L;
else {
map<string, location_t>::const_iterator sfit = mScriptFunctionsLocations.find(tree.str);
if (sfit == mScriptFunctionsLocations.end()) {
HostFunctionsMap::const_iterator hfit = mHostFunctionsMap.find(tree.str);
if (hfit != mHostFunctionsMap.end()) {
callOp = OP_CALL_HF;