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


C++ Dsymbol::isModule方法代码示例

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


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

示例1: mangle_variable

    void mangle_variable(VarDeclaration *d, bool is_temp_arg_ref)
    {

        if (!(d->storage_class & (STCextern | STCgshared)))
        {
            d->error("ICE: C++ static non- __gshared non-extern variables not supported");
            assert(0);
        }

        Dsymbol *p = d->toParent();
        if (p && !p->isModule()) //for example: char Namespace1::beta[6] should be mangled as "_ZN10Namespace14betaE"
        {
            buf.writestring(global.params.isOSX ? "__ZN" : "_ZN");      // "__Z" for OSX, "_Z" for other
            prefix_name(p);
            source_name(d);
            buf.writeByte('E');
        }
        else //char beta[6] should mangle as "beta"
        {
            if (!is_temp_arg_ref)
            {
                if (global.params.isOSX)
                    buf.writeByte('_');
                buf.writestring(d->ident->toChars());
            }
            else
            {
                buf.writestring(global.params.isOSX ? "__Z" : "_Z");
                source_name(d);
            }
        }
    }
开发者ID:yeswalrus,项目名称:dmd,代码行数:32,代码来源:cppmangle.c

示例2: getFuncTemplateDecl

Module *Dsymbol::getAccessModule()
{
    //printf("Dsymbol::getAccessModule()\n");
    TemplateDeclaration *td = getFuncTemplateDecl(this);
    if (td)
        return td->getAccessModule();

    Dsymbol *s = this;
    while (s)
    {
        //printf("\ts = %s '%s'\n", s->kind(), s->toPrettyChars());
        Module *m = s->isModule();
        if (m)
            return m;
        TemplateInstance *ti = s->isTemplateInstance();
        if (ti && ti->enclosing)
            /* Because of local template instantiation, the parent isn't where the access
             * rights come from - it's the template declaration
             */
            s = ti->tempdecl;
        else
            s = s->parent;
    }
    return NULL;
}
开发者ID:Nishi,项目名称:dmd,代码行数:25,代码来源:dsymbol.c

示例3: prefix_name

    void prefix_name(Dsymbol *s)
    {
        if (!substitute(s))
        {
            store(s);
            Dsymbol *p = s->toParent();
            if (p && p->isTemplateInstance())
            {
                s = p;
                if (exist(p->isTemplateInstance()->tempdecl))
                {
                    p = NULL;
                }
                else
                {
                    p = p->toParent();
                }
            }

            if (p && !p->isModule())
            {
                prefix_name(p);
            }
            source_name(s);
        }
    }
开发者ID:yeswalrus,项目名称:dmd,代码行数:26,代码来源:cppmangle.c

示例4: load

void Import::load(Scope *sc)
{
    //printf("Import::load('%s')\n", toChars());

    // See if existing module
    DsymbolTable *dst = Package::resolve(packages, NULL, &pkg);

    Dsymbol *s = dst->lookup(id);
    if (s)
    {
#if TARGET_NET
        mod = (Module *)s;
#else
        if (s->isModule())
            mod = (Module *)s;
        else
            error("package and module have the same name");
#endif
    }

    if (!mod)
    {
        // Load module
        mod = Module::load(loc, packages, id);
        dst->insert(id, mod);           // id may be different from mod->ident,
                                        // if so then insert alias
        if (!mod->importedFrom)
            mod->importedFrom = sc ? sc->module->importedFrom : Module::rootModule;
    }
    if (!pkg)
        pkg = mod;

    //printf("-Import::load('%s'), pkg = %p\n", toChars(), pkg);
}
开发者ID:mattcaron,项目名称:gdc,代码行数:34,代码来源:import.c

示例5: cpp_mangle_name

void cpp_mangle_name(OutBuffer *buf, CppMangleState *cms, Dsymbol *s)
{
    Dsymbol *p = s->toParent();
    if (p && !p->isModule())
    {
        buf->writeByte('N');

        FuncDeclaration *fd = s->isFuncDeclaration();
        VarDeclaration *vd = s->isVarDeclaration();
        if (fd && fd->type->isConst())
        {
            buf->writeByte('K');
        }
        if (vd && !(vd->storage_class & (STCextern | STCgshared)))
        {
            s->error("C++ static non- __gshared non-extern variables not supported");
        }
        if (vd || fd)
        {
            prefix_name(buf, cms, p);
            source_name(buf, s);
        }
        else
        {
            assert(0);
        }
        buf->writeByte('E');
    }
    else
        source_name(buf, s);
}
开发者ID:yazd,项目名称:dmd,代码行数:31,代码来源:cppmangle.c

示例6: load

void Import::load(Scope *sc)
{
    //printf("Import::load('%s')\n", toChars());

    // See if existing module
    DsymbolTable *dst = Package::resolve(packages, NULL, &pkg);
#if TARGET_NET  //dot net needs modules and packages with same name
#else
    if (pkg && pkg->isModule())
    {
        ::error(loc, "can only import from a module, not from a member of module %s. Did you mean `import %s : %s`?",
             pkg->toChars(), pkg->toPrettyChars(), id->toChars());
        mod = pkg->isModule(); // Error recovery - treat as import of that module
        return;
    }
#endif
    Dsymbol *s = dst->lookup(id);
    if (s)
    {
#if TARGET_NET
        mod = (Module *)s;
#else
        if (s->isModule())
            mod = (Module *)s;
        else
        {
            if (pkg)
            {
                ::error(loc, "can only import from a module, not from package %s.%s",
                    pkg->toPrettyChars(), id->toChars());
            }
            else
            {
                ::error(loc, "can only import from a module, not from package %s",
                    id->toChars());
            }
        }
#endif
    }

    if (!mod)
    {
        // Load module
        mod = Module::load(loc, packages, id);
        if (mod)
        {
            dst->insert(id, mod);           // id may be different from mod->ident,
                                            // if so then insert alias
            if (!mod->importedFrom)
                mod->importedFrom = sc ? sc->module->importedFrom : Module::rootModule;
        }
    }
    if (!pkg)
        pkg = mod;

    //printf("-Import::load('%s'), pkg = %p\n", toChars(), pkg);
}
开发者ID:jsmdnq,项目名称:dmd,代码行数:57,代码来源:import.c

示例7: prefix_name

 void prefix_name(Dsymbol *s)
 {
     if (substitute(s))
         return;
     Dsymbol *p = s->toParent();
     if (p && !p->isModule())
         prefix_name(p);
     source_name(s);
     store(s);
 }
开发者ID:Arpit007,项目名称:GDC,代码行数:10,代码来源:cppmangle.c

示例8: prefix_name

void prefix_name(OutBuffer *buf, CppMangleState *cms, Dsymbol *s)
{
    if (!cms->substitute(buf, s))
    {
        Dsymbol *p = s->toParent();
        if (p && !p->isModule())
        {
            prefix_name(buf, cms, p);
        }
        source_name(buf, s);
    }
}
开发者ID:MessiahAndrw,项目名称:dmd,代码行数:12,代码来源:cppmangle.c

示例9: Package

DsymbolTable *Package::resolve(Identifiers *packages, Dsymbol **pparent, Package **ppkg)
{
    DsymbolTable *dst = Module::modules;
    Dsymbol *parent = NULL;

    //printf("Package::resolve()\n");
    if (ppkg)
        *ppkg = NULL;

    if (packages)
    {
        for (size_t i = 0; i < packages->dim; i++)
        {   Identifier *pid = packages->tdata()[i];
            Dsymbol *p;

            p = dst->lookup(pid);
            if (!p)
            {
                p = new Package(pid);
                dst->insert(p);
                p->parent = parent;
                ((ScopeDsymbol *)p)->symtab = new DsymbolTable();
            }
            else
            {
                assert(p->isPackage());
                // It might already be a module, not a package, but that needs
                // to be checked at a higher level, where a nice error message
                // can be generated.
                // dot net needs modules and packages with same name
            }
            parent = p;
            dst = ((Package *)p)->symtab;
            if (ppkg && !*ppkg)
                *ppkg = (Package *)p;
#if TARGET_NET
#else
            if (p->isModule())
            {   // Return the module so that a nice error message can be generated
                if (ppkg)
                    *ppkg = (Package *)p;
                break;
            }
#endif
        }
        if (pparent)
        {
            *pparent = parent;
        }
    }
    return dst;
}
开发者ID:dansanduleac,项目名称:ldc,代码行数:52,代码来源:module.c

示例10: Package

DsymbolTable *Package::resolve(Array *packages, Dsymbol **pparent, Package **ppkg)
{
    DsymbolTable *dst = Module::modules;
    Dsymbol *parent = NULL;

    //printf("Package::resolve()\n");
    if (ppkg)
        *ppkg = NULL;

    if (packages)
    {   int i;

        for (i = 0; i < packages->dim; i++)
        {   Identifier *pid = (Identifier *)packages->data[i];
            Dsymbol *p;

            p = dst->lookup(pid);
            if (!p)
            {
                p = new Package(pid);
                dst->insert(p);
                p->parent = parent;
                ((ScopeDsymbol *)p)->symtab = new DsymbolTable();
            }
            else
            {
                assert(p->isPackage());
#if TARGET_NET  //dot net needs modules and packages with same name
#else
                if (p->isModule())
                {   p->error("module and package have the same name");
                    fatal();
                    break;
                }
#endif
            }
            parent = p;
            dst = ((Package *)p)->symtab;
            if (ppkg && !*ppkg)
                *ppkg = (Package *)p;
        }
        if (pparent)
        {
            *pparent = parent;
        }
    }
    return dst;
}
开发者ID:smunix,项目名称:ldc,代码行数:48,代码来源:module.c

示例11: while

Module *Dsymbol::getModule()
{
    //printf("Dsymbol::getModule()\n");
    if (TemplateInstance *ti = isInstantiated())
        return ti->tempdecl->getModule();

    Dsymbol *s = this;
    while (s)
    {
        //printf("\ts = %s '%s'\n", s->kind(), s->toPrettyChars());
        Module *m = s->isModule();
        if (m)
            return m;
        s = s->parent;
    }
    return NULL;
}
开发者ID:eco,项目名称:dmd,代码行数:17,代码来源:dsymbol.c

示例12: while

Module *Dsymbol::getModule()
{
    Module *m;
    Dsymbol *s;

    //printf("Dsymbol::getModule()\n");
    s = this;
    while (s)
    {
        //printf("\ts = '%s'\n", s->toChars());
        m = s->isModule();
        if (m)
            return m;
        s = s->parent;
    }
    return NULL;
}
开发者ID:apriori,项目名称:dsss,代码行数:17,代码来源:dsymbol.c

示例13: isDataseg

int VarDeclaration::isDataseg()
{
#if 0
    printf("VarDeclaration::isDataseg(%p, '%s')\n", this, toChars());
    printf("%llx, %p, %p\n", storage_class & (STCstatic | STCconst), parent->isModule(), parent->isTemplateInstance());
    printf("parent = '%s'\n", parent->toChars());
#endif
    Dsymbol *parent = this->toParent();
    if (!parent && !(storage_class & (STCstatic | STCconst)))
    {   error("forward referenced");
        type = Type::terror;
        return 0;
    }
    return (storage_class & (STCstatic | STCconst) ||
           parent->isModule() ||
           parent->isTemplateInstance());
}
开发者ID:smunix,项目名称:ldc,代码行数:17,代码来源:declaration.c

示例14: cpp_mangle_name

void cpp_mangle_name(OutBuffer *buf, CppMangleState *cms, Dsymbol *s)
{
    Dsymbol *p = s->toParent();
    if (p && !p->isModule())
    {
        buf->writeByte('N');

        FuncDeclaration *fd = s->isFuncDeclaration();
        if (fd->isConst())
            buf->writeByte('K');

        prefix_name(buf, cms, p);
        source_name(buf, s);

        buf->writeByte('E');
    }
    else
        source_name(buf, s);
}
开发者ID:DinrusGroup,项目名称:DRC,代码行数:19,代码来源:cppmangle.c

示例15: while

Module *Dsymbol::getCompilationModule()
{
    Module *m;
    TemplateInstance *ti;
    Dsymbol *s;

    //printf("Dsymbol::getModule()\n");
    s = this;
    while (s)
    {
        //printf("\ts = '%s'\n", s->toChars());
        m = s->isModule();
        if (m)
            return m;
        ti = s->isTemplateInstance();
        if (ti && ti->tmodule)
            return ti->tmodule;
        s = s->parent;
    }
    return NULL;
}
开发者ID:olgk,项目名称:ldc,代码行数:21,代码来源:dsymbol.c


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