Mercurial > projects > dil
changeset 267:f3dfa6208ed3
- Removed parameter func from parseFunctionBody(). Creating new FunctionBody inside the method.
author | aziz |
---|---|
date | Sat, 04 Aug 2007 10:55:05 +0000 |
parents | fea4e8b6cea5 |
children | c19b68a4e3db |
files | trunk/src/Parser.d |
diffstat | 1 files changed, 14 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/Parser.d Sat Aug 04 10:46:03 2007 +0000 +++ b/trunk/src/Parser.d Sat Aug 04 10:55:05 2007 +0000 @@ -347,7 +347,7 @@ // ReturnType FunctionName ( ParameterList ) type = new FunctionType(type, params, tparams); // type = parseDeclaratorSuffix(type); - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); return new FunctionDeclaration(ident, type, null, funcBody); } type = parseDeclaratorSuffix(type); @@ -474,8 +474,9 @@ return init; } - FunctionBody parseFunctionBody(FunctionBody func) + FunctionBody parseFunctionBody() { + auto func = new FunctionBody; while (1) { switch (token.type) @@ -1018,7 +1019,7 @@ assert(token.type == T.This); nT(); // Skip 'this' keyword. auto parameters = parseParameterList(); - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); return new ConstructorDeclaration(parameters, funcBody); } @@ -1029,7 +1030,7 @@ require(T.This); require(T.LParen); require(T.RParen); - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); return new DestructorDeclaration(funcBody); } @@ -1040,7 +1041,7 @@ nT(); // Skip 'this' keyword. require(T.LParen); require(T.RParen); - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); return new StaticConstructorDeclaration(funcBody); } @@ -1052,7 +1053,7 @@ require(T.This); require(T.LParen); require(T.RParen); - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); return new StaticDestructorDeclaration(funcBody); } @@ -1063,7 +1064,7 @@ // Optional () for getting ready porting to D 2.0 if (token.type == T.LParen) requireNext(T.RParen); - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); return new InvariantDeclaration(funcBody); } @@ -1072,7 +1073,7 @@ assert(token.type == T.Unittest); nT(); // Skip unittest keyword. - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); return new UnittestDeclaration(funcBody); } @@ -1264,7 +1265,7 @@ assert(token.type == T.New); nT(); // Skip new keyword. auto parameters = parseParameterList(); - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); return new NewDeclaration(parameters, funcBody); } @@ -1274,7 +1275,7 @@ nT(); // Skip delete keyword. auto parameters = parseParameterList(); // TODO: only one parameter of type void* allowed. Check in parsing or semantic phase? - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); return new DeleteDeclaration(parameters, funcBody); } @@ -2916,7 +2917,7 @@ case T.LBrace: // DelegateLiteral := { Statements } // auto funcType = new FunctionType(null, Parameters.init); - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); e = new FunctionLiteralExpression(null, funcBody); break; case T.Function, T.Delegate: @@ -2932,7 +2933,7 @@ parameters = parseParameterList(); } auto funcType = new FunctionType(returnType, parameters); - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); e = new FunctionLiteralExpression(funcType, funcBody/+, funcTok+/); break; case T.Assert: @@ -3024,7 +3025,7 @@ auto parameters = parseParameterList(); // ( ParameterList ) FunctionBody auto funcType = new FunctionType(null, parameters); - auto funcBody = parseFunctionBody(new FunctionBody); + auto funcBody = parseFunctionBody(); e = new FunctionLiteralExpression(funcType, funcBody); } else