本文整理汇总了C++中TypeLoc::setType方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeLoc::setType方法的具体用法?C++ TypeLoc::setType怎么用?C++ TypeLoc::setType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeLoc
的用法示例。
在下文中一共展示了TypeLoc::setType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: revertDependentTypeLoc
static void revertDependentTypeLoc(TypeLoc &tl) {
// If there's no type representation, there's nothing to revert.
if (!tl.getTypeRepr())
return;
// Don't revert an error type; we've already complained.
if (tl.wasValidated() && tl.isError())
return;
// Make sure we validate the type again.
tl.setType(Type());
}
示例2: processResolveInheritedClauseEntry
void IterativeTypeChecker::processResolveInheritedClauseEntry(
TypeCheckRequest::InheritedClauseEntryPayloadType payload,
UnsatisfiedDependency unsatisfiedDependency) {
TypeResolutionOptions options;
DeclContext *dc;
TypeLoc *inherited;
std::tie(options, dc, inherited) = decomposeInheritedClauseEntry(payload);
// FIXME: Declaration validation is overkill. Sink it down into type
// resolution when it is actually needed.
if (auto nominal = dyn_cast<NominalTypeDecl>(dc))
TC.validateDeclForNameLookup(nominal);
else if (auto ext = dyn_cast<ExtensionDecl>(dc)) {
TC.validateExtension(ext);
}
// Validate the type of this inherited clause entry.
// FIXME: Recursion into existing type checker.
ProtocolRequirementTypeResolver protoResolver;
GenericTypeToArchetypeResolver archetypeResolver(dc);
GenericTypeResolver *resolver;
if (isa<ProtocolDecl>(dc)) {
resolver = &protoResolver;
} else {
resolver = &archetypeResolver;
}
if (TC.validateType(*inherited, dc, options, resolver,
&unsatisfiedDependency)) {
inherited->setInvalidType(getASTContext());
}
auto type = inherited->getType();
if (!type.isNull() && !isa<ProtocolDecl>(dc))
inherited->setType(type->mapTypeOutOfContext());
}