diff --git a/dmd/cast.c b/dmd/cast.c index 154aa0a3..d6b87822 100644 --- a/dmd/cast.c +++ b/dmd/cast.c @@ -375,7 +375,7 @@ MATCH StructLiteralExp::implicitConvTo(Type *t) if (t->mod == 0) te = te->mutableOf(); else - { assert(t->mod == MODinvariant); + { assert(t->mod == MODimmutable); te = te->invariantOf(); } MATCH m2 = e->implicitConvTo(te); diff --git a/dmd/declaration.c b/dmd/declaration.c index 4457d0d5..b3521187 100644 --- a/dmd/declaration.c +++ b/dmd/declaration.c @@ -140,7 +140,7 @@ void Declaration::checkModify(Loc loc, Scope *sc, Type *t) const char *p = NULL; if (isConst()) p = "const"; - else if (isInvariant()) + else if (isImmutable()) p = "immutable"; else if (storage_class & STCmanifest) p = "enum"; diff --git a/dmd/declaration.h b/dmd/declaration.h index c2b1d37f..8258afc6 100644 --- a/dmd/declaration.h +++ b/dmd/declaration.h @@ -67,7 +67,6 @@ enum STC 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 @@ struct Declaration : Dsymbol 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; } diff --git a/dmd/doc.c b/dmd/doc.c index 796d0da3..6cc6bed5 100644 --- a/dmd/doc.c +++ b/dmd/doc.c @@ -678,7 +678,7 @@ void prefix(OutBuffer *buf, Dsymbol *s) if (d->isConst()) buf->writestring("const "); #if DMDV2 - if (d->isInvariant()) + if (d->isImmutable()) buf->writestring("immutable "); #endif if (d->isFinal()) diff --git a/dmd/expression.c b/dmd/expression.c index c57e8917..1458c96d 100644 --- a/dmd/expression.c +++ b/dmd/expression.c @@ -4083,7 +4083,7 @@ Expression *VarExp::semantic(Scope *sc) #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 @@ Expression *IsExp::semantic(Scope *sc) case TOKinvariant: case TOKimmutable: - if (!targ->isInvariant()) + if (!targ->isImmutable()) goto Lno; tded = targ; break; @@ -7426,7 +7426,7 @@ void CastExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) case MODconst: buf->writestring(Token::tochars[TOKconst]); break; - case MODinvariant: + case MODimmutable: buf->writestring(Token::tochars[TOKimmutable]); break; case MODshared: diff --git a/dmd/interpret.c b/dmd/interpret.c index 78212db8..caa97836 100644 --- a/dmd/interpret.c +++ b/dmd/interpret.c @@ -993,7 +993,7 @@ Expression *getVarExp(Loc loc, InterState *istate, Declaration *d) 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 @@ Expression *DeclarationExp::interpret(InterState *istate) 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 diff --git a/dmd/mtype.c b/dmd/mtype.c index 1edd88f3..2bc4c7b1 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -421,7 +421,7 @@ void Type::toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod) case MODconst: p = "const("; goto L1; - case MODinvariant: + case MODimmutable: p = "invariant("; L1: buf->writestring(p); toCBuffer2(buf, hgs, this->mod); diff --git a/dmd/mtype.h b/dmd/mtype.h index e7aa19bc..2d5fe8bf 100644 --- a/dmd/mtype.h +++ b/dmd/mtype.h @@ -122,7 +122,7 @@ struct Type : Object /* 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 diff --git a/dmd/parse.c b/dmd/parse.c index baea7396..88207e34 100644 --- a/dmd/parse.c +++ b/dmd/parse.c @@ -222,7 +222,7 @@ Array *Parser::parseDeclDefs(int once) s = parseInvariant(); else { - stc = STCinvariant; + stc = STCimmutable; goto Lstc; } #endif @@ -303,7 +303,7 @@ Array *Parser::parseDeclDefs(int once) 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; } diff --git a/dmd/struct.c b/dmd/struct.c index 62f5af0e..3eb70a3b 100644 --- a/dmd/struct.c +++ b/dmd/struct.c @@ -281,7 +281,7 @@ void StructDeclaration::semantic(Scope *sc) 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();