private static SymbolLocation?ComputeNewSymbolLocation(SymbolLocation oldLocation, Range changeRange, Position afterChangeEndOffset) { var identifier = ComputeNewRange(oldLocation.Name, changeRange, afterChangeEndOffset); if (identifier == null) { return(null); } var declaration = ComputeNewRange(oldLocation.Declaration, changeRange, afterChangeEndOffset); if (declaration == null) { return(null); } return(new SymbolLocation(oldLocation.Uri, identifier, declaration)); }
// The assertion Assert.IsFalse(document.SymbolTable.Resolved) is used to ensure that // we're working on a migrated symbol table. If that's not the case, the test case has // to be adapted. // TODO The Declaration Range currently does not incorporate keywords such as "class" and "var". // TODO The "BodyEndToken" used by the CreateDeclarationDictionary.CreateDeclarationDictionary() // does not incorporate the closing braces. private bool TryFindSymbolDeclarationByName(DafnyDocument document, string symbolName, out SymbolLocation location) { location = document.SymbolTable.Locations .WithCancellation(CancellationToken) .Where(entry => entry.Key.Name == symbolName) .Select(entry => entry.Value) .SingleOrDefault(); return(location != null); }