本文整理汇总了C++中ExprNode::prep方法的典型用法代码示例。如果您正苦于以下问题:C++ ExprNode::prep方法的具体用法?C++ ExprNode::prep怎么用?C++ ExprNode::prep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExprNode
的用法示例。
在下文中一共展示了ExprNode::prep方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prep
ExprType ExprLocalFunctionNode::prep(bool wantScalar, ExprVarEnvBuilder& envBuilder) {
#if 0 // TODO: no local functions for now
bool error = false;
// prep prototype and check for errors
ExprPrototypeNode* prototype = (ExprPrototypeNode*)child(0);
ExprVarEnv functionEnv;
functionEnv.resetAndSetParent(&env);
if (!prototype->prep(false, functionEnv).isValid()) error = true;
// decide what return type we want
bool returnWantsScalar = false;
if (!error && prototype->isReturnTypeSet()) returnWantsScalar = prototype->returnType().isFP(1);
// prep block and check for errors
ExprNode* block = child(1);
ExprType blockType = block->prep(returnWantsScalar, functionEnv);
if (!error && blockType.isValid()) {
if (prototype->isReturnTypeSet()) {
if (blockType != prototype->returnType()) {
checkCondition(false,
"In function result of block '" + blockType.toString() +
"' does not match given return type " + prototype->returnType().toString(),
error);
}
} else
prototype->setReturnType(blockType);
// register the function in the symbol table
env.addFunction(prototype->name(), this);
} else {
checkCondition(false, "Invalid type for blockType is " + blockType.toString(), error);
error = true;
}
return _type = error ? ExprType().Error() : ExprType().None().Varying();
#else
bool error=false;
checkCondition(false,"Local functions are currently not supported.",error);
return ExprType().Error();
#endif
}