Exemplo n.º 1
0
 @Override
 public void exitTypeImplInit(ResolveParser.TypeImplInitContext ctx) {
   PExp typeInitEnsures = g.getTrueExp();
   PExp convention = currentTypeReprSym.getConvention();
   PExp correspondence = currentTypeReprSym.getCorrespondence();
   if (currentTypeReprSym.getDefinition() != null) {
     typeInitEnsures =
         currentTypeReprSym.getDefinition().getProgramType().getInitializationEnsures();
   }
   VCAssertiveBlockBuilder block = assertiveBlocks.pop();
   PExp newInitEnsures =
       typeInitEnsures.substitute(
           currentTypeReprSym.exemplarAsPSymbol(),
           currentTypeReprSym.conceptualExemplarAsPSymbol());
   // block.stats(Utils.collect(VCRuleBackedStat.class, ctx.stmt(), stats));
   // block.confirm(convention);  //order here is important
   block.assume(correspondence);
   throw new UnsupportedOperationException("re-institute the final confirm for this dan");
   // block.finalConfirm(newInitEnsures, "Initialization-ensures clause of " +
   // currentTypeReprSym.getName());
   // outputFile.addAssertiveBlock(block.build());
 }
Exemplo n.º 2
0
  @Override
  public void exitTypeRepresentationDecl(ResolveParser.TypeRepresentationDeclContext ctx) {
    PExp constraint = g.getTrueExp();
    PExp correspondence = g.getTrueExp();
    if (currentTypeReprSym == null) return;
    correspondence = currentTypeReprSym.getCorrespondence();

    if (currentTypeReprSym.getDefinition() != null) {
      constraint = currentTypeReprSym.getDefinition().getProgramType().getConstraint();
    }
    VCAssertiveBlockBuilder block = assertiveBlocks.pop();
    PExp newConstraint =
        constraint.substitute(
            currentTypeReprSym.exemplarAsPSymbol(),
            currentTypeReprSym.conceptualExemplarAsPSymbol());
    newConstraint =
        newConstraint.withVCInfo(ctx.getStart(), "Constraint for type: " + ctx.name.getText());
    block.assume(correspondence.splitIntoConjuncts());
    // throw new UnsupportedOperationException("re-institute the final confirm for this dan");
    block.finalConfirm(newConstraint);
    outputFile.addAssertiveBlock(block.build());
  }