本文整理汇总了C++中FullySpecifiedType::isFunctionType方法的典型用法代码示例。如果您正苦于以下问题:C++ FullySpecifiedType::isFunctionType方法的具体用法?C++ FullySpecifiedType::isFunctionType怎么用?C++ FullySpecifiedType::isFunctionType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FullySpecifiedType
的用法示例。
在下文中一共展示了FullySpecifiedType::isFunctionType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: iconTypeForSymbol
Icons::IconType Icons::iconTypeForSymbol(const Symbol *symbol)
{
if (const Template *templ = symbol->asTemplate()) {
if (Symbol *decl = templ->declaration())
return iconTypeForSymbol(decl);
}
FullySpecifiedType symbolType = symbol->type();
if (symbol->isFunction() || (symbol->isDeclaration() && symbolType &&
symbolType->isFunctionType()))
{
const Function *function = symbol->asFunction();
if (!function)
function = symbol->type()->asFunctionType();
if (function->isSlot()) {
if (function->isPublic())
return SlotPublicIconType;
else if (function->isProtected())
return SlotProtectedIconType;
else if (function->isPrivate())
return SlotPrivateIconType;
} else if (function->isSignal()) {
return SignalIconType;
} else if (symbol->isPublic()) {
return FuncPublicIconType;
} else if (symbol->isProtected()) {
return FuncProtectedIconType;
} else if (symbol->isPrivate()) {
return FuncPrivateIconType;
}
} else if (symbol->enclosingScope() && symbol->enclosingScope()->isEnum()) {
return EnumeratorIconType;
} else if (symbol->isDeclaration() || symbol->isArgument()) {
if (symbol->isPublic())
return VarPublicIconType;
else if (symbol->isProtected())
return VarProtectedIconType;
else if (symbol->isPrivate())
return VarPrivateIconType;
} else if (symbol->isEnum()) {
return EnumIconType;
} else if (symbol->isClass() || symbol->isForwardClassDeclaration()) {
return ClassIconType;
} else if (symbol->isObjCClass() || symbol->isObjCForwardClassDeclaration()) {
return ClassIconType;
} else if (symbol->isObjCProtocol() || symbol->isObjCForwardProtocolDeclaration()) {
return ClassIconType;
} else if (symbol->isObjCMethod()) {
return FuncPublicIconType;
} else if (symbol->isNamespace()) {
return NamespaceIconType;
} else if (symbol->isTypenameArgument()) {
return ClassIconType;
} else if (symbol->isUsingNamespaceDirective() ||
symbol->isUsingDeclaration()) {
// TODO: Might be nice to have a different icons for these things
return NamespaceIconType;
}
return UnknownIconType;
}
示例2: visit
bool CheckDeclaration::visit(FunctionDefinitionAST *ast)
{
FullySpecifiedType ty = semantic()->check(ast->decl_specifier_seq, _scope);
FullySpecifiedType qualTy = ty.qualifiedType();
Name *name = 0;
FullySpecifiedType funTy = semantic()->check(ast->declarator, qualTy,
_scope, &name);
if (! (funTy && funTy->isFunctionType())) {
translationUnit()->error(ast->firstToken(),
"expected a function prototype");
return false;
}
Function *fun = funTy->asFunctionType();
fun->setVirtual(ty.isVirtual());
fun->setStartOffset(tokenAt(ast->firstToken()).offset);
fun->setEndOffset(tokenAt(ast->lastToken()).offset);
if (ast->declarator)
fun->setSourceLocation(ast->declarator->firstToken());
fun->setName(name);
fun->setTemplateParameters(_templateParameters);
fun->setVisibility(semantic()->currentVisibility());
fun->setMethodKey(semantic()->currentMethodKey());
const bool isQ_SLOT = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SLOT;
const bool isQ_SIGNAL = ast->qt_invokable_token && tokenKind(ast->qt_invokable_token) == T_Q_SIGNAL;
if (isQ_SIGNAL)
fun->setMethodKey(Function::SignalMethod);
else if (isQ_SLOT)
fun->setMethodKey(Function::SlotMethod);
checkFunctionArguments(fun);
ast->symbol = fun;
_scope->enterSymbol(fun);
if (! semantic()->skipFunctionBodies()) {
if (ast->ctor_initializer) {
bool looksLikeCtor = false;
if (ty.isValid() || ! fun->identity())
looksLikeCtor = false;
else if (fun->identity()->isNameId() || fun->identity()->isTemplateNameId())
looksLikeCtor = true;
if (! looksLikeCtor) {
translationUnit()->error(ast->ctor_initializer->firstToken(),
"only constructors take base initializers");
}
accept(ast->ctor_initializer);
}
const int previousVisibility = semantic()->switchVisibility(Symbol::Public);
const int previousMethodKey = semantic()->switchMethodKey(Function::NormalMethod);
semantic()->check(ast->function_body, fun->members());
semantic()->switchMethodKey(previousMethodKey);
semantic()->switchVisibility(previousVisibility);
}
return false;
}
示例3: elementTypeFromSymbol
SymbolInfo::ElementType SymbolInfo::elementTypeFromSymbol( const CPlusPlus::Symbol *symbol )
{
if (const Template *templ = symbol->asTemplate()) {
if (Symbol *decl = templ->declaration())
return elementTypeFromSymbol(decl);
}
FullySpecifiedType symbolType = symbol->type();
if (symbol->isFunction() || (symbol->isDeclaration() && symbolType &&
symbolType->isFunctionType()))
{
const CPlusPlus::Function *func = symbol->asFunction();
if (!func)
func = symbol->type()->asFunctionType();
if (func->isSlot() ) {
if (func->isPublic())
return SymbolInfo::SlotPublic;
else if (func->isProtected())
return SymbolInfo::SlotProtected;
else if (func->isPrivate())
return SymbolInfo::SlotPrivate;
} else if (func->isSignal()) {
return SymbolInfo::Signal;
} else if (symbol->isPublic()) {
return SymbolInfo::FuncPublic;
} else if (symbol->isProtected()) {
return SymbolInfo::FuncProtected;
} else if (symbol->isPrivate()) {
return SymbolInfo::FuncPrivate;
}
} else if (symbol->enclosingScope() && symbol->enclosingScope()->isEnum()) {
return SymbolInfo::Enumerator;
} else if (symbol->isDeclaration() || symbol->isArgument()) {
if (symbol->isPublic())
return SymbolInfo::VarPublic;
else if (symbol->isProtected())
return SymbolInfo::VarProtected;
else if (symbol->isPrivate())
return SymbolInfo::VarPrivate;
} else if (symbol->isEnum()) {
return SymbolInfo::Enum;
} else if (symbol->isClass() || symbol->isForwardClassDeclaration()) {
return SymbolInfo::Class;
} else if (symbol->isObjCClass() || symbol->isObjCForwardClassDeclaration()) {
return SymbolInfo::Class;
} else if (symbol->isObjCProtocol() || symbol->isObjCForwardProtocolDeclaration()) {
return SymbolInfo::Class;
} else if (symbol->isObjCMethod()) {
return SymbolInfo::FuncPublic;
} else if (symbol->isNamespace()) {
return SymbolInfo::Namespace;
} else if (symbol->isTypenameArgument()) {
return SymbolInfo::Class;
} else if (symbol->isUsingNamespaceDirective() ||
symbol->isUsingDeclaration()) {
// TODO: Might be nice to have a different icons for these things
return SymbolInfo::Namespace;
} else if (symbol->isBlock()){
return SymbolInfo::Block;
}
return SymbolInfo::Unknown;
}