本文整理汇总了C++中VariableDeclaration::setVariableKind方法的典型用法代码示例。如果您正苦于以下问题:C++ VariableDeclaration::setVariableKind方法的具体用法?C++ VariableDeclaration::setVariableKind怎么用?C++ VariableDeclaration::setVariableKind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VariableDeclaration
的用法示例。
在下文中一共展示了VariableDeclaration::setVariableKind方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visitAliasStatement
void DeclarationBuilder::visitAliasStatement(Ast *node)
{
Ast *right = new Ast(node->tree->r, node->context);
QualifiedIdentifier id = QualifiedIdentifier(QString(right->tree->name));
const RangeInRevision &range = editorFindRange(right, right);
DeclarationPointer decl = getDeclaration(id, range, DUContextPointer(currentContext()));
if (is_global_var(node->tree->l) && is_global_var(right->tree)) {
DUChainWriteLocker wlock;
// If the global variable on the right is not declared, declare it as nil
if (!decl) {
AbstractType::Ptr type = topContext()->findDeclarations(QualifiedIdentifier("NilClass")).first()->abstractType();
VariableDeclaration *vDecl = openDefinition<VariableDeclaration>(id, range);
vDecl->setVariableKind(right->tree);
vDecl->setKind(Declaration::Instance);
vDecl->setType(type);
eventuallyAssignInternalContext();
DeclarationBuilderBase::closeDeclaration();
decl = vDecl;
}
node->tree = node->tree->l;
QualifiedIdentifier aid = getIdentifier(node);
AbstractType::Ptr type = decl->abstractType();
declareVariable(aid, type, node);
} else if (decl && decl->isFunctionDeclaration()) {
DUChainWriteLocker wlock;
MethodDeclaration *md = dynamic_cast<MethodDeclaration *>(decl.data());
node->tree = node->tree->l;
const RangeInRevision & arange = editorFindRange(node, node);
QualifiedIdentifier aid = getIdentifier(node);
aliasMethodDeclaration(aid, arange, md);
} else
appendProblem(node->tree, i18n("undefined method `%1'", id.toString()));
}