@Override public void exitCallStmt(ResolveParser.CallStmtContext ctx) { VCRuleBackedStat s = null; PApply callExp = (PApply) tr.exprASTs.get(ctx.progParamExp()); OperationSymbol op = getOperation(moduleScope, callExp); if (inSimpleForm(op.getEnsures(), op.getParameters())) { // TODO: Use log instead! // gen.getCompiler().info("APPLYING EXPLICIT (SIMPLE) CALL RULE"); s = new VCCall(ctx, assertiveBlocks.peek(), EXPLICIT_CALL_APPLICATION, callExp); } else { // TODO: Use log instead! // gen.getCompiler().info("APPLYING GENERAL CALL RULE"); s = new VCCall(ctx, assertiveBlocks.peek(), GENERAL_CALL_APPLICATION, callExp); } stats.put(ctx, s); }
@Override public void exitAssignStmt(ResolveParser.AssignStmtContext ctx) { VCRuleBackedStat s = new VCRuleBackedStat( ctx, assertiveBlocks.peek(), FUNCTION_ASSIGN_APPLICATION, tr.exprASTs.get(ctx.left), tr.exprASTs.get(ctx.right)); stats.put(ctx, s); }
private List<PExp> reduceArgs(List<ParserRuleContext> args) { List<PExp> result = new ArrayList<>(); for (ParserRuleContext arg : args) { PExp argAsPExp = tr.getMathExpASTFor(g, arg); if (argAsPExp instanceof PApply) { // i.e., we're dealing with a function application PExp e = applyCallRuleToExp(arg, assertiveBlocks.peek(), (PApply) argAsPExp); result.add(e); } else { result.add(argAsPExp); } } return result; }