changeset 1619:c61782a76dff

Merge DMD r304: refactor invariant => immutable --- dmd/cast.c | 2 +- dmd/declaration.c | 2 +- dmd/declaration.h | 3 +-- dmd/doc.c | 2 +- dmd/expression.c | 6 +++--- dmd/interpret.c | 4 ++-- dmd/mtype.c | 2 +- dmd/mtype.h | 2 +- dmd/parse.c | 4 ++-- dmd/struct.c | 2 +- 10 files changed, 14 insertions(+), 15 deletions(-)
author Leandro Lucarella <llucax@gmail.com>
date Wed, 06 Jan 2010 15:18:22 -0300
parents a87f1d6ff48e
children 0333945a915e
files dmd/cast.c dmd/declaration.c dmd/declaration.h dmd/doc.c dmd/expression.c dmd/interpret.c dmd/mtype.c dmd/mtype.h dmd/parse.c dmd/struct.c
diffstat 10 files changed, 14 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/cast.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/cast.c	Wed Jan 06 15:18:22 2010 -0300
@@ -375,7 +375,7 @@
 	    if (t->mod == 0)
 		te = te->mutableOf();
 	    else
-	    {	assert(t->mod == MODinvariant);
+	    {	assert(t->mod == MODimmutable);
 		te = te->invariantOf();
 	    }
 	    MATCH m2 = e->implicitConvTo(te);
--- a/dmd/declaration.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/declaration.c	Wed Jan 06 15:18:22 2010 -0300
@@ -140,7 +140,7 @@
 	    const char *p = NULL;
 	    if (isConst())
 		p = "const";
-	    else if (isInvariant())
+	    else if (isImmutable())
 		p = "immutable";
 	    else if (storage_class & STCmanifest)
 		p = "enum";
--- a/dmd/declaration.h	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/declaration.h	Wed Jan 06 15:18:22 2010 -0300
@@ -67,7 +67,6 @@
     STCctorinit     = 0x20000,		// can only be set inside constructor
     STCtemplateparameter = 0x40000,	// template parameter
     STCscope	    = 0x80000,		// template parameter
-    STCinvariant    = 0x100000,
     STCimmutable    = 0x100000,
     STCref	    = 0x200000,
     STCinit	    = 0x400000,		// has explicit initializer
@@ -131,7 +130,7 @@
     int isFinal()        { return storage_class & STCfinal; }
     int isAbstract()     { return storage_class & STCabstract; }
     int isConst()        { return storage_class & STCconst; }
-    int isInvariant()    { return storage_class & STCinvariant; }
+    int isImmutable()    { return storage_class & STCimmutable; }
     int isAuto()         { return storage_class & STCauto; }
     int isScope()        { return storage_class & STCscope; }
     int isSynchronized() { return storage_class & STCsynchronized; }
--- a/dmd/doc.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/doc.c	Wed Jan 06 15:18:22 2010 -0300
@@ -678,7 +678,7 @@
 	if (d->isConst())
 	    buf->writestring("const ");
 #if DMDV2
-	if (d->isInvariant())
+	if (d->isImmutable())
 	    buf->writestring("immutable ");
 #endif
 	if (d->isFinal())
--- a/dmd/expression.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/expression.c	Wed Jan 06 15:18:22 2010 -0300
@@ -4083,7 +4083,7 @@
 #if DMDV2
 	if (sc->func && sc->func->isPure() && !sc->intypeof)
 	{
-	    if (v->isDataseg() && !v->isInvariant())
+	    if (v->isDataseg() && !v->isImmutable())
 		error("pure function '%s' cannot access mutable static data '%s'", sc->func->toChars(), v->toChars());
 	}
 #endif
@@ -4763,7 +4763,7 @@
 
 	    case TOKinvariant:
 	    case TOKimmutable:
-		if (!targ->isInvariant())
+		if (!targ->isImmutable())
 		    goto Lno;
 		tded = targ;
 		break;
@@ -7426,7 +7426,7 @@
 	    case MODconst:
 		buf->writestring(Token::tochars[TOKconst]);
 		break;
-	    case MODinvariant:
+	    case MODimmutable:
 		buf->writestring(Token::tochars[TOKimmutable]);
 		break;
 	    case MODshared:
--- a/dmd/interpret.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/interpret.c	Wed Jan 06 15:18:22 2010 -0300
@@ -993,7 +993,7 @@
     if (v)
     {
 #if DMDV2
-	if ((v->isConst() || v->isInvariant() || v->storage_class & STCmanifest) && v->init && !v->value)
+	if ((v->isConst() || v->isImmutable() || v->storage_class & STCmanifest) && v->init && !v->value)
 #else
 	if (v->isConst() && v->init)
 #endif
@@ -1051,7 +1051,7 @@
 		e = NULL;
 	}
 #if DMDV2
-	else if (s == v && (v->isConst() || v->isInvariant()) && v->init)
+	else if (s == v && (v->isConst() || v->isImmutable()) && v->init)
 #else
 	else if (s == v && v->isConst() && v->init)
 #endif
--- a/dmd/mtype.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/mtype.c	Wed Jan 06 15:18:22 2010 -0300
@@ -421,7 +421,7 @@
 	    case MODconst:
 		p = "const(";
 		goto L1;
-	    case MODinvariant:
+	    case MODimmutable:
 		p = "invariant(";
 	    L1:	buf->writestring(p);
 		toCBuffer2(buf, hgs, this->mod);
--- a/dmd/mtype.h	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/mtype.h	Wed Jan 06 15:18:22 2010 -0300
@@ -122,7 +122,7 @@
 	/* pick this order of numbers so switch statements work better
 	 */
 	#define MODconst     1	// type is const
-	#define MODinvariant 4	// type is invariant
+	#define MODimmutable 4	// type is invariant
 	#define MODshared    2	// type is shared
     char *deco;
     Type *pto;		// merged pointer to this type
--- a/dmd/parse.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/parse.c	Wed Jan 06 15:18:22 2010 -0300
@@ -222,7 +222,7 @@
 		    s = parseInvariant();
 		else
 		{
-		    stc = STCinvariant;
+		    stc = STCimmutable;
 		    goto Lstc;
 		}
 #endif
@@ -303,7 +303,7 @@
 		    case TOKabstract:	  stc |= STCabstract;	 goto Lstc;
 		    case TOKsynchronized: stc |= STCsynchronized; goto Lstc;
 		    case TOKdeprecated:   stc |= STCdeprecated;	 goto Lstc;
-		    //case TOKinvariant:    stc |= STCinvariant;   goto Lstc;
+		    //case TOKinvariant:    stc |= STCimmutable;   goto Lstc;
 		    default:
 			break;
 		}
--- a/dmd/struct.c	Wed Jan 06 15:18:21 2010 -0300
+++ b/dmd/struct.c	Wed Jan 06 15:18:22 2010 -0300
@@ -281,7 +281,7 @@
     if (sc->stc & STCabstract)
 	error("structs, unions cannot be abstract");
 #if DMDV2
-    if (storage_class & STCinvariant)
+    if (storage_class & STCimmutable)
         type = type->invariantOf();
     else if (storage_class & STCconst)
         type = type->constOf();