// We only need Lookup() during the resolve phase (because that's the only time // we need to convert text into symbols) // After that, we can just use the symbols directly // Lookup an entry in a specific scope // If it doesn't exist, then return null if !fMustExist and throw if fMustExist public SymEntry LookupSymbol(Scope scope, Identifier id, bool fMustExist) { SymEntry s = scope.LookupSymbol(id.Text); if (fMustExist && s == null) { ThrowError(SymbolError.UndefinedSymbol(id)); } return s; }
// Get rid of this function public SymEntry LookupSymbol(Scope scope, string st, bool fMustExist) { SymEntry s = scope.LookupSymbol(st); bool f= false; if (f) { System.Xml.XmlWriter o = new System.Xml.XmlTextWriter(new System.IO.StreamWriter("dump.xml")); scope.Dump(o, true); o.Close(); } if (fMustExist && s == null) { FileRange range = new FileRange(); range.Filename = "<not specified>"; Identifier id = new Identifier(st, range); //ThrowError_UndefinedSymbol(id); ThrowError(SymbolError.UndefinedSymbol(id)); } return s; }