本文整理汇总了C++中TypeLoc::setInvalidType方法的典型用法代码示例。如果您正苦于以下问题:C++ TypeLoc::setInvalidType方法的具体用法?C++ TypeLoc::setInvalidType怎么用?C++ TypeLoc::setInvalidType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TypeLoc
的用法示例。
在下文中一共展示了TypeLoc::setInvalidType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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.validateDecl(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.
PartialGenericTypeToArchetypeResolver resolver;
if (TC.validateType(*inherited, dc, options, &resolver)) {
inherited->setInvalidType(getASTContext());
}
}
示例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());
}