diff -r bab29bcec7fe -r eee18bf13c9b src/Parser.cpp --- a/src/Parser.cpp Sun Sep 16 21:34:10 2012 -0700 +++ b/src/Parser.cpp Sun Sep 16 21:59:18 2012 -0700 @@ -865,18 +865,13 @@ if (!name) return NULL; + SourcePosition pos = scanner_.begin(); + if (BoundName *other = scope_->localLookup(name)) { redeclarationError(other); return NULL; } - Variable *var = scope_->declareVariable(name, scanner_.begin()); - if (!var) - return NULL; - - if (scope == TOK_PUBLIC) - var->setPublic(); - ExpressionList *postDimensions = NULL; if (peek(TOK_LBRACKET)) { if ((postDimensions = dimensions()) == NULL) @@ -899,6 +894,13 @@ } } + Variable *var = scope_->declareVariable(name, pos); + if (!var) + return NULL; + + if (scope == TOK_PUBLIC) + var->setPublic(); + return new (pool_) VariableDeclaration(var->pos(), kind, var, type, postDimensions, expr); }