public SymbolTable( CompilationUnit compilationUnit, IDictionary <AstElement, ILocalizableSymbol> declarations, IDictionary <ISymbol, SymbolLocation> locations, IIntervalTree <Position, ILocalizableSymbol> lookupTree, bool symbolsResolved ) { CompilationUnit = compilationUnit; Declarations = declarations; Locations = locations; LookupTree = lookupTree; Resolved = symbolsResolved; _typeResolver = new DafnyLangTypeResolver(declarations); // TODO IntervalTree goes out of sync after any change and "fixes" its state upon the first query. Replace it with another implementation that can be queried without potential side-effects. LookupTree.Query(new Position(0, 0)); }
public IEnumerable <DocumentSymbol> Visit(CompilationUnit compilationUnit) { return(compilationUnit.Children.SelectMany(Visit).ToArray()); }
private static IDictionary <AstElement, ILocalizableSymbol> CreateDeclarationDictionary(CompilationUnit compilationUnit, CancellationToken cancellationToken) { var declarations = new Dictionary <AstElement, ILocalizableSymbol>(); foreach (var symbol in compilationUnit.GetAllDescendantsAndSelf()) { cancellationToken.ThrowIfCancellationRequested(); if (symbol is ILocalizableSymbol localizableSymbol) { // TODO we're using try-add since it appears that nodes of the System module are re-used accross several builtins. // TODO Maybe refine the mapping of the "declarations". declarations.TryAdd(localizableSymbol.Node, localizableSymbol); } } return(declarations); }
public Unit Visit(CompilationUnit compilationUnit) { VisitChildren(compilationUnit); return(Unit.Value); }