Mercurial > projects > dil
changeset 292:076152e945e0
- Added member Node[] children to class Node.
- Assigning to Node.children in several constructors that inherit from Node.
author | aziz |
---|---|
date | Thu, 09 Aug 2007 11:13:04 +0000 |
parents | c0e857931ff6 |
children | 418c6548ce17 |
files | trunk/src/Declarations.d trunk/src/Parser.d trunk/src/SyntaxTree.d |
diffstat | 3 files changed, 42 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/Declarations.d Wed Aug 08 12:04:01 2007 +0000 +++ b/trunk/src/Declarations.d Thu Aug 09 11:13:04 2007 +0000 @@ -30,12 +30,12 @@ class IllegalDeclaration : Declaration { - TOK tok; - this(TOK tok) + Token* token; + this(Token* token) { super(false); mixin(set_kind); - this.tok = tok; + this.token = token; } } @@ -76,6 +76,7 @@ { super(false); mixin(set_kind); + this.children = [decl]; this.decl = decl; } } @@ -87,6 +88,7 @@ { super(false); mixin(set_kind); + this.children = [decl]; this.decl = decl; } } @@ -101,6 +103,7 @@ { super(hasBody); mixin(set_kind); + this.children = values; this.name = name; this.baseType = baseType; this.members = members; @@ -118,6 +121,7 @@ { super(hasBody); mixin(set_kind); + this.children = [tparams] ~ cast(Node[])bases ~ decls; this.name = name; this.tparams = tparams; this.bases = bases; @@ -135,6 +139,7 @@ { super(hasBody); mixin(set_kind); + this.children = [tparams] ~ cast(Node[])bases ~ decls; this.name = name; this.tparams = tparams; this.bases = bases; @@ -151,6 +156,7 @@ { super(hasBody); mixin(set_kind); + this.children = [tparams] ~ cast(Node[])decls; this.name = name; this.tparams = tparams; this.decls = decls; @@ -166,6 +172,7 @@ { super(hasBody); mixin(set_kind); + this.children = [tparams] ~ cast(Node[])decls; this.name = name; this.tparams = tparams; this.decls = decls; @@ -180,6 +187,7 @@ { super(true); mixin(set_kind); + this.children = [cast(Node)parameters, funcBody]; this.parameters = parameters; this.funcBody = funcBody; } @@ -192,6 +200,7 @@ { super(true); mixin(set_kind); + this.children = [funcBody]; this.funcBody = funcBody; } } @@ -203,6 +212,7 @@ { super(true); mixin(set_kind); + this.children = [funcBody]; this.funcBody = funcBody; } } @@ -214,6 +224,7 @@ { super(true); mixin(set_kind); + this.children = [funcBody]; this.funcBody = funcBody; } } @@ -229,6 +240,7 @@ { super(funcBody.funcBody !is null); mixin(set_kind); + this.children = [cast(Node)returnType, tparams, params, funcBody]; this.returnType = returnType; this.funcName = funcName; this.tparams = tparams; @@ -246,6 +258,7 @@ { super(false); mixin(set_kind); + this.children = [type] ~ cast(Node[])values; this.type = type; this.idents = idents; this.values = values; @@ -259,6 +272,7 @@ { super(true); mixin(set_kind); + this.children = [funcBody]; this.funcBody = funcBody; } } @@ -270,6 +284,7 @@ { super(true); mixin(set_kind); + this.children = [funcBody]; this.funcBody = funcBody; } } @@ -284,6 +299,7 @@ { super(decls.length != 0); mixin(set_kind); + this.children = decls ~ elseDecls; this.spec = spec; this.cond = cond; this.decls = decls; @@ -301,6 +317,7 @@ { super(decls.length != 0); mixin(set_kind); + this.children = decls ~ elseDecls; this.spec = spec; this.cond = cond; this.decls = decls; @@ -316,6 +333,7 @@ { super(true); mixin(set_kind); + this.children = [condition] ~ cast(Node[])(ifDecls ~ elseDecls); this.condition = condition; this.ifDecls = ifDecls; this.elseDecls = elseDecls; @@ -329,6 +347,7 @@ { super(true); mixin(set_kind); + this.children = [condition, message]; this.condition = condition; this.message = message; } @@ -336,15 +355,16 @@ class TemplateDeclaration : Declaration { - Token* templateName; - TemplateParameters templateParams; + Token* name; + TemplateParameters tparams; Declaration[] decls; - this(Token* templateName, TemplateParameters templateParams, Declaration[] decls) + this(Token* name, TemplateParameters tparams, Declaration[] decls) { super(true); mixin(set_kind); - this.templateName = templateName; - this.templateParams = templateParams; + this.children = [tparams] ~ cast(Node[])decls; + this.name = name; + this.tparams = tparams; this.decls = decls; } } @@ -357,6 +377,7 @@ { super(true); mixin(set_kind); + this.children = [cast(Node)parameters, funcBody]; this.parameters = parameters; this.funcBody = funcBody; } @@ -370,6 +391,7 @@ { super(true); mixin(set_kind); + this.children = [cast(Node)parameters, funcBody]; this.parameters = parameters; this.funcBody = funcBody; } @@ -383,6 +405,7 @@ { super(true); mixin(set_kind); + this.children = decls; this.attribute = attribute; this.decls = decls; } @@ -418,6 +441,7 @@ { super(TOK.Pragma, decls); mixin(set_kind); + this.children ~= args; this.ident = ident; this.args = args; } @@ -425,20 +449,22 @@ class MixinDeclaration : Declaration { - Expression[] templateIdent; + Expression[] templateIdents; Token* mixinIdent; - Expression assignExpr; // mixin ( AssignExpression ) - this(Expression[] templateIdent, Token* mixinIdent) + Expression argument; // mixin ( AssignExpression ) + this(Expression[] templateIdents, Token* mixinIdent) { super(false); mixin(set_kind); - this.templateIdent = templateIdent; + this.children = templateIdents; + this.templateIdents = templateIdents; this.mixinIdent = mixinIdent; } - this(Expression assignExpr) + this(Expression argument) { super(false); mixin(set_kind); - this.assignExpr = assignExpr; + this.children = [argument]; + this.argument = argument; } }
--- a/trunk/src/Parser.d Wed Aug 08 12:04:01 2007 +0000 +++ b/trunk/src/Parser.d Thu Aug 09 11:13:04 2007 +0000 @@ -290,7 +290,7 @@ default: // TODO: issue error msg. error(MID.ExpectedButFound, "Declaration", token.srcText); - decl = new IllegalDeclaration(token.type); + decl = new IllegalDeclaration(token); nT(); } // writef("§%s§", decl.classinfo.name);