changeset 49:0aa7d1437ada

AttribDeclaration.oneMember Lexer.decodeUTF WithStatement.ctor StructDeclaration.syntaxCopy CtorDeclaration.syntaxCopy ConditionalStatement.syntaxCopy ProtDeclaration.syntaxCopy ArrayScopeSymbol.this TemplateDeclaration.toChars
author korDen
date Sat, 21 Aug 2010 07:53:20 +0400
parents 0bd8afbaffd7
children adf6f7f216ea
files dmd/ArrayScopeSymbol.d dmd/AttribDeclaration.d dmd/ConditionalStatement.d dmd/CtorDeclaration.d dmd/Lexer.d dmd/ProtDeclaration.d dmd/StructDeclaration.d dmd/TemplateDeclaration.d dmd/WithStatement.d
diffstat 9 files changed, 90 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/ArrayScopeSymbol.d	Sat Aug 21 07:39:45 2010 +0400
+++ b/dmd/ArrayScopeSymbol.d	Sat Aug 21 07:53:20 2010 +0400
@@ -42,7 +42,10 @@
 	
     this(Scope sc, TypeTuple t)
 	{
-		assert(false);
+		exp = null;
+		type = t;
+		td = null;
+		this.sc = sc;
 	}
 	
     this(Scope sc, TupleDeclaration s)
--- a/dmd/AttribDeclaration.d	Sat Aug 21 07:39:45 2010 +0400
+++ b/dmd/AttribDeclaration.d	Sat Aug 21 07:53:20 2010 +0400
@@ -191,7 +191,9 @@
 	
     bool oneMember(Dsymbol* ps)
 	{
-		assert(false);
+		Array d = include(null, null);
+
+		return Dsymbol.oneMembers(d, ps);
 	}
 	
     bool hasPointers()
--- a/dmd/ConditionalStatement.d	Sat Aug 21 07:39:45 2010 +0400
+++ b/dmd/ConditionalStatement.d	Sat Aug 21 07:53:20 2010 +0400
@@ -25,7 +25,11 @@
 	
     Statement syntaxCopy()
 	{
-		assert(false);
+		Statement e = null;
+		if (elsebody)
+			e = elsebody.syntaxCopy();
+		ConditionalStatement s = new ConditionalStatement(loc, condition.syntaxCopy(), ifbody.syntaxCopy(), e);
+		return s;
 	}
 	
     Statement semantic(Scope sc)
--- a/dmd/CtorDeclaration.d	Sat Aug 21 07:39:45 2010 +0400
+++ b/dmd/CtorDeclaration.d	Sat Aug 21 07:53:20 2010 +0400
@@ -37,7 +37,16 @@
 	
     Dsymbol syntaxCopy(Dsymbol)
 	{
-		assert(false);
+		CtorDeclaration f = new CtorDeclaration(loc, endloc, null, varargs);
+
+		f.outId = outId;
+		f.frequire = frequire ? frequire.syntaxCopy() : null;
+		f.fensure  = fensure  ? fensure.syntaxCopy()  : null;
+		f.fbody    = fbody    ? fbody.syntaxCopy()    : null;
+		assert(!fthrows); // deprecated
+
+		f.arguments = Argument.arraySyntaxCopy(arguments);
+		return f;
 	}
 	
     void semantic(Scope sc)
--- a/dmd/Lexer.d	Sat Aug 21 07:39:45 2010 +0400
+++ b/dmd/Lexer.d	Sat Aug 21 07:53:20 2010 +0400
@@ -2466,9 +2466,36 @@
 		assert(false);
 	}
 
+	/********************************************
+	 * Decode UTF character.
+	 * Issue error messages for invalid sequences.
+	 * Return decoded character, advance p to last character in UTF sequence.
+	 */
     uint decodeUTF()
 	{
-		assert(false);
+		dchar u;
+		ubyte c;
+		ubyte* s = p;
+		size_t len;
+		size_t idx;
+		string msg;
+
+		c = *s;
+		assert(c & 0x80);
+
+		// Check length of remaining string up to 6 UTF-8 characters
+		for (len = 1; len < 6 && s[len]; len++) {
+			;
+		}
+
+		idx = 0;
+		msg = utf_decodeChar(cast(string)s[0..len], &idx, &u);
+		p += idx - 1;
+		if (msg)
+		{
+			error("%s", msg);
+		}
+		return u;
 	}
 
     void getDocComment(Token* t, uint lineComment)
--- a/dmd/ProtDeclaration.d	Sat Aug 21 07:39:45 2010 +0400
+++ b/dmd/ProtDeclaration.d	Sat Aug 21 07:53:20 2010 +0400
@@ -22,7 +22,11 @@
 	
     Dsymbol syntaxCopy(Dsymbol s)
 	{
-		assert(false);
+		ProtDeclaration pd;
+
+		assert(!s);
+		pd = new ProtDeclaration(protection, Dsymbol.arraySyntaxCopy(decl));
+		return pd;
 	}
 	
     void setScope(Scope sc)
--- a/dmd/StructDeclaration.d	Sat Aug 21 07:39:45 2010 +0400
+++ b/dmd/StructDeclaration.d	Sat Aug 21 07:53:20 2010 +0400
@@ -84,7 +84,14 @@
 	
     Dsymbol syntaxCopy(Dsymbol s)
 	{
-		assert(false);
+		StructDeclaration sd;
+
+		if (s)
+			sd = cast(StructDeclaration)s;
+		else
+			sd = new StructDeclaration(loc, ident);
+		ScopeDsymbol.syntaxCopy(sd);
+		return sd;
 	}
 	
     void semantic(Scope sc)
--- a/dmd/TemplateDeclaration.d	Sat Aug 21 07:39:45 2010 +0400
+++ b/dmd/TemplateDeclaration.d	Sat Aug 21 07:53:20 2010 +0400
@@ -309,7 +309,30 @@
 
     string toChars()
 	{
-		assert(false);
+		OutBuffer buf = new OutBuffer();
+		HdrGenState hgs;
+
+		/// memset(&hgs, 0, hgs.sizeof);
+		buf.writestring(ident.toChars());
+		buf.writeByte('(');
+		for (int i = 0; i < parameters.dim; i++)
+		{
+			TemplateParameter tp = cast(TemplateParameter)parameters.data[i];
+			if (i)
+				buf.writeByte(',');
+			tp.toCBuffer(buf, &hgs);
+		}
+		buf.writeByte(')');
+version (DMDV2) {
+		if (constraint)
+		{
+			buf.writestring(" if (");
+			constraint.toCBuffer(buf, &hgs);
+			buf.writeByte(')');
+		}
+}
+		buf.writeByte(0);
+		return buf.extractString();
 	}
 
     void emitComment(Scope sc)
--- a/dmd/WithStatement.d	Sat Aug 21 07:39:45 2010 +0400
+++ b/dmd/WithStatement.d	Sat Aug 21 07:53:20 2010 +0400
@@ -19,8 +19,10 @@
 
     this(Loc loc, Expression exp, Statement body_)
 	{
-		assert(false);
 		super(loc);
+		this.exp = exp;
+		this.body_ = body_;
+		wthis = null;
 	}
 	
     Statement syntaxCopy()