diff dmd/AggregateDeclaration.d @ 176:fa9a71a9f5a8

Moved all the mutable globals to Global
author korDen
date Sun, 10 Oct 2010 05:22:45 +0400
parents 206db751bd4c
children e3afd1303184
line wrap: on
line diff
--- a/dmd/AggregateDeclaration.d	Sun Oct 10 03:48:06 2010 +0400
+++ b/dmd/AggregateDeclaration.d	Sun Oct 10 05:22:45 2010 +0400
@@ -15,6 +15,7 @@
 import dmd.TypeClass;
 import dmd.TOK;
 import dmd.ThisExp;
+import dmd.Global;
 import dmd.PROT;
 import dmd.Expression;
 import dmd.STC;
@@ -110,7 +111,7 @@
 			if (cdthis)
 			{
 				foreach (b; cdthis.baseclasses)
-				{   
+				{
 					PROT access = b.base.getAccess(smember);
 
 					if (access >= PROT.PROTprotected || accessCheckX(smember, sfunc, b.base, cdscope))
@@ -127,7 +128,7 @@
 			if (cdthis)
 			{
 				foreach (b; cdthis.baseclasses)
-				{   
+				{
 					if (accessCheckX(smember, sfunc, b.base, cdscope))
 						return true;
 				}
@@ -154,7 +155,7 @@
 				// 1: size is correct
 				// 2: cannot determine size; fwd referenced
     bool isdeprecated;		// true if deprecated
-	
+
 version (DMDV2) {
     bool isnested;		// true if is nested
     VarDeclaration vthis;	// 'this' parameter if this aggregate is nested
@@ -182,7 +183,7 @@
 	{
 		super(id);
 		this.loc = loc;
-		
+
 		fields = new VarDeclarations();	///
 		dtors = new FuncDeclarations();
 	}
@@ -191,7 +192,7 @@
 	{
 		//printf("AggregateDeclaration.semantic2(%s)\n", toChars());
 		if (scope_ && members)
-		{	
+		{
 			error("has forward references");
 			return;
 		}
@@ -228,7 +229,7 @@
 			}
 		}
 	}
-	
+
     override uint size(Loc loc)
 	{
 		//printf("AggregateDeclaration.size() = %d\n", structsize);
@@ -236,14 +237,14 @@
 			error(loc, "unknown size");
 
 		if (sizeok != 1)
-		{	
+		{
 			error(loc, "no size yet for forward reference");
 			//*(char*)0=0;
 		}
 
 		return structsize;
 	}
-	
+
 	/****************************
 	 * Do byte or word alignment as necessary.
 	 * Align sizes of 0, as we may not know array sizes yet.
@@ -261,12 +262,12 @@
 		}
 		//printf("result = %d\n",offset);
 	}
-	
+
     override Type getType()
 	{
 		return type;
 	}
-	
+
     void addField(Scope sc, VarDeclaration v)
 	{
 		uint memsize;		// size of member
@@ -280,7 +281,7 @@
 		Type t = v.type.toBasetype();
 		if (v.storage_class & STC.STCref)
 		{	// References are the size of a pointer
-		t = Type.tvoidptr;
+		t = global.tvoidptr;
 		}
 		if (t.ty == TY.Tstruct /*&& isStructDeclaration()*/)
 		{	TypeStruct ts = cast(TypeStruct)t;
@@ -321,7 +322,7 @@
 		//printf(" addField '%s' to '%s' at offset %d, size = %d\n", v.toChars(), toChars(), v.offset, memsize);
 		fields.push(v);
 	}
-	
+
     override bool isDeprecated()		// is aggregate deprecated?
 	{
 		return isdeprecated;
@@ -357,7 +358,7 @@
 			{   TypeStruct ts = cast(TypeStruct)tv;
 				StructDeclaration sd = ts.sym;
 				if (sd.dtor)
-				{	
+				{
 					Expression ex;
 
 					// this.v
@@ -365,7 +366,7 @@
 					ex = new DotVarExp(Loc(0), ex, v, 0);
 
 					if (dim == 1)
-					{   
+					{
 						// this.v.dtor()
 						ex = new DotVarExp(Loc(0), ex, sd.dtor, 0);
 						ex = new CallExp(Loc(0), ex);
@@ -389,7 +390,7 @@
 		/* Build our own "destructor" which executes e
 		 */
 		if (e)
-		{	
+		{
 			//printf("Building __fieldDtor()\n");
 			DtorDeclaration dd = new DtorDeclaration(Loc(0), Loc(0), Lexer.idPool("__fieldDtor"));
 			dd.fbody = new ExpStatement(Loc(0), e);
@@ -437,19 +438,19 @@
 	{
 		assert(false);
 	}
-	
+
 	override void toJsonBuffer(OutBuffer buf)
 	{
 		//writef("AggregateDeclaration.toJsonBuffer()\n");
 		buf.writestring("{\n");
-	
+
 		JsonProperty(buf, Pname, toChars());
 		JsonProperty(buf, Pkind, kind());
 		if (comment)
 			JsonProperty(buf, Pcomment, comment);
 		if (loc.linnum)
 			JsonProperty(buf, Pline, loc.linnum);
-	
+
 		ClassDeclaration cd = isClassDeclaration();
 		if (cd)
 		{
@@ -476,7 +477,7 @@
 				buf.writestring("],\n");
 			}
 		}
-	
+
 		JsonString(buf, Pmembers);
 		buf.writestring(" : [\n");
 		size_t offset = buf.offset;
@@ -491,7 +492,7 @@
 		}
 		JsonRemoveComma(buf);
 		buf.writestring("]\n");
-	
+
 		buf.writestring("}\n");
 	}
 
@@ -532,7 +533,7 @@
 }
 		return false;
 	}
-	
+
 	/**********************************
 	 * Determine if smember has access to private members of this declaration.
 	 */
@@ -559,7 +560,7 @@
 
 			// If both are members of the same module, grant access
 			while (true)
-			{   
+			{
 				Dsymbol sp = smember.toParent();
 				if (sp.isFuncDeclaration() && smember.isFuncDeclaration())
 					smember = sp;
@@ -586,7 +587,7 @@
 	}
 		return false;
 	}
-	
+
 	/*******************************
 	 * Do access check for member of this class, this class being the
 	 * type of the 'this' pointer used to access smember.
@@ -616,7 +617,7 @@
 		//assert(smember.parent.isBaseOf(this, null));
 
 		if (smemberparent == this)
-		{	
+		{
 			PROT access2 = smember.prot();
 
 			result = access2 >= PROT.PROTpublic ||