Mercurial > projects > dil
changeset 255:7ba0229af908
- Fixed parseTemplateArguments. Removed a return path and put the while loop into an if-statement.
author | aziz |
---|---|
date | Wed, 01 Aug 2007 19:27:02 +0000 |
parents | eb6e3f1fbfee |
children | 8f27920ae17a |
files | trunk/src/Parser.d trunk/src/Types.d |
diffstat | 2 files changed, 23 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/trunk/src/Parser.d Wed Aug 01 19:10:01 2007 +0000 +++ b/trunk/src/Parser.d Wed Aug 01 19:27:02 2007 +0000 @@ -3386,36 +3386,30 @@ auto args = new TemplateArguments; require(T.LParen); - if (token.type == T.RParen) - { - nT(); - return null; - } - - goto LenterLoop; - do + if (token.type != T.RParen) { - nT(); // Skip comma. - LenterLoop: - - bool success; - auto typeArgument = try_(parseType(), success); - - if (success) + while (1) { - // TemplateArgument: - // Type - // Symbol - args ~= typeArgument; + bool success; + auto typeArgument = try_(parseType(), success); + if (success) + { + // TemplateArgument: + // Type + // Symbol + args ~= typeArgument; + } + else + { + // TemplateArgument: + // AssignExpression + args ~= parseAssignExpression(); + } + if (token.type != T.Comma) + break; // Exit loop. + nT(); } - else - { - // TemplateArgument: - // AssignExpression - args ~= parseAssignExpression(); - } - } while (token.type == T.Comma) - + } require(T.RParen); set(args, begin); return args;
--- a/trunk/src/Types.d Wed Aug 01 19:10:01 2007 +0000 +++ b/trunk/src/Types.d Wed Aug 01 19:27:02 2007 +0000 @@ -140,7 +140,7 @@ Tuple } -class TemplateParameter +class TemplateParameter : Node { TP tp; Type valueType; @@ -149,6 +149,7 @@ Expression specValue, defValue; this(TP tp, Type valueType, Token* ident, Type specType, Type defType, Expression specValue, Expression defValue) { + super(NodeType.Other); this.tp = tp; this.valueType = valueType; this.ident = ident;