本文整理汇总了C++中FunctionType::GetReturnType方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionType::GetReturnType方法的具体用法?C++ FunctionType::GetReturnType怎么用?C++ FunctionType::GetReturnType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionType
的用法示例。
在下文中一共展示了FunctionType::GetReturnType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Visit
void TypeDeduction::Visit(NewRunnerExpression* node)
{
node->GetTarget()->Accept(this);
std::vector<Expression *> *arguments = node->GetArgumentList();
for (std::vector<Expression *>::iterator it = arguments->begin(); it != arguments->end(); ++it)
{
Expression *arg = *it;
arg->Accept(this);
//TODO: Check the parameter types, and do implicit conversion if needed
}
std::vector<Expression *> *usingRanges = node->GetUsingList();
for (std::vector<Expression *>::iterator it = usingRanges->begin(); it != usingRanges->end(); ++it)
{
Expression *expr = *it;
expr->Accept(this);
}
std::vector<Expression *> *watchingRanges = node->GetWatchingList();
for (std::vector<Expression *>::iterator it = watchingRanges->begin(); it != watchingRanges->end(); ++it)
{
Expression *expr = *it;
expr->Accept(this);
}
std::vector<Expression *> *space = node->GetSpace();
for (std::vector<Expression *>::iterator it = space->begin(); it != space->end(); ++it)
{
Expression *expr = *it;
expr->Accept(this);
}
FunctionType *funcType = dynamic_cast<FunctionType *>(node->GetTarget()->GetTag<Type>("Type"));
if (funcType == NULL)
{
CompilationContext::GetInstance()->ReportError(node->SourceLocation, false, "Requires a function type.");
}
if (!funcType->GetReturnType()->Equals(new VoidType()))
{
CompilationContext::GetInstance()->ReportError(node->SourceLocation, false, "Runner function cannot have return value.");
}
node->SetTag<Type>("Type", funcType->GetReturnType());
}
示例2: GetType
Type* CallExpression::GetType()
{
FunctionType *type = dynamic_cast<FunctionType *>(_target->GetType());
return type->GetReturnType();
}