Ejemplo n.º 1
0
    void visit(Dsymbol *s)
    {
    #if 0
        printf("Dsymbol::mangle() '%s'", s->toChars());
        if (s->parent)
            printf("  parent = %s %s", s->parent->kind(), s->parent->toChars());
        printf("\n");
    #endif

        mangleParent(s);

        char *id = s->ident ? s->ident->toChars() : s->toChars();
        toBuffer(id, s);

        //printf("Dsymbol::mangle() %s = %s\n", s->toChars(), id);
    }
Ejemplo n.º 2
0
void mangleDecl(OutBuffer *buf, Declaration *sthis)
{
    mangleParent(buf, sthis);

    assert(sthis->ident);
    const char *id = sthis->ident->toChars();
    buf->printf("%llu%s", (ulonglong)strlen(id), id);

    if (FuncDeclaration *fd = sthis->isFuncDeclaration())
    {
        mangleFunc(buf, fd, false);
    }
    else if (sthis->type->deco)
    {
        buf->writestring(sthis->type->deco);
    }
    else
        assert(0);
}
Ejemplo n.º 3
0
    void visit(Dsymbol *s)
    {
    #if 0
        printf("Dsymbol::mangle() '%s'", s->toChars());
        if (s->parent)
            printf("  parent = %s %s", s->parent->kind(), s->parent->toChars());
        printf("\n");
    #endif

        OutBuffer buf;
        mangleParent(&buf, s);

        char *id = s->ident ? s->ident->toChars() : s->toChars();
        buf.printf("%llu%s", (ulonglong)strlen(id), id);
        id = buf.extractString();

        //printf("Dsymbol::mangle() %s = %s\n", s->toChars(), id);
        result = id;
    }
Ejemplo n.º 4
0
    void mangleDecl(Declaration *sthis)
    {
        mangleParent(sthis);

        assert(sthis->ident);
        const char *id = sthis->ident->toChars();
        toBuffer(id, sthis);

        if (FuncDeclaration *fd = sthis->isFuncDeclaration())
        {
            mangleFunc(fd, false);
        }
        else if (sthis->type->deco)
        {
            buf->writestring(sthis->type->deco);
        }
        else
            assert(0);
    }
Ejemplo n.º 5
0
    void visit(TemplateInstance *ti)
    {
    #if 0
        printf("TemplateInstance::mangle() %p %s", ti, ti->toChars());
        if (ti->parent)
            printf("  parent = %s %s", ti->parent->kind(), ti->parent->toChars());
        printf("\n");
    #endif

        if (!ti->tempdecl)
            ti->error("is not defined");
        else
            mangleParent(ti);

        ti->getIdent();
        const char *id = ti->ident ? ti->ident->toChars() : ti->toChars();
        toBuffer(id, ti);

        //printf("TemplateInstance::mangle() %s = %s\n", ti->toChars(), ti->id);
    }
Ejemplo n.º 6
0
    void visit(TemplateInstance *ti)
    {
    #if 0
        printf("TemplateInstance::mangle() %p %s", ti, ti->toChars());
        if (ti->parent)
            printf("  parent = %s %s", ti->parent->kind(), ti->parent->toChars());
        printf("\n");
    #endif

        OutBuffer buf;
        if (!ti->tempdecl)
            ti->error("is not defined");
        else
            mangleParent(&buf, ti);

        ti->getIdent();
        const char *id = ti->ident ? ti->ident->toChars() : ti->toChars();
        buf.printf("%llu%s", (ulonglong)strlen(id), id);
        id = buf.extractString();

        //printf("TemplateInstance::mangle() %s = %s\n", ti->toChars(), ti->id);
        result = id;
    }
Ejemplo n.º 7
0
void mangleParent(OutBuffer *buf, Dsymbol *s)
{
    Dsymbol *p;
    if (TemplateInstance *ti = s->isTemplateInstance())
        p = ti->isTemplateMixin() ? ti->parent : ti->tempdecl->parent;
    else
        p = s->parent;

    if (p)
    {
        mangleParent(buf, p);

        if (p->getIdent())
        {
            const char *id = p->ident->toChars();
            buf->printf("%llu%s", (ulonglong)strlen(id), id);

            if (FuncDeclaration *f = p->isFuncDeclaration())
                mangleFunc(buf, f, true);
        }
        else
            buf->writeByte('0');
    }
}
Ejemplo n.º 8
0
    void mangleParent(Dsymbol *s)
    {
        Dsymbol *p;
        if (TemplateInstance *ti = s->isTemplateInstance())
            p = ti->isTemplateMixin() ? ti->parent : ti->tempdecl->parent;
        else
            p = s->parent;

        if (p)
        {
            mangleParent(p);

            if (p->getIdent())
            {
                const char *id = p->ident->toChars();
                toBuffer(id, s);

                if (FuncDeclaration *f = p->isFuncDeclaration())
                    mangleFunc(f, true);
            }
            else
                buf->writeByte('0');
        }
    }