# HG changeset patch # User Aziz K?ksal # Date 1198961853 -3600 # Node ID 86fa0d36da51ab7c23823003e6889b3470217bae # Parent c8861b452eb3992f09014b6a3087b9e4fd68911a Reporting location of symbol conflict error more accurately. diff -r c8861b452eb3 -r 86fa0d36da51 trunk/src/dil/Location.d --- a/trunk/src/dil/Location.d Sat Dec 29 21:10:34 2007 +0100 +++ b/trunk/src/dil/Location.d Sat Dec 29 21:57:33 2007 +0100 @@ -85,4 +85,5 @@ } return col; } + alias calculateColumn colNum; } diff -r c8861b452eb3 -r 86fa0d36da51 trunk/src/dil/Scope.d --- a/trunk/src/dil/Scope.d Sat Dec 29 21:10:34 2007 +0100 +++ b/trunk/src/dil/Scope.d Sat Dec 29 21:57:33 2007 +0100 @@ -43,7 +43,11 @@ { auto sym = symbol.lookup(var.ident); if (sym) - error("variable '"~var.ident.str~"' conflicts with another definition in its scope"); + { + auto loc = sym.node.begin.getLocation(); + auto locString = Format("{}({},{})", loc.filePath, loc.lineNum, loc.colNum); + error(var.node.begin, "variable '"~var.ident.str~"' conflicts with symbol @"~locString); + } else symbol.insert(var, var.ident); } @@ -102,9 +106,9 @@ infoMan ~= new SemanticError(location, GetMsg(mid)); } - void error(char[] msg) + void error(Token* token, char[] msg) { - auto location = new Location("", 0); + auto location = token.getLocation(); infoMan ~= new SemanticError(location, msg); } }