comparison dmd/parse.c @ 1602:a413ae7329bf

Merge DMD r243: some harmonization with D2 dmd --- dmd/aggregate.h | 24 ++++- dmd/attrib.c | 63 ++++++---- dmd/attrib.h | 10 +- dmd/declaration.h | 5 +- dmd/func.c | 337 ++++++++++++++++++++++------------------------------- dmd/mars.c | 2 +- dmd/mars.h | 7 + dmd/mtype.h | 13 ++- dmd/parse.c | 32 ++++- dmd/parse.h | 14 ++- dmd/scope.h | 2 +- 11 files changed, 263 insertions(+), 246 deletions(-)
author Leandro Lucarella <llucax@gmail.com>
date Wed, 06 Jan 2010 15:18:19 -0300
parents def7a1d494fd
children eae495e6ae8d
comparison
equal deleted inserted replaced
1601:49722e6e6e05 1602:a413ae7329bf
147 { Dsymbol *s; 147 { Dsymbol *s;
148 Array *decldefs; 148 Array *decldefs;
149 Array *a; 149 Array *a;
150 Array *aelse; 150 Array *aelse;
151 enum PROT prot; 151 enum PROT prot;
152 unsigned stc; 152 StorageClass stc;
153 Condition *condition; 153 Condition *condition;
154 unsigned char *comment; 154 unsigned char *comment;
155 155
156 //printf("Parser::parseDeclDefs()\n"); 156 //printf("Parser::parseDeclDefs()\n");
157 decldefs = new Array(); 157 decldefs = new Array();
284 #if DMDV2 284 #if DMDV2
285 case TOKnothrow: stc = STCnothrow; goto Lstc; 285 case TOKnothrow: stc = STCnothrow; goto Lstc;
286 case TOKpure: stc = STCpure; goto Lstc; 286 case TOKpure: stc = STCpure; goto Lstc;
287 case TOKref: stc = STCref; goto Lstc; 287 case TOKref: stc = STCref; goto Lstc;
288 case TOKtls: stc = STCtls; goto Lstc; 288 case TOKtls: stc = STCtls; goto Lstc;
289 case TOKgshared: stc = STCgshared; goto Lstc;
289 //case TOKmanifest: stc = STCmanifest; goto Lstc; 290 //case TOKmanifest: stc = STCmanifest; goto Lstc;
290 #endif 291 #endif
291 292
292 Lstc: 293 Lstc:
293 nextToken(); 294 nextToken();
512 } 513 }
513 } while (!once); 514 } while (!once);
514 return decldefs; 515 return decldefs;
515 } 516 }
516 517
518 /*********************************************
519 * Give error on conflicting storage classes.
520 */
521
522 #if DMDV2
523 void Parser::composeStorageClass(StorageClass stc)
524 {
525 StorageClass u = stc;
526 u &= STCconst | STCimmutable | STCmanifest;
527 if (u & (u - 1))
528 error("conflicting storage class %s", Token::toChars(token.value));
529 u = stc;
530 u &= STCgshared | STCshared | STCtls;
531 if (u & (u - 1))
532 error("conflicting storage class %s", Token::toChars(token.value));
533 }
534 #endif
517 535
518 /******************************************** 536 /********************************************
519 * Parse declarations after an align, protection, or extern decl. 537 * Parse declarations after an align, protection, or extern decl.
520 */ 538 */
521 539
765 * Parse a constructor definition: 783 * Parse a constructor definition:
766 * this(arguments) { body } 784 * this(arguments) { body }
767 * Current token is 'this'. 785 * Current token is 'this'.
768 */ 786 */
769 787
770 CtorDeclaration *Parser::parseCtor() 788 Dsymbol *Parser::parseCtor()
771 { 789 {
772 CtorDeclaration *f; 790 CtorDeclaration *f;
773 Arguments *arguments; 791 Arguments *arguments;
774 int varargs; 792 int varargs;
775 Loc loc = this->loc; 793 Loc loc = this->loc;
943 while (1) 961 while (1)
944 { Type *tb; 962 { Type *tb;
945 Identifier *ai = NULL; 963 Identifier *ai = NULL;
946 Type *at; 964 Type *at;
947 Argument *a; 965 Argument *a;
948 unsigned storageClass; 966 StorageClass storageClass = 0;
949 Expression *ae; 967 Expression *ae;
950 968
951 storageClass = STCin; // parameter is "in" by default 969 storageClass = STCin; // parameter is "in" by default
952 switch (token.value) 970 switch (token.value)
953 { 971 {
1321 1339
1322 /****************************************** 1340 /******************************************
1323 * Parse template parameter list. 1341 * Parse template parameter list.
1324 */ 1342 */
1325 1343
1326 TemplateParameters *Parser::parseTemplateParameterList() 1344 TemplateParameters *Parser::parseTemplateParameterList(int flag)
1327 { 1345 {
1328 TemplateParameters *tpl = new TemplateParameters(); 1346 TemplateParameters *tpl = new TemplateParameters();
1329 1347
1330 if (token.value != TOKlparen) 1348 if (token.value != TOKlparen)
1331 { error("parenthesized TemplateParameterList expected following TemplateIdentifier"); 1349 { error("parenthesized TemplateParameterList expected following TemplateIdentifier");
2080 * Return array of Declaration *'s. 2098 * Return array of Declaration *'s.
2081 */ 2099 */
2082 2100
2083 Array *Parser::parseDeclarations() 2101 Array *Parser::parseDeclarations()
2084 { 2102 {
2085 enum STC storage_class; 2103 StorageClass storage_class;
2086 enum STC stc; 2104 StorageClass stc;
2087 Type *ts; 2105 Type *ts;
2088 Type *t; 2106 Type *t;
2089 Type *tfirst; 2107 Type *tfirst;
2090 Identifier *ident; 2108 Identifier *ident;
2091 Array *a; 2109 Array *a;
2336 * Starts with token on the first ident. 2354 * Starts with token on the first ident.
2337 * Ends with scanner past closing ';' 2355 * Ends with scanner past closing ';'
2338 */ 2356 */
2339 2357
2340 #if DMDV2 2358 #if DMDV2
2341 Array *Parser::parseAutoDeclarations(unsigned storageClass, unsigned char *comment) 2359 Array *Parser::parseAutoDeclarations(StorageClass storageClass, unsigned char *comment)
2342 { 2360 {
2343 Array *a = new Array; 2361 Array *a = new Array;
2344 2362
2345 while (1) 2363 while (1)
2346 { 2364 {