Changeset 793
- Timestamp:
- 12/08/10 08:42:30 (14 years ago)
- Files:
-
- branches/dmd-1.x/src/mangle.c (modified) (1 diff)
- trunk/src/mangle.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/mangle.c
r777 r793 196 196 ident == Id::TypeInfo_Struct || 197 197 ident == Id::TypeInfo_Class || 198 198 ident == Id::TypeInfo_Typedef || 199 199 ident == Id::TypeInfo_Tuple || 200 200 this == object || 201 201 this == classinfo || 202 202 this == Module::moduleinfo || 203 203 memcmp(ident->toChars(), "TypeInfo_", 9) == 0 204 204 ) 205 205 parent = NULL; 206 206 207 207 char *id = Dsymbol::mangle(); 208 208 parent = parentsave; 209 209 return id; 210 210 } 211 211 212 212 213 213 char *TemplateInstance::mangle() 214 214 { 215 215 OutBuffer buf; 216 char *id;217 216 218 217 #if 0 219 218 printf("TemplateInstance::mangle() %s", toChars()); 220 219 if (parent) 221 220 printf(" parent = %s %s", parent->kind(), parent->toChars()); 222 221 printf("\n"); 223 222 #endif 224 id = ident ? ident->toChars() : toChars(); 225 Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent; 223 char *id = ident ? ident->toChars() : toChars(); 226 224 if (!tempdecl) 227 225 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 } 234 236 } 235 237 buf.printf("%zu%s", strlen(id), id); 236 238 id = buf.toChars(); 237 239 buf.data = NULL; 238 240 //printf("TemplateInstance::mangle() %s = %s\n", toChars(), id); 239 241 return id; 240 242 } 241 243 242 244 243 245 244 246 char *Dsymbol::mangle() 245 247 { 246 248 OutBuffer buf; 247 249 char *id; 248 250 249 251 #if 0 250 252 printf("Dsymbol::mangle() '%s'", toChars()); 251 253 if (parent) 252 254 printf(" parent = %s %s", parent->kind(), parent->toChars()); 253 255 printf("\n"); trunk/src/mangle.c
r777 r793 1 1 2 2 // Compiler implementation of the D programming language 3 // Copyright (c) 1999-20 09by Digital Mars3 // Copyright (c) 1999-2010 by Digital Mars 4 4 // All Rights Reserved 5 5 // written by Walter Bright 6 6 // http://www.digitalmars.com 7 7 // License for redistribution is by either the Artistic License 8 8 // in artistic.txt, or the GNU General Public License in gnu.txt. 9 9 // See the included readme.txt for details. 10 10 11 11 #include <stdio.h> 12 12 #include <string.h> 13 13 #include <ctype.h> 14 14 #include <assert.h> 15 15 16 16 #include "root.h" 17 17 18 18 #include "init.h" 19 19 #include "declaration.h" 20 20 #include "aggregate.h" 21 21 #include "mtype.h" 22 22 #include "attrib.h" 23 23 #include "template.h" … … 196 196 ident == Id::TypeInfo_Struct || 197 197 ident == Id::TypeInfo_Class || 198 198 ident == Id::TypeInfo_Typedef || 199 199 ident == Id::TypeInfo_Tuple || 200 200 this == object || 201 201 this == classinfo || 202 202 this == Module::moduleinfo || 203 203 memcmp(ident->toChars(), "TypeInfo_", 9) == 0 204 204 ) 205 205 parent = NULL; 206 206 207 207 char *id = Dsymbol::mangle(); 208 208 parent = parentsave; 209 209 return id; 210 210 } 211 211 212 212 213 213 char *TemplateInstance::mangle() 214 214 { 215 215 OutBuffer buf; 216 char *id;217 216 218 217 #if 0 219 218 printf("TemplateInstance::mangle() %p %s", this, toChars()); 220 219 if (parent) 221 220 printf(" parent = %s %s", parent->kind(), parent->toChars()); 222 221 printf("\n"); 223 222 #endif 224 id = ident ? ident->toChars() : toChars(); 225 Dsymbol *par = isnested || isTemplateMixin() ? parent : tempdecl->parent; 223 char *id = ident ? ident->toChars() : toChars(); 226 224 if (!tempdecl) 227 225 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 } 234 236 } 235 237 buf.printf("%zu%s", strlen(id), id); 236 238 id = buf.toChars(); 237 239 buf.data = NULL; 238 240 //printf("TemplateInstance::mangle() %s = %s\n", toChars(), id); 239 241 return id; 240 242 } 241 243 242 244 243 245 244 246 char *Dsymbol::mangle() 245 247 { 246 248 OutBuffer buf; 247 249 char *id; 248 250 249 251 #if 0 250 252 printf("Dsymbol::mangle() '%s'", toChars()); 251 253 if (parent) 252 254 printf(" parent = %s %s", parent->kind(), parent->toChars()); 253 255 printf("\n");
