diff 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
line wrap: on
line diff
--- a/dmd/parse.c	Mon Dec 28 02:23:54 2009 +0000
+++ b/dmd/parse.c	Wed Jan 06 15:18:19 2010 -0300
@@ -149,7 +149,7 @@
     Array *a;
     Array *aelse;
     enum PROT prot;
-    unsigned stc;
+    StorageClass stc;
     Condition *condition;
     unsigned char *comment;
 
@@ -286,6 +286,7 @@
 	    case TOKpure:         stc = STCpure;	 goto Lstc;
 	    case TOKref:          stc = STCref;          goto Lstc;
 	    case TOKtls:          stc = STCtls;		 goto Lstc;
+	    case TOKgshared:      stc = STCgshared;	 goto Lstc;
 	    //case TOKmanifest:	  stc = STCmanifest;	 goto Lstc;
 #endif
 
@@ -514,6 +515,23 @@
     return decldefs;
 }
 
+/*********************************************
+ * Give error on conflicting storage classes.
+ */
+
+#if DMDV2
+void Parser::composeStorageClass(StorageClass stc)
+{
+    StorageClass u = stc;
+    u &= STCconst | STCimmutable | STCmanifest;
+    if (u & (u - 1))
+	error("conflicting storage class %s", Token::toChars(token.value));
+    u = stc;
+    u &= STCgshared | STCshared | STCtls;
+    if (u & (u - 1))
+	error("conflicting storage class %s", Token::toChars(token.value));
+}
+#endif
 
 /********************************************
  * Parse declarations after an align, protection, or extern decl.
@@ -767,7 +785,7 @@
  * Current token is 'this'.
  */
 
-CtorDeclaration *Parser::parseCtor()
+Dsymbol *Parser::parseCtor()
 {
     CtorDeclaration *f;
     Arguments *arguments;
@@ -945,7 +963,7 @@
 	Identifier *ai = NULL;
 	Type *at;
 	Argument *a;
-	unsigned storageClass;
+	StorageClass storageClass = 0;
 	Expression *ae;
 
 	storageClass = STCin;		// parameter is "in" by default
@@ -1323,7 +1341,7 @@
  * Parse template parameter list.
  */
 
-TemplateParameters *Parser::parseTemplateParameterList()
+TemplateParameters *Parser::parseTemplateParameterList(int flag)
 {
     TemplateParameters *tpl = new TemplateParameters();
 
@@ -2082,8 +2100,8 @@
 
 Array *Parser::parseDeclarations()
 {
-    enum STC storage_class;
-    enum STC stc;
+    StorageClass storage_class;
+    StorageClass stc;
     Type *ts;
     Type *t;
     Type *tfirst;
@@ -2338,7 +2356,7 @@
  */
 
 #if DMDV2
-Array *Parser::parseAutoDeclarations(unsigned storageClass, unsigned char *comment)
+Array *Parser::parseAutoDeclarations(StorageClass storageClass, unsigned char *comment)
 {
     Array *a = new Array;