# HG changeset patch # User korDen # Date 1271075373 -14400 # Node ID 427f8aa74d28bd62450c77a9626f0f92de69609f # Parent 832f71e6f96cb2e4bd5403f8b418b746cfe512ad On the road to make Phobos compilable diff -r 832f71e6f96c -r 427f8aa74d28 dmd/AssocArrayLiteralExp.d --- a/dmd/AssocArrayLiteralExp.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/AssocArrayLiteralExp.d Mon Apr 12 16:29:33 2010 +0400 @@ -19,13 +19,14 @@ class AssocArrayLiteralExp : Expression { Expressions keys; - Expressions values; this(Loc loc, Expressions keys, Expressions values) - { - assert(false); - super(loc, TOK.init, 0); + { + super(loc, TOKassocarrayliteral, AssocArrayLiteralExp.sizeof); + assert(keys.dim == values.dim); + this.keys = keys; + this.values = values; } Expression syntaxCopy() diff -r 832f71e6f96c -r 427f8aa74d28 dmd/AttribDeclaration.d --- a/dmd/AttribDeclaration.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/AttribDeclaration.d Mon Apr 12 16:29:33 2010 +0400 @@ -25,7 +25,7 @@ return decl; } - bool addMember(Scope sc, ScopeDsymbol sd, int memnum) + bool addMember(Scope sc, ScopeDsymbol sd, bool memnum) { bool m = false; Array d = include(sc, sd); diff -r 832f71e6f96c -r 427f8aa74d28 dmd/ClassDeclaration.d --- a/dmd/ClassDeclaration.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/ClassDeclaration.d Mon Apr 12 16:29:33 2010 +0400 @@ -565,7 +565,7 @@ for (i = 0; i < members.dim; i++) { Dsymbol s = cast(Dsymbol)members.data[i]; - s.addMember(sc, this, 1); + s.addMember(sc, this, true); } /* If this is a nested class, add the hidden 'this' @@ -733,7 +733,7 @@ CtorDeclaration ctor = new CtorDeclaration(loc, Loc(0), null, 0); ctor.fbody = new CompoundStatement(Loc(0), new Statements()); members.push(cast(void*)ctor); - ctor.addMember(sc, this, 1); + ctor.addMember(sc, this, true); sc = scsave; // why? What about sc.nofree? /// sc.offset = structsize; ctor.semantic(sc); diff -r 832f71e6f96c -r 427f8aa74d28 dmd/CompileDeclaration.d --- a/dmd/CompileDeclaration.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/CompileDeclaration.d Mon Apr 12 16:29:33 2010 +0400 @@ -1,6 +1,10 @@ module dmd.CompileDeclaration; import dmd.AttribDeclaration; +import dmd.WANT; +import dmd.TOK; +import dmd.StringExp; +import dmd.Parser; import dmd.Expression; import dmd.ScopeDsymbol; import dmd.Dsymbol; @@ -14,34 +18,72 @@ class CompileDeclaration : AttribDeclaration { Expression exp; - - ScopeDsymbol *sd; - int compiled; + ScopeDsymbol sd; + bool compiled; this(Loc loc, Expression exp) { - assert(false); super(null); + //printf("CompileDeclaration(loc = %d)\n", loc.linnum); + this.loc = loc; + this.exp = exp; + this.sd = null; + this.compiled = false; } - + Dsymbol syntaxCopy(Dsymbol s) { assert(false); } - - bool addMember(Scope sc, ScopeDsymbol sd, int memnum) + + bool addMember(Scope sc, ScopeDsymbol sd, bool memnum) { - assert(false); + //printf("CompileDeclaration.addMember(sc = %p, memnum = %d)\n", sc, memnum); + this.sd = sd; + if (!memnum) + { /* No members yet, so parse the mixin now + */ + compileIt(sc); + memnum = AttribDeclaration.addMember(sc, sd, memnum); + compiled = true; + } + return memnum; } - + void compileIt(Scope sc) { - assert(false); + //printf("CompileDeclaration.compileIt(loc = %d)\n", loc.linnum); + exp = exp.semantic(sc); + exp = resolveProperties(sc, exp); + exp = exp.optimize(WANTvalue | WANTinterpret); + if (exp.op != TOKstring) + { + exp.error("argument to mixin must be a string, not (%s)", exp.toChars()); + } + else + { + StringExp se = cast(StringExp)exp; + se = se.toUTF8(sc); + scope Parser p = new Parser(sc.module_, cast(ubyte*)se.string_, se.len, 0); + p.loc = loc; + p.nextToken(); + decl = p.parseDeclDefs(0); + if (p.token.value != TOKeof) + exp.error("incomplete mixin declaration (%s)", se.toChars()); + } } - + void semantic(Scope sc) { - assert(false); + //printf("CompileDeclaration.semantic()\n"); + + if (!compiled) + { + compileIt(sc); + AttribDeclaration.addMember(sc, sd, false); + compiled = true; + } + AttribDeclaration.semantic(sc); } void toCBuffer(OutBuffer buf, HdrGenState* hgs) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/CompileExp.d --- a/dmd/CompileExp.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/CompileExp.d Mon Apr 12 16:29:33 2010 +0400 @@ -11,9 +11,8 @@ class CompileExp : UnaExp { this(Loc loc, Expression e) - { - assert(false); - super(loc, TOK.init, 0, null); + { + super(loc, TOKmixin, CompileExp.sizeof, e); } Expression semantic(Scope sc) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/CompileStatement.d --- a/dmd/CompileStatement.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/CompileStatement.d Mon Apr 12 16:29:33 2010 +0400 @@ -14,8 +14,8 @@ this(Loc loc, Expression exp) { - assert(false); super(loc); + this.exp = exp; } Statement syntaxCopy() diff -r 832f71e6f96c -r 427f8aa74d28 dmd/ConditionalDeclaration.d --- a/dmd/ConditionalDeclaration.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/ConditionalDeclaration.d Mon Apr 12 16:29:33 2010 +0400 @@ -29,7 +29,14 @@ bool oneMember(Dsymbol* ps) { - assert(false); + //printf("ConditionalDeclaration.oneMember(), inc = %d\n", condition.inc); + if (condition.inc) + { + Array d = condition.include(null, null) ? decl : elsedecl; + return Dsymbol.oneMembers(d, ps); + } + *ps = null; + return true; } void emitComment(Scope sc) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/DebugSymbol.d --- a/dmd/DebugSymbol.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/DebugSymbol.d Mon Apr 12 16:29:33 2010 +0400 @@ -27,7 +27,7 @@ assert(false); } - bool addMember(Scope sc, ScopeDsymbol s, int memnum) + bool addMember(Scope sc, ScopeDsymbol s, bool memnum) { assert(false); } diff -r 832f71e6f96c -r 427f8aa74d28 dmd/DefaultInitExp.d --- a/dmd/DefaultInitExp.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/DefaultInitExp.d Mon Apr 12 16:29:33 2010 +0400 @@ -13,8 +13,8 @@ this(Loc loc, TOK subop, int size) { - assert(false); - super(loc, subop, size); + super(loc, TOKdefault, size); + this.subop = subop; } Expression resolve(Loc loc, Scope sc) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/Dsymbol.d --- a/dmd/Dsymbol.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/Dsymbol.d Mon Apr 12 16:29:33 2010 +0400 @@ -366,7 +366,7 @@ return this; } - bool addMember(Scope sc, ScopeDsymbol sd, int memnum) + bool addMember(Scope sc, ScopeDsymbol sd, bool memnum) { //printf("Dsymbol.addMember('%s')\n", toChars()); //printf("Dsymbol.addMember(this = %p, '%s' scopesym = '%s')\n", this, toChars(), sd.toChars()); diff -r 832f71e6f96c -r 427f8aa74d28 dmd/EnumDeclaration.d --- a/dmd/EnumDeclaration.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/EnumDeclaration.d Mon Apr 12 16:29:33 2010 +0400 @@ -231,13 +231,13 @@ { if (!scxx.scopesym.symtab) scxx.scopesym.symtab = new DsymbolTable(); - em.addMember(sce, scxx.scopesym, 1); + em.addMember(sce, scxx.scopesym, true); break; } } } else - em.addMember(sc, this, 1); + em.addMember(sc, this, true); /* Compute .min, .max and .default values. * If enum doesn't have a name, we can never identify the enum type, @@ -285,7 +285,9 @@ bool oneMember(Dsymbol* ps) { - assert(false); + if (isAnonymous()) + return Dsymbol.oneMembers(members, ps); + return Dsymbol.oneMember(ps); } void toCBuffer(OutBuffer buf, HdrGenState* hgs) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/FileInitExp.d --- a/dmd/FileInitExp.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/FileInitExp.d Mon Apr 12 16:29:33 2010 +0400 @@ -9,9 +9,8 @@ class FileInitExp : DefaultInitExp { this(Loc loc) - { - assert(false); - super(loc, TOK.init, 0); + { + super(loc, TOKfile, FileInitExp.sizeof); } Expression semantic(Scope sc) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/Import.d --- a/dmd/Import.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/Import.d Mon Apr 12 16:29:33 2010 +0400 @@ -279,7 +279,7 @@ /***************************** * Add import to sd's symbol table. */ - bool addMember(Scope sc, ScopeDsymbol sd, int memnum) + bool addMember(Scope sc, ScopeDsymbol sd, bool memnum) { bool result = false; diff -r 832f71e6f96c -r 427f8aa74d28 dmd/InterfaceDeclaration.d --- a/dmd/InterfaceDeclaration.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/InterfaceDeclaration.d Mon Apr 12 16:29:33 2010 +0400 @@ -224,7 +224,7 @@ for (i = 0; i < members.dim; i++) { Dsymbol s = cast(Dsymbol)members.data[i]; - s.addMember(sc, this, 1); + s.addMember(sc, this, true); } sc = sc.push(this); diff -r 832f71e6f96c -r 427f8aa74d28 dmd/IsExp.d --- a/dmd/IsExp.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/IsExp.d Mon Apr 12 16:29:33 2010 +0400 @@ -259,7 +259,7 @@ Dsymbol s = TemplateDeclaration.declareParameter(loc, sc, tp, o); } if (sc.sd) - s.addMember(sc, sc.sd, 1); + s.addMember(sc, sc.sd, true); } goto Lyes; @@ -305,7 +305,7 @@ if (!sc.insert(s)) error("declaration %s is already defined", s.toChars()); if (sc.sd) - s.addMember(sc, sc.sd, 1); + s.addMember(sc, sc.sd, true); } //printf("Lyes\n"); return new IntegerExp(loc, 1, Type.tbool); diff -r 832f71e6f96c -r 427f8aa74d28 dmd/LineInitExp.d --- a/dmd/LineInitExp.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/LineInitExp.d Mon Apr 12 16:29:33 2010 +0400 @@ -10,8 +10,7 @@ { this(Loc loc) { - assert(false); - super(loc, TOK.init, 0); + super(loc, TOKline, LineInitExp.sizeof); } Expression semantic(Scope sc) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/Module.d --- a/dmd/Module.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/Module.d Mon Apr 12 16:29:33 2010 +0400 @@ -702,7 +702,7 @@ for (i = 0; i < members.dim; i++) { Dsymbol s = cast(Dsymbol)members.data[i]; - s.addMember(null, sc.scopesym, 1); + s.addMember(null, sc.scopesym, true); } /* Set scope for the symbols so that if we forward reference diff -r 832f71e6f96c -r 427f8aa74d28 dmd/Parser.d --- a/dmd/Parser.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/Parser.d Mon Apr 12 16:29:33 2010 +0400 @@ -12,6 +12,7 @@ import dmd.CatAssignExp; import dmd.StaticIfCondition; import dmd.TraitsExp; +import dmd.TemplateMixin; import dmd.BaseClass; import dmd.AssignExp; import dmd.TemplateInstance; @@ -1076,9 +1077,96 @@ return tpl; } + /****************************************** + * Parse template mixin. + * mixin Foo; + * mixin Foo!(args); + * mixin a.b.c!(args).Foo!(args); + * mixin Foo!(args) identifier; + * mixin typeof(expr).identifier!(args); + */ Dsymbol parseMixin() { - assert(false); + TemplateMixin tm; + Identifier id; + Type tqual; + Objects tiargs; + Array idents; + + //printf("parseMixin()\n"); + nextToken(); + tqual = null; + if (token.value == TOKdot) + { + id = Id.empty; + } + else + { + if (token.value == TOKtypeof) + { + tqual = parseTypeof(); + check(TOKdot); + } + if (token.value != TOKidentifier) + { + error("identifier expected, not %s", token.toChars()); + id = Id.empty; + } + else + id = token.ident; + nextToken(); + } + + idents = new Array(); + while (1) + { + tiargs = null; + if (token.value == TOKnot) + { + nextToken(); + if (token.value == TOKlparen) + tiargs = parseTemplateArgumentList(); + else + tiargs = parseTemplateArgument(); + } + + if (token.value != TOKdot) + break; + + if (tiargs) + { + TemplateInstance tempinst = new TemplateInstance(loc, id); + tempinst.tiargs = tiargs; + id = cast(Identifier)tempinst; + tiargs = null; + } + idents.push(cast(void*)id); + + nextToken(); + if (token.value != TOKidentifier) + { + error("identifier expected following '.' instead of '%s'", token.toChars()); + break; + } + id = token.ident; + nextToken(); + } + idents.push(cast(void*)id); + + if (token.value == TOKidentifier) + { + id = token.ident; + nextToken(); + } + else + id = null; + + tm = new TemplateMixin(loc, id, tqual, idents, tiargs); + if (token.value != TOKsemicolon) + error("';' expected after mixin"); + nextToken(); + + return tm; } /****************************************** diff -r 832f71e6f96c -r 427f8aa74d28 dmd/Scope.d --- a/dmd/Scope.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/Scope.d Mon Apr 12 16:29:33 2010 +0400 @@ -99,7 +99,7 @@ while (m.parent !is null) m = m.parent; - m.addMember(null, sc.scopesym, 1); + m.addMember(null, sc.scopesym, true); m.parent = null; // got changed by addMember() // Create the module scope underneath the global scope diff -r 832f71e6f96c -r 427f8aa74d28 dmd/StaticAssert.d --- a/dmd/StaticAssert.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/StaticAssert.d Mon Apr 12 16:29:33 2010 +0400 @@ -31,7 +31,7 @@ assert(false); } - bool addMember(Scope sc, ScopeDsymbol sd, int memnum) + bool addMember(Scope sc, ScopeDsymbol sd, bool memnum) { return false; // we didn't add anything } @@ -83,7 +83,9 @@ bool oneMember(Dsymbol* ps) { - assert(false); + //printf("StaticAssert.oneMember())\n"); + *ps = null; + return true; } void toObjFile(int multiobj) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/StaticIfDeclaration.d --- a/dmd/StaticIfDeclaration.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/StaticIfDeclaration.d Mon Apr 12 16:29:33 2010 +0400 @@ -24,7 +24,7 @@ assert(false); } - bool addMember(Scope sc, ScopeDsymbol sd, int memnum) + bool addMember(Scope sc, ScopeDsymbol sd, bool memnum) { //printf("StaticIfDeclaration.addMember() '%s'\n",toChars()); /* This is deferred until semantic(), so that @@ -41,7 +41,7 @@ this.sd = sd; bool m = false; - if (memnum == 0) + if (!memnum) { m = AttribDeclaration.addMember(sc, sd, memnum); addisdone = 1; @@ -58,7 +58,7 @@ { if (!addisdone) { - AttribDeclaration.addMember(sc, sd, 1); + AttribDeclaration.addMember(sc, sd, true); addisdone = 1; } diff -r 832f71e6f96c -r 427f8aa74d28 dmd/StructDeclaration.d --- a/dmd/StructDeclaration.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/StructDeclaration.d Mon Apr 12 16:29:33 2010 +0400 @@ -145,7 +145,7 @@ { Dsymbol s = cast(Dsymbol)members.data[i]; //printf("adding member '%s' to '%s'\n", s.toChars(), this.toChars()); - s.addMember(sc, this, 1); + s.addMember(sc, this, true); if (s.isFuncDeclaration()) hasfunctions = 1; } @@ -266,7 +266,7 @@ ScopeDsymbol ss = fdx.parent.isScopeDsymbol(); assert(ss); ss.members.push(cast(void*)fdptr); - fdptr.addMember(sc, ss, 1); + fdptr.addMember(sc, ss, true); fdptr.semantic(sc2); } } @@ -517,7 +517,7 @@ fop.fbody = new CompoundStatement(Loc(0), s1, s2); members.push(cast(void*)fop); - fop.addMember(sc, this, 1); + fop.addMember(sc, this, true); sc = sc.push(); sc.stc = STC.STCundefined; diff -r 832f71e6f96c -r 427f8aa74d28 dmd/TemplateAliasParameter.d --- a/dmd/TemplateAliasParameter.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/TemplateAliasParameter.d Mon Apr 12 16:29:33 2010 +0400 @@ -11,6 +11,9 @@ import dmd.OutBuffer; import dmd.HdrGenState; import dmd.Dsymbol; +import dmd.TypeIdentifier; +import dmd.AliasDeclaration; +import dmd.Util; import dmd.templates.Util; @@ -52,12 +55,23 @@ void declareParameter(Scope sc) { - assert(false); + TypeIdentifier ti = new TypeIdentifier(loc, ident); + sparam = new AliasDeclaration(loc, ident, ti); + if (!sc.insert(sparam)) + error(loc, "parameter '%s' multiply defined", ident.toChars()); } - void semantic(Scope) + void semantic(Scope sc) { - assert(false); + if (specType) + { + specType = specType.semantic(loc, sc); + } + specAlias = aliasParameterSemantic(loc, sc, specAlias); +static if (false) { // Don't do semantic() until instantiation + if (defaultAlias) + defaultAlias = defaultAlias.semantic(loc, sc); +} } void print(Object oarg, Object oded) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/TemplateInstance.d --- a/dmd/TemplateInstance.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/TemplateInstance.d Mon Apr 12 16:29:33 2010 +0400 @@ -458,7 +458,7 @@ // Add members of template instance to template instance symbol table // parent = scope.scopesym; symtab = new DsymbolTable(); - int memnum = 0; + bool memnum = false; for (int i = 0; i < members.dim; i++) { Dsymbol s = cast(Dsymbol)members.data[i]; diff -r 832f71e6f96c -r 427f8aa74d28 dmd/TemplateMixin.d --- a/dmd/TemplateMixin.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/TemplateMixin.d Mon Apr 12 16:29:33 2010 +0400 @@ -18,8 +18,12 @@ this(Loc loc, Identifier ident, Type tqual, Array idents, Objects tiargs) { - assert(false); - super(loc, ident); + super(loc, cast(Identifier)idents.data[idents.dim - 1]); + //printf("TemplateMixin(ident = '%s')\n", ident ? ident.toChars() : ""); + this.ident = ident; + this.tqual = tqual; + this.idents = idents; + this.tiargs = tiargs ? tiargs : new Objects(); } Dsymbol syntaxCopy(Dsymbol s) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/TraitsExp.d --- a/dmd/TraitsExp.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/TraitsExp.d Mon Apr 12 16:29:33 2010 +0400 @@ -12,13 +12,13 @@ class TraitsExp : Expression { Identifier ident; - Objects args; this(Loc loc, Identifier ident, Objects args) - { - assert(false); - super(loc, TOK.init, 0); + { + super(loc, TOKtraits, TraitsExp.sizeof); + this.ident = ident; + this.args = args; } Expression syntaxCopy() diff -r 832f71e6f96c -r 427f8aa74d28 dmd/Tuple.d --- a/dmd/Tuple.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/Tuple.d Mon Apr 12 16:29:33 2010 +0400 @@ -5,7 +5,12 @@ class Tuple { Objects objects; - + + this() + { + objects = new Objects(); + } + int dyncast() { assert(false); diff -r 832f71e6f96c -r 427f8aa74d28 dmd/TupleDeclaration.d --- a/dmd/TupleDeclaration.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/TupleDeclaration.d Mon Apr 12 16:29:33 2010 +0400 @@ -17,8 +17,11 @@ this(Loc loc, Identifier ident, Objects objects) { - assert(false); super(ident); + this.type = null; + this.objects = objects; + this.isexp = 0; + this.tupletype = null; } Dsymbol syntaxCopy(Dsymbol) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/UAddExp.d --- a/dmd/UAddExp.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/UAddExp.d Mon Apr 12 16:29:33 2010 +0400 @@ -11,8 +11,7 @@ { this(Loc loc, Expression e) { - assert(false); - super(loc, TOK.init, 0, e); + super(loc, TOKuadd, UAddExp.sizeof, e); } Expression semantic(Scope sc) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/UnionDeclaration.d --- a/dmd/UnionDeclaration.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/UnionDeclaration.d Mon Apr 12 16:29:33 2010 +0400 @@ -9,7 +9,6 @@ { this(Loc loc, Identifier id) { - assert(false); super(loc, id); } diff -r 832f71e6f96c -r 427f8aa74d28 dmd/VersionSymbol.d --- a/dmd/VersionSymbol.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/VersionSymbol.d Mon Apr 12 16:29:33 2010 +0400 @@ -39,7 +39,7 @@ assert(false); } - bool addMember(Scope sc, ScopeDsymbol s, int memnum) + bool addMember(Scope sc, ScopeDsymbol s, bool memnum) { //printf("VersionSymbol::addMember('%s') %s\n", sd->toChars(), toChars()); diff -r 832f71e6f96c -r 427f8aa74d28 dmd/XorAssignExp.d --- a/dmd/XorAssignExp.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/XorAssignExp.d Mon Apr 12 16:29:33 2010 +0400 @@ -17,8 +17,7 @@ { this(Loc loc, Expression e1, Expression e2) { - assert(false); - super(loc, TOK.init, 0, e1, e2); + super(loc, TOKxorass, XorAssignExp.sizeof, e1, e2); } Expression semantic(Scope sc) diff -r 832f71e6f96c -r 427f8aa74d28 dmd/templates/Util.d --- a/dmd/templates/Util.d Mon Apr 12 15:13:00 2010 +0400 +++ b/dmd/templates/Util.d Mon Apr 12 16:29:33 2010 +0400 @@ -3,6 +3,9 @@ import dmd.Dsymbol; import dmd.Type; import dmd.Expression; +import dmd.Loc; +import dmd.Scope; +import dmd.WANT; version (DMDV2) { Object objectSyntaxCopy(Object o) @@ -20,4 +23,27 @@ return o; } +} + +Object aliasParameterSemantic(Loc loc, Scope sc, Object o) +{ + if (o) + { + Expression ea = isExpression(o); + Type ta = isType(o); + if (ta) + { + Dsymbol s = ta.toDsymbol(sc); + if (s) + o = s; + else + o = ta.semantic(loc, sc); + } + else if (ea) + { + ea = ea.semantic(sc); + o = ea.optimize(WANTvalue | WANTinterpret); + } + } + return o; } \ No newline at end of file