Mercurial > projects > dil
changeset 290:7933a0c17c9f
- Changed class FunctionDeclaration. Parses passes return type, function name, template parameters, normal parameters and function body to constructor.
author | aziz |
---|---|
date | Wed, 08 Aug 2007 11:54:03 +0000 |
parents | a99357783c6f |
children | c0e857931ff6 |
files | trunk/src/Declarations.d trunk/src/Parser.d |
diffstat | 2 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/Declarations.d Wed Aug 08 11:35:03 2007 +0000 +++ b/trunk/src/Declarations.d Wed Aug 08 11:54:03 2007 +0000 @@ -220,16 +220,19 @@ class FunctionDeclaration : Declaration { + Type returnType; Token* funcName; - Type funcType; TemplateParameters tparams; + Parameters params; FunctionBody funcBody; - this(Token* funcName, Type funcType, TemplateParameters tparams, FunctionBody funcBody) + this(Type returnType, Token* funcName, TemplateParameters tparams, Parameters params, FunctionBody funcBody) { super(funcBody.funcBody !is null); mixin(set_kind); + this.returnType = returnType; this.funcName = funcName; - this.funcType = funcType; + this.tparams = tparams; + this.params = params; this.funcBody = funcBody; } }
--- a/trunk/src/Parser.d Wed Aug 08 11:35:03 2007 +0000 +++ b/trunk/src/Parser.d Wed Aug 08 11:54:03 2007 +0000 @@ -341,12 +341,9 @@ { type = parseType(); ident = requireId(); -// writefln("trying=%s,errorCount=%d", trying, errorCount); -// writefln("ident=%s", ident); // Type FunctionName ( ParameterList ) FunctionBody if (token.type == T.LParen) { -// writef("°Function°"); // It's a function declaration TemplateParameters tparams; if (tokenAfterParenIs(T.LParen)) @@ -357,10 +354,8 @@ auto params = parseParameterList(); // ReturnType FunctionName ( ParameterList ) - type = new FunctionType(type, params, tparams); -// type = parseDeclaratorSuffix(type); auto funcBody = parseFunctionBody(); - return new FunctionDeclaration(ident, type, null, funcBody); + return new FunctionDeclaration(type, ident, tparams, params, funcBody); } type = parseDeclaratorSuffix(type); }