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


C++ TypeClass::setScopeType方法代码示例

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


在下文中一共展示了TypeClass::setScopeType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: walk

void ClassSpecifierAst::walk()
{
    if (checkIsNotWalking()) {
        return ;
    }

    switch (nodeType){
        case T_CCLASSSF_CLASS_ID_CLASSDECTIONLIST:{
            //std::cout << "walk in T_CCLASSSF_CLASS_ID_CLASSDECTIONLIST" << endl;
            LogiMsg::logi("walk in T_CCLASSSF_CLASS_ID_CLASSDECTIONLIST", getLineno());

            childs.at(0)->walk();
            if (checkIsNotWalking()) {
                return ;
            }

            //Scope *tmpScope = new Scope();
            if (Scope::resolveScope(s_context->tmpIdenName, Scope::SCOPE_CLASS))
            {
                /*std::cout << "error in T_CCLASSSF_CLASS_ID_CLASSDECTIONLIST: " << s_context->tmpIdenName
                << " has been defined at line " << getLineno() << std::endl;*/
                string errorStr = "error in T_CCLASSSF_CLASS_ID_CLASSDECTIONLIST: "
                + s_context->tmpIdenName + " has been defined";
                LogiMsg::logi(errorStr, getLineno());
                stopWalk();
                return ;
            }

            Scope *tmpScope = new Scope();
            tmpScope->setTotalByteSize(0);
            tmpScope->setTotalFuncByteSize(0);

            tmpScope->initClassScope(s_context->tmpIdenName);
            Scope::pushScope(Scope::s_curScope,tmpScope);
            Scope::setCurScope(tmpScope);

            childs.at(1)->walk();
            if (checkIsNotWalking()) {
                return ;
            }

            Scope::setCurScope(Scope::encloseScope(Scope::s_curScope));
            //std::cout<<"safsadfafasfsafasf"<<Scope::s_curScope->scopeName<<std::endl;

            TypeClass tmp;
            //tmp.scopeType = tmpScope;
            tmp.setScopeType(tmpScope);
            tmp.typeSfType = TypeClass::SF_INT;
            s_context->clearContext();
            s_context->tmpDeclType.clone(&tmp);
            break;
        }
        case T_CCLASSSF_CLASS_ID_IDLIST_CLASSDECTIONLIST:{
            //std::cout << "walk in T_CCLASSSF_CLASS_ID_IDLIST_CLASSDECTIONLIST" << endl;
            LogiMsg::logi("walk in T_CCLASSSF_CLASS_ID_IDLIST_CLASSDECTIONLIST", getLineno());


            childs.at(0)->walk();
            if (checkIsNotWalking()) {
                return ;
            }

            //Scope *tmpScope = new Scope();
            if (Scope::resolveScope(s_context->tmpIdenName, Scope::SCOPE_CLASS))
            {
                /*std::cout << "error in T_CCLASSSF_CLASS_ID_IDLIST_CLASSDECTIONLIST: "
                << s_context->tmpIdenName << " has been defined at line " << getLineno() << std::endl;*/
                string errorStr = "error in T_CCLASSSF_CLASS_ID_IDLIST_CLASSDECTIONLIST: "
                + s_context->tmpIdenName + " has been defined";
                LogiMsg::logi(errorStr, getLineno());

                stopWalk();
                return ;
            }

            //tmpScope->initClassScope(s_context->tmpIdenName);

            if (childs.at(1)->nodeType!=T_CTERMINATE_CIDLIST_ID)
            {
                /*std::cout << "sorry in T_CCLASSSF_CLASS_ID_IDLIST_CLASSDECTIONLIST: our compiler do not support multiple inheritance at line "
                << getLineno() << std::endl;*/
                LogiMsg::logi("sorry in T_CCLASSSF_CLASS_ID_IDLIST_CLASSDECTIONLIST: our compiler do not support multiple inheritance",
                getLineno());
                stopWalk();
                return ;
            }

            Scope *tmpScope = new Scope();

            tmpScope->initClassScope(s_context->tmpIdenName);

            childs.at(1)->walk();
            if (checkIsNotWalking()) {
                return ;
            }

            Scope *superScope = Scope::resolveScope(s_context->tmpIdenName, Scope::SCOPE_CLASS);

            if (!superScope)
            {
//.........这里部分代码省略.........
开发者ID:mengjiahao,项目名称:mycompiler,代码行数:101,代码来源:ClassSpecifierAst.cpp


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