Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

Changeset 793

Show
Ignore:
Timestamp:
12/08/10 08:42:30 (14 years ago)
Author:
walter
Message:

Brad's fix for fail278 regression

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dmd-1.x/src/mangle.c

    r777 r793  
    196196        ident == Id::TypeInfo_Struct   || 
    197197        ident == Id::TypeInfo_Class    || 
    198198        ident == Id::TypeInfo_Typedef  || 
    199199        ident == Id::TypeInfo_Tuple || 
    200200        this == object     || 
    201201        this == classinfo  || 
    202202        this == Module::moduleinfo || 
    203203        memcmp(ident->toChars(), "TypeInfo_", 9) == 0 
    204204       ) 
    205205        parent = NULL; 
    206206 
    207207    char *id = Dsymbol::mangle(); 
    208208    parent = parentsave; 
    209209    return id; 
    210210} 
    211211 
    212212 
    213213char *TemplateInstance::mangle() 
    214214{ 
    215215    OutBuffer buf; 
    216     char *id; 
    217216 
    218217#if 0 
    219218    printf("TemplateInstance::mangle() %s", toChars()); 
    220219    if (parent) 
    221220        printf("  parent = %s %s", parent->kind(), parent->toChars()); 
    222221    printf("\n"); 
    223222#endif 
    224     id = ident ? ident->toChars() : toChars(); 
    225     Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent; 
     223    char *id = ident ? ident->toChars() : toChars(); 
    226224    if (!tempdecl) 
    227225        error("is not defined"); 
    228     else if (par) 
    229     { 
    230         char *p = par->mangle(); 
    231         if (p[0] == '_' && p[1] == 'D') 
    232             p += 2; 
    233         buf.writestring(p); 
     226    else 
     227    { 
     228        Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent; 
     229        if (par) 
     230        { 
     231            char *p = par->mangle(); 
     232            if (p[0] == '_' && p[1] == 'D') 
     233                p += 2; 
     234            buf.writestring(p); 
     235        } 
    234236    } 
    235237    buf.printf("%zu%s", strlen(id), id); 
    236238    id = buf.toChars(); 
    237239    buf.data = NULL; 
    238240    //printf("TemplateInstance::mangle() %s = %s\n", toChars(), id); 
    239241    return id; 
    240242} 
    241243 
    242244 
    243245 
    244246char *Dsymbol::mangle() 
    245247{ 
    246248    OutBuffer buf; 
    247249    char *id; 
    248250 
    249251#if 0 
    250252    printf("Dsymbol::mangle() '%s'", toChars()); 
    251253    if (parent) 
    252254        printf("  parent = %s %s", parent->kind(), parent->toChars()); 
    253255    printf("\n"); 
  • trunk/src/mangle.c

    r777 r793  
    11 
    22// Compiler implementation of the D programming language 
    3 // Copyright (c) 1999-2009 by Digital Mars 
     3// Copyright (c) 1999-2010 by Digital Mars 
    44// All Rights Reserved 
    55// written by Walter Bright 
    66// http://www.digitalmars.com 
    77// License for redistribution is by either the Artistic License 
    88// in artistic.txt, or the GNU General Public License in gnu.txt. 
    99// See the included readme.txt for details. 
    1010 
    1111#include <stdio.h> 
    1212#include <string.h> 
    1313#include <ctype.h> 
    1414#include <assert.h> 
    1515 
    1616#include "root.h" 
    1717 
    1818#include "init.h" 
    1919#include "declaration.h" 
    2020#include "aggregate.h" 
    2121#include "mtype.h" 
    2222#include "attrib.h" 
    2323#include "template.h" 
     
    196196        ident == Id::TypeInfo_Struct   || 
    197197        ident == Id::TypeInfo_Class    || 
    198198        ident == Id::TypeInfo_Typedef  || 
    199199        ident == Id::TypeInfo_Tuple || 
    200200        this == object     || 
    201201        this == classinfo  || 
    202202        this == Module::moduleinfo || 
    203203        memcmp(ident->toChars(), "TypeInfo_", 9) == 0 
    204204       ) 
    205205        parent = NULL; 
    206206 
    207207    char *id = Dsymbol::mangle(); 
    208208    parent = parentsave; 
    209209    return id; 
    210210} 
    211211 
    212212 
    213213char *TemplateInstance::mangle() 
    214214{ 
    215215    OutBuffer buf; 
    216     char *id; 
    217216 
    218217#if 0 
    219218    printf("TemplateInstance::mangle() %p %s", this, toChars()); 
    220219    if (parent) 
    221220        printf("  parent = %s %s", parent->kind(), parent->toChars()); 
    222221    printf("\n"); 
    223222#endif 
    224     id = ident ? ident->toChars() : toChars(); 
    225     Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent; 
     223    char *id = ident ? ident->toChars() : toChars(); 
    226224    if (!tempdecl) 
    227225        error("is not defined"); 
    228     else if (par) 
    229     { 
    230         char *p = par->mangle(); 
    231         if (p[0] == '_' && p[1] == 'D') 
    232             p += 2; 
    233         buf.writestring(p); 
     226    else 
     227    { 
     228        Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent; 
     229        if (par) 
     230        { 
     231            char *p = par->mangle(); 
     232            if (p[0] == '_' && p[1] == 'D') 
     233                p += 2; 
     234            buf.writestring(p); 
     235        } 
    234236    } 
    235237    buf.printf("%zu%s", strlen(id), id); 
    236238    id = buf.toChars(); 
    237239    buf.data = NULL; 
    238240    //printf("TemplateInstance::mangle() %s = %s\n", toChars(), id); 
    239241    return id; 
    240242} 
    241243 
    242244 
    243245 
    244246char *Dsymbol::mangle() 
    245247{ 
    246248    OutBuffer buf; 
    247249    char *id; 
    248250 
    249251#if 0 
    250252    printf("Dsymbol::mangle() '%s'", toChars()); 
    251253    if (parent) 
    252254        printf("  parent = %s %s", parent->kind(), parent->toChars()); 
    253255    printf("\n");