changeset 100:8e1e220cebb3

implemented missing methods
author Trass3r
date Tue, 31 Aug 2010 04:17:10 +0200
parents d78e4992d6ec
children 5e8783b5f929
files dmd/ClassInfoDeclaration.d dmd/ModuleInfoDeclaration.d dmd/StaticDtorDeclaration.d dmd/TypeInfoDeclaration.d
diffstat 4 files changed, 51 insertions(+), 50 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/ClassInfoDeclaration.d	Tue Aug 31 02:18:32 2010 +0200
+++ b/dmd/ClassInfoDeclaration.d	Tue Aug 31 04:17:10 2010 +0200
@@ -19,9 +19,9 @@
 
 class ClassInfoDeclaration : VarDeclaration
 {
-    ClassDeclaration cd;
+	ClassDeclaration cd;
 
-    this(ClassDeclaration cd)
+	this(ClassDeclaration cd)
 	{
 		super(Loc(0), ClassDeclaration.classinfo.type, cd.ident, null);
 		
@@ -29,26 +29,25 @@
 		storage_class = STC.STCstatic | STC.STCgshared;
 	}
 	
-    override Dsymbol syntaxCopy(Dsymbol)
+	override Dsymbol syntaxCopy(Dsymbol)
 	{
-		assert(false);
+		 assert(false);		// should never be produced by syntax
+		 return null;
 	}
 	
-    override void semantic(Scope sc)
+	override void semantic(Scope sc)
 	{
-		assert(false);
 	}
 
-    override void emitComment(Scope sc)
+	override void emitComment(Scope sc)
 	{
-		assert(false);
 	}
 
 	override void toJsonBuffer(OutBuffer buf)
 	{
 	}
-    
-    override Symbol* toSymbol()
+	
+	override Symbol* toSymbol()
 	{
 		return cd.toSymbol();
 	}
--- a/dmd/ModuleInfoDeclaration.d	Tue Aug 31 02:18:32 2010 +0200
+++ b/dmd/ModuleInfoDeclaration.d	Tue Aug 31 04:17:10 2010 +0200
@@ -11,34 +11,32 @@
 
 class ModuleInfoDeclaration : VarDeclaration
 {
-    Module mod;
+	Module mod;
 
-    this(Module mod)
+	this(Module mod)
 	{
-		assert(false);
-		super(Loc(0), null, null, null);
+		super(Loc(0), Module.moduleinfo.type, mod.ident, null);
 	}
 	
-    override Dsymbol syntaxCopy(Dsymbol)
+	override Dsymbol syntaxCopy(Dsymbol)
 	{
-		assert(false);
+		assert(false);		  // should never be produced by syntax
+		return null;
 	}
 	
-    override void semantic(Scope sc)
+	override void semantic(Scope sc)
 	{
-		assert(false);
 	}
 
-    void emitComment(Scope *sc)
+	void emitComment(Scope *sc)
 	{
-		assert(false);
 	}
 
 	override void toJsonBuffer(OutBuffer buf)
 	{
 	}
 
-    override Symbol* toSymbol()
+	override Symbol* toSymbol()
 	{
 		assert(false);
 	}
--- a/dmd/StaticDtorDeclaration.d	Tue Aug 31 02:18:32 2010 +0200
+++ b/dmd/StaticDtorDeclaration.d	Tue Aug 31 04:17:10 2010 +0200
@@ -33,17 +33,19 @@
 {
 	VarDeclaration vgate;	// 'gate' variable
 
-    this(Loc loc, Loc endloc)
+	this(Loc loc, Loc endloc)
 	{
 		super(loc, endloc, Identifier.generateId("_staticDtor"), STCstatic, null);
 	}
 	
-    override Dsymbol syntaxCopy(Dsymbol)
+	override Dsymbol syntaxCopy(Dsymbol s)
 	{
-		assert(false);
+		assert(!s);
+		StaticDtorDeclaration sdd = new StaticDtorDeclaration(loc, endloc);
+		return super.syntaxCopy(sdd);
 	}
 	
-    override void semantic(Scope sc)
+	override void semantic(Scope sc)
 	{
 		ClassDeclaration cd;
 		Type tret;
@@ -99,44 +101,46 @@
 		}
 	}
 	
-    override AggregateDeclaration isThis()
+	override AggregateDeclaration isThis()
 	{
 		return null;
 	}
 	
-    override bool isStaticDestructor()
+	override bool isStaticDestructor()
 	{
 		return true;
 	}
 	
-    override bool isVirtual()
+	override bool isVirtual()
 	{
 		return false;
 	}
 	
-    override bool addPreInvariant()
+	override bool addPreInvariant()
+	{
+		return false;
+	}
+	
+	override bool addPostInvariant()
 	{
 		return false;
 	}
 	
-    override bool addPostInvariant()
+	override void emitComment(Scope sc)
 	{
-		return false;
 	}
 	
-    override void emitComment(Scope sc)
+	override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
 	{
-		assert(false);
-	}
-	
-    override void toCBuffer(OutBuffer buf, HdrGenState* hgs)
-	{
-		assert(false);
+		if (hgs.hdrgen)
+			return;
+		buf.writestring("static ~this()");
+		bodyToCBuffer(buf, hgs);
 	}
 
 	override void toJsonBuffer(OutBuffer buf)
 	{
 	}
 
-    override StaticDtorDeclaration isStaticDtorDeclaration() { return this; }
+	override StaticDtorDeclaration isStaticDtorDeclaration() { return this; }
 }
--- a/dmd/TypeInfoDeclaration.d	Tue Aug 31 02:18:32 2010 +0200
+++ b/dmd/TypeInfoDeclaration.d	Tue Aug 31 04:17:10 2010 +0200
@@ -24,9 +24,9 @@
 
 class TypeInfoDeclaration : VarDeclaration
 {
-    Type tinfo;
+	Type tinfo;
 
-    this(Type tinfo, int internal)
+	this(Type tinfo, int internal)
 	{
 		super(Loc(0), Type.typeinfo.type, tinfo.getTypeInfoIdent(internal), null);
 		this.tinfo = tinfo;
@@ -42,22 +42,22 @@
 		assert(false);
 	}
 }
-    override Dsymbol syntaxCopy(Dsymbol)
+	override Dsymbol syntaxCopy(Dsymbol)
 	{
-		assert(false);
+		assert(false);		  // should never be produced by syntax
+		return null;
 	}
 
-    override void semantic(Scope sc)
+	override void semantic(Scope sc)
 	{
-		assert(false);
+		assert(linkage == LINKc);
 	}
 
-    override void emitComment(Scope sc)
+	override void emitComment(Scope sc)
 	{
-		assert(false);
 	}
 
-    override Symbol* toSymbol()
+	override Symbol* toSymbol()
 	{
 		//printf("TypeInfoDeclaration::toSymbol(%s), linkage = %d\n", toChars(), linkage);
 		return VarDeclaration.toSymbol();
@@ -67,7 +67,7 @@
 	{
 	}
 
-    override void toObjFile(int multiobj)			// compile to .obj file
+	override void toObjFile(int multiobj)			// compile to .obj file
 	{
 		Symbol* s;
 		uint sz;
@@ -113,7 +113,7 @@
 			obj_export(s,0);
 	}
 
-    void toDt(dt_t** pdt)
+	void toDt(dt_t** pdt)
 	{
 		assert(false);
 	}