Ejemplo n.º 1
0
 public Interval <TKey, TValue>?Query(TKey at)
 {
     if (values != null)
     {
         return(values.Query(at));
     }
     return(value.start <= at && at <= value.end ? value : null);
 }
Ejemplo n.º 2
0
        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));
        }