当前位置: 首页>>代码示例>>C++>>正文


C++ VariableDeclaration::setKind方法代码示例

本文整理汇总了C++中VariableDeclaration::setKind方法的典型用法代码示例。如果您正苦于以下问题:C++ VariableDeclaration::setKind方法的具体用法?C++ VariableDeclaration::setKind怎么用?C++ VariableDeclaration::setKind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VariableDeclaration的用法示例。


在下文中一共展示了VariableDeclaration::setKind方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()));
}
开发者ID:KDE,项目名称:kdev-ruby,代码行数:34,代码来源:declarationbuilder.cpp

示例2: visitExprMax

void DeclarationBuilder::visitExprMax(ExprMaxAst* node)
{
  if (node->var)
  {
    SimpleRange range = editorFindRange(node->var, node->var);    
    VariableDeclaration *dec = openDeclaration<VariableDeclaration>(identifierForNode(node->var), range);
    dec->setKind(Declaration::Instance);
    eventuallyAssignInternalContext();
    closeDeclaration();
  }
  else
  {
    DeclarationBuilderBase::visitExprMax(node);
  }
}
开发者ID:scooterman,项目名称:kdevelop-erlang,代码行数:15,代码来源:declarationbuilder.cpp


注:本文中的VariableDeclaration::setKind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。