Mercurial > projects > ddmd
view dmd/FuncLiteralDeclaration.d @ 0:10317f0c89a5
Initial commit
author | korDen |
---|---|
date | Sat, 24 Oct 2009 08:42:06 +0400 |
parents | |
children | 51605de93870 |
line wrap: on
line source
module dmd.FuncLiteralDeclaration; import dmd.FuncDeclaration; import dmd.TOK; import dmd.Loc; import dmd.Type; import dmd.ForeachStatement; import dmd.OutBuffer; import dmd.HdrGenState; import dmd.Dsymbol; import dmd.STC; import dmd.Lexer; class FuncLiteralDeclaration : FuncDeclaration { TOK tok; // TOKfunction or TOKdelegate this(Loc loc, Loc endloc, Type type, TOK tok, ForeachStatement fes) { super(loc, endloc, null, STC.STCundefined, type); string id; if (fes) id = "__foreachbody"; else if (tok == TOK.TOKdelegate) id = "__dgliteral"; else id = "__funcliteral"; this.ident = Lexer.uniqueId(id); this.tok = tok; this.fes = fes; //printf("FuncLiteralDeclaration() id = '%s', type = '%s'\n", this->ident->toChars(), type->toChars()); } void toCBuffer(OutBuffer buf, HdrGenState* hgs) { assert(false); } Dsymbol syntaxCopy(Dsymbol) { assert(false); } bool isNested() { //printf("FuncLiteralDeclaration::isNested() '%s'\n", toChars()); return (tok == TOK.TOKdelegate); } bool isVirtual() { return false; } FuncLiteralDeclaration isFuncLiteralDeclaration() { return this; } string kind() { return (tok == TOKdelegate) ? "delegate" : "function"; } }