Mercurial > projects > ldc
comparison dmd/attrib.c @ 875:330f999ade44
Merged DMD 1.038
author | Tomas Lindquist Olsen <tomas.l.olsen@gmail.com> |
---|---|
date | Tue, 06 Jan 2009 16:33:51 +0100 |
parents | bc982f1ad106 |
children | 27a379f288bf |
comparison
equal
deleted
inserted
replaced
874:2ddee23bd70e | 875:330f999ade44 |
---|---|
404 sc->linkage = linkage; | 404 sc->linkage = linkage; |
405 } | 405 } |
406 } | 406 } |
407 | 407 |
408 void LinkDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) | 408 void LinkDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) |
409 { char *p; | 409 { const char *p; |
410 | 410 |
411 switch (linkage) | 411 switch (linkage) |
412 { | 412 { |
413 case LINKd: p = "D"; break; | 413 case LINKd: p = "D"; break; |
414 case LINKc: p = "C"; break; | 414 case LINKc: p = "C"; break; |
429 AttribDeclaration::toCBuffer(buf, hgs); | 429 AttribDeclaration::toCBuffer(buf, hgs); |
430 } | 430 } |
431 | 431 |
432 char *LinkDeclaration::toChars() | 432 char *LinkDeclaration::toChars() |
433 { | 433 { |
434 return "extern ()"; | 434 return (char *)"extern ()"; |
435 } | 435 } |
436 | 436 |
437 /********************************* ProtDeclaration ****************************/ | 437 /********************************* ProtDeclaration ****************************/ |
438 | 438 |
439 ProtDeclaration::ProtDeclaration(enum PROT p, Array *decl) | 439 ProtDeclaration::ProtDeclaration(enum PROT p, Array *decl) |
474 sc->explicitProtection = 1; | 474 sc->explicitProtection = 1; |
475 } | 475 } |
476 } | 476 } |
477 | 477 |
478 void ProtDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) | 478 void ProtDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) |
479 { char *p; | 479 { const char *p; |
480 | 480 |
481 switch (protection) | 481 switch (protection) |
482 { | 482 { |
483 case PROTprivate: p = "private"; break; | 483 case PROTprivate: p = "private"; break; |
484 case PROTpackage: p = "package"; break; | 484 case PROTpackage: p = "package"; break; |
719 buf->writestring("}\n"); | 719 buf->writestring("}\n"); |
720 } | 720 } |
721 | 721 |
722 const char *AnonDeclaration::kind() | 722 const char *AnonDeclaration::kind() |
723 { | 723 { |
724 return (char *)(isunion ? "anonymous union" : "anonymous struct"); | 724 return (isunion ? "anonymous union" : "anonymous struct"); |
725 } | 725 } |
726 | 726 |
727 /********************************* PragmaDeclaration ****************************/ | 727 /********************************* PragmaDeclaration ****************************/ |
728 | 728 |
729 static bool parseStringExp(Expression* e, std::string& res) | 729 static bool parseStringExp(Expression* e, std::string& res) |
1361 /***************************** CompileDeclaration *****************************/ | 1361 /***************************** CompileDeclaration *****************************/ |
1362 | 1362 |
1363 CompileDeclaration::CompileDeclaration(Loc loc, Expression *exp) | 1363 CompileDeclaration::CompileDeclaration(Loc loc, Expression *exp) |
1364 : AttribDeclaration(NULL) | 1364 : AttribDeclaration(NULL) |
1365 { | 1365 { |
1366 //printf("CompileDeclaration(loc = %d)\n", loc.linnum); | |
1366 this->loc = loc; | 1367 this->loc = loc; |
1367 this->exp = exp; | 1368 this->exp = exp; |
1368 this->sd = NULL; | 1369 this->sd = NULL; |
1369 this->compiled = 0; | 1370 this->compiled = 0; |
1370 } | 1371 } |
1390 return memnum; | 1391 return memnum; |
1391 } | 1392 } |
1392 | 1393 |
1393 void CompileDeclaration::compileIt(Scope *sc) | 1394 void CompileDeclaration::compileIt(Scope *sc) |
1394 { | 1395 { |
1395 //printf("CompileDeclaration::compileIt()\n"); | 1396 //printf("CompileDeclaration::compileIt(loc = %d)\n", loc.linnum); |
1396 exp = exp->semantic(sc); | 1397 exp = exp->semantic(sc); |
1397 exp = resolveProperties(sc, exp); | 1398 exp = resolveProperties(sc, exp); |
1398 exp = exp->optimize(WANTvalue | WANTinterpret); | 1399 exp = exp->optimize(WANTvalue | WANTinterpret); |
1399 if (exp->op != TOKstring) | 1400 if (exp->op != TOKstring) |
1400 { exp->error("argument to mixin must be a string, not (%s)", exp->toChars()); | 1401 { exp->error("argument to mixin must be a string, not (%s)", exp->toChars()); |