Mercurial > projects > ddmd
diff dmd/TypeFunction.d @ 129:010eb8f0e18d
further work on dmd test suite
author | korDen |
---|---|
date | Sun, 05 Sep 2010 15:32:22 +0400 |
parents | 1765f3ef917d |
children | 60bb0fe4563e |
line wrap: on
line diff
--- a/dmd/TypeFunction.d Sat Sep 04 01:33:05 2010 +0100 +++ b/dmd/TypeFunction.d Sun Sep 05 15:32:22 2010 +0400 @@ -15,6 +15,7 @@ import dmd.PROT; import dmd.TypeIdentifier; import dmd.TemplateParameter; +import dmd.TypeInfoFunctionDeclaration; import dmd.Tuple; import dmd.Type; import dmd.Loc; @@ -42,6 +43,8 @@ import core.stdc.stdlib; import core.stdc.string; +import std.stdio; + class TypeFunction : TypeNext { // .next is the return type @@ -103,11 +106,10 @@ if (parameters) { t.parameters = parameters.copy(); - for (size_t i = 0; i < parameters.dim; i++) + foreach (arg; parameters) { - Argument arg = cast(Argument)parameters.data[i]; Argument cpy = arg.clone(); - t.parameters.data[i] = cast(void*)cpy; + t.parameters[i] = cpy; } } @@ -116,7 +118,7 @@ TypeFunction clone() { - assert(this.classinfo == TypeFunction.classinfo); + assert(this.classinfo is TypeFunction.classinfo); return cloneTo(new TypeFunction(null, next, varargs, linkage)); } } @@ -135,7 +137,7 @@ * as semantic() will get called again on this. */ - TypeFunction tf = cast(TypeFunction)clone(); + TypeFunction tf = cloneThis(this); if (sc.stc & STC.STCpure) tf.ispure = true; @@ -151,20 +153,23 @@ version(SARRAYVALUE) {} else { if (tf.next.toBasetype().ty == TY.Tsarray) - { error(loc, "functions cannot return static array %s", tf.next.toChars()); + { + error(loc, "functions cannot return static array %s", tf.next.toChars()); tf.next = Type.terror; } } if (tf.next.toBasetype().ty == TY.Tfunction) - { error(loc, "functions cannot return a function"); + { + error(loc, "functions cannot return a function"); tf.next = Type.terror; } if (tf.next.toBasetype().ty == TY.Ttuple) - { error(loc, "functions cannot return a tuple"); + { + error(loc, "functions cannot return a tuple"); tf.next = Type.terror; } if (tf.next.isauto() && !(sc.flags & SCOPE.SCOPEctor)) - error(loc, "functions cannot return scope %s", tf.next.toChars()); + error(loc, "functions cannot return scope %s", tf.next.toChars()); } if (tf.parameters) @@ -498,7 +503,7 @@ override TypeInfoDeclaration getTypeInfoDeclaration() { - assert(false); + return new TypeInfoFunctionDeclaration(this); } override Type reliesOnTident()