Пример #1
0
 public List<ModuleParameterSymbol> getAllModuleParameterSyms() {
   List<ModuleParameterSymbol> result = moduleScope.getSymbolsOfType(ModuleParameterSymbol.class);
   for (ModuleIdentifier e : moduleScope.getInheritedIdentifiers()) {
     try {
       ModuleScopeBuilder s = symtab.getModuleScope(e);
       result.addAll(s.getSymbolsOfType(ModuleParameterSymbol.class));
     } catch (NoSuchModuleException e1) { // should've been caught a long time ago
       throw new RuntimeException(e1);
     }
   }
   return result;
 }
Пример #2
0
 private Set<PExp> getModuleLevelAssertionsOfType(ClauseType type) {
   Set<PExp> result = new LinkedHashSet<>();
   List<GlobalMathAssertionSymbol> assertions = new LinkedList<>();
   List<FacilitySymbol> facilities = new LinkedList<>();
   try {
     assertions.addAll(
         moduleScope
             .query(
                 new SymbolTypeQuery<GlobalMathAssertionSymbol>(GlobalMathAssertionSymbol.class))
             .stream()
             .filter(e -> e.getClauseType() == type)
             .collect(Collectors.toList()));
     facilities.addAll(
         moduleScope.query(new SymbolTypeQuery<FacilitySymbol>(FacilitySymbol.class)));
   } catch (NoSuchModuleException | UnexpectedSymbolException e) {
   }
   return assertions
       .stream()
       .map(assertion -> substituteByFacilities(facilities, assertion))
       .collect(Collectors.toSet());
 }
Пример #3
0
  @Override
  public void enterTypeRepresentationDecl(ResolveParser.TypeRepresentationDeclContext ctx) {
    Scope s = symtab.getScope(ctx);
    currentTypeReprSym = null;
    try {
      currentTypeReprSym =
          moduleScope
              .queryForOne(new UnqualifiedNameQuery(ctx.name.getText()))
              .toProgReprTypeSymbol();
    } catch (SymbolTableException e) {
    }
    List<PExp> opParamAntecedents =
        getAssertionsFromModuleFormalParameters(
            getAllModuleParameterSyms(), this::extractAssumptionsFromParameter);

    VCAssertiveBlockBuilder block =
        new VCAssertiveBlockBuilder(g, s, "Well_Def_Corr_Hyp=" + ctx.name.getText(), ctx)
            .assume(opParamAntecedents)
            .assume(getModuleLevelAssertionsOfType(ClauseType.REQUIRES))
            .assume(currentTypeReprSym.getConvention());
    assertiveBlocks.push(block);
  }