# HG changeset patch # User aziz # Date 1186572903 0 # Node ID a99357783c6f568a12d6630deef6fa4b59298a13 # Parent 833b301497f4a69ec090371f18cc10897e37b63d - Fix: assign targs to member targs of TraitsExpression. - Changed class FunctionLiteralExpression. Storing return type and parameters as members instead of funcType. Adapted parser accordingly. diff -r 833b301497f4 -r a99357783c6f trunk/src/Expressions.d --- a/trunk/src/Expressions.d Wed Aug 08 10:46:02 2007 +0000 +++ b/trunk/src/Expressions.d Wed Aug 08 11:35:03 2007 +0000 @@ -775,16 +775,27 @@ class FunctionLiteralExpression : Expression { - FunctionType funcType; + Type returnType; + Parameters parameters; FunctionBody funcBody; - TOK funcTok; - this(FunctionType funcType, FunctionBody funcBody, TOK funcTok = TOK.Invalid) + this() { mixin(set_kind); - this.funcType = funcType; + } + + this(Type returnType, Parameters parameters, FunctionBody funcBody) + { + this(); + this.returnType = returnType; + this.parameters = parameters; this.funcBody = funcBody; - this.funcTok = funcTok; + } + + this(FunctionBody funcBody) + { + this(); + this.funcBody = funcBody; } } @@ -798,6 +809,7 @@ { mixin(set_kind); this.ident = ident; + this.targs = targs; } } } diff -r 833b301497f4 -r a99357783c6f trunk/src/Parser.d --- a/trunk/src/Parser.d Wed Aug 08 10:46:02 2007 +0000 +++ b/trunk/src/Parser.d Wed Aug 08 11:35:03 2007 +0000 @@ -3390,13 +3390,11 @@ break; case T.LBrace: // DelegateLiteral := { Statements } -// auto funcType = new FunctionType(null, Parameters.init); auto funcBody = parseFunctionBody(); - e = new FunctionLiteralExpression(null, funcBody); + e = new FunctionLiteralExpression(funcBody); break; case T.Function, T.Delegate: // FunctionLiteral := (function|delegate) Type? '(' ArgumentList ')' '{' Statements '}' -// TOK funcTok = token.type; nT(); // Skip function|delegate token. Type returnType; Parameters parameters; @@ -3406,9 +3404,8 @@ returnType = parseType(); parameters = parseParameterList(); } - auto funcType = new FunctionType(returnType, parameters); auto funcBody = parseFunctionBody(); - e = new FunctionLiteralExpression(funcType, funcBody/+, funcTok+/); + e = new FunctionLiteralExpression(returnType, parameters, funcBody); break; case T.Assert: Expression msg; @@ -3498,9 +3495,8 @@ { auto parameters = parseParameterList(); // ( ParameterList ) FunctionBody - auto funcType = new FunctionType(null, parameters); auto funcBody = parseFunctionBody(); - e = new FunctionLiteralExpression(funcType, funcBody); + e = new FunctionLiteralExpression(null, parameters, funcBody); } else {