# HG changeset patch # User Aziz K?ksal # Date 1197239260 -3600 # Node ID 949a53332c6640bf52af7257d08275f5077120c2 # Parent 41b7f9e439bd786f464637e0e00f0e4af0cdb1a6 Fixed parsing of AutoDeclarations. diff -r 41b7f9e439bd -r 949a53332c66 trunk/src/dil/Parser.d --- a/trunk/src/dil/Parser.d Sun Dec 09 23:16:12 2007 +0100 +++ b/trunk/src/dil/Parser.d Sun Dec 09 23:27:40 2007 +0100 @@ -426,6 +426,7 @@ Declaration parseVariableOrFunction(StorageClass stc = StorageClass.None, Protection protection = Protection.None, LinkageType linkType = LinkageType.None, + bool testAutoDeclaration = false, bool optionalParameterList = true) { auto begin = token; @@ -433,7 +434,7 @@ Token* ident; // Check for AutoDeclaration: StorageClasses Identifier = - if (stc != StorageClass.None && + if (testAutoDeclaration && token.type == T.Identifier && peekNext() == T.Assign) { @@ -815,7 +816,7 @@ case T.Identifier: case_Declaration: // This could be a normal Declaration or an AutoDeclaration - decl = parseVariableOrFunction(stc, this.protection, prev_linkageType); + decl = parseVariableOrFunction(stc, this.protection, prev_linkageType, true); break; default: this.storageClass = stc; // Set. @@ -1740,7 +1741,9 @@ case T.Dot, T.Typeof: bool success; d = try_(delegate { - return parseVariableOrFunction(StorageClass.None, Protection.None, LinkageType.None, false); + return parseVariableOrFunction(StorageClass.None, + Protection.None, + LinkageType.None, false, false); }, success ); if (success) @@ -2073,7 +2076,7 @@ //case T.Class: default: case_Declaration: - return parseVariableOrFunction(stc, Protection.None, prev_linkageType); + return parseVariableOrFunction(stc, Protection.None, prev_linkageType, true); } return set(d, begin); }