public bool TestForDefineErrors(Symbol sym, IScope currentScope) { string location = string.Empty; if (sym.Def != null) { location = "line " + sym.Def.Line + ":" + sym.Def.CharPositionInLine + " "; } if (currentScope.IsDefinedLocally(sym.Name)) { _listener.Error(location + "Symbol '" + sym.Name + "' already defined" ); return(true); } if (currentScope.ScopeName == "local") { //if we're in a local scope, travel up until we hit a function def scope //or an event def scope and make sure we're not shadowing any parameters //if we are, issue a warning if (FindSymbolInMethodScope(sym, currentScope) != null) { _listener.Info(location + "Symbol '" + sym.Name + "' shadows parameter of the same name" ); } } return(false); }
public override void Write(string value) { if (_lineSoFar.Length > 0) { _listener.Error(_lineSoFar.ToString() + value); _lineSoFar.Length = 0; } else { _listener.Info(value); } }