diff dmd/LinkDeclaration.d @ 0:10317f0c89a5

Initial commit
author korDen
date Sat, 24 Oct 2009 08:42:06 +0400
parents
children 2e2a5c3f943a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dmd/LinkDeclaration.d	Sat Oct 24 08:42:06 2009 +0400
@@ -0,0 +1,75 @@
+module dmd.LinkDeclaration;
+
+import dmd.AttribDeclaration;
+import dmd.LINK;
+import dmd.OutBuffer;
+import dmd.HdrGenState;
+import dmd.Scope;
+import dmd.Dsymbol;
+import dmd.Array;
+
+class LinkDeclaration : AttribDeclaration
+{
+    LINK linkage;
+
+    this(LINK p, Array decl)
+	{
+		super(decl);
+		//printf("LinkDeclaration(linkage = %d, decl = %p)\n", p, decl);
+		linkage = p;
+	}
+
+    Dsymbol syntaxCopy(Dsymbol s)
+	{
+		assert(false);
+	}
+
+    void setScope(Scope sc)
+	{
+		//printf("LinkDeclaration::setScope(linkage = %d, decl = %p)\n", linkage, decl);
+		if (decl)
+		{
+			setScopeNewSc(sc, sc.stc, linkage, sc.protection, sc.explicitProtection, sc.structalign);
+		}
+	}
+	
+    void semantic(Scope sc)
+	{
+		//printf("LinkDeclaration::semantic(linkage = %d, decl = %p)\n", linkage, decl);
+		if (decl)
+		{
+			semanticNewSc(sc, sc.stc, linkage, sc.protection, sc.explicitProtection, sc.structalign);
+		}
+	}
+	
+    void semantic3(Scope sc)
+	{
+		//printf("LinkDeclaration::semantic3(linkage = %d, decl = %p)\n", linkage, decl);
+		if (decl)
+		{	
+			LINK linkage_save = sc.linkage;
+
+			sc.linkage = linkage;
+			for (uint i = 0; i < decl.dim; i++)
+			{
+				Dsymbol s = cast(Dsymbol)decl.data[i];
+				s.semantic3(sc);
+			}
+			sc.linkage = linkage_save;
+		}
+		else
+		{
+			sc.linkage = linkage;
+		}
+	}
+	
+    void toCBuffer(OutBuffer buf, HdrGenState* hgs)
+	{
+		assert(false);
+	}
+	
+    string toChars()
+	{
+		assert(false);
+	}
+}
\ No newline at end of file