public static String getImplicitOperationString( AImplicitOperationDefinition d) { return d.getName() + Utils.listToString("(", d.getParameterPatterns(), ", ", ")") + (d.getResult() == null ? "" : " " + d.getResult()) + (d.getExternals().isEmpty() ? "" : "\n\text " + d.getExternals()) + (d.getPrecondition() == null ? "" : "\n\tpre " + d.getPrecondition()) + (d.getPostcondition() == null ? "" : "\n\tpost " + d.getPostcondition()) + (d.getErrors().isEmpty() ? "" : "\n\terrs " + d.getErrors()); }
public OperationPostConditionObligation(AImplicitOperationDefinition op, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(op, POType.OP_POST_CONDITION, ctxt, op.getLocation(), af); stitch = buildExp(op.getPrecondition(), op.getPostcondition().clone(), op.clone().getErrors()); valuetree.setPredicate(ctxt.getPredWithContext(stitch)); }
List<AErrorCase> copy = new ArrayList<AErrorCase>(node.getErrors()); for( AErrorCase e : copy)
List<AErrorCase> copy = new ArrayList<AErrorCase>(node.getErrors()); for( AErrorCase e : copy)
List<AErrorCase> copy = new ArrayList<AErrorCase>(node.getErrors()); for( AErrorCase e : copy)
@SuppressWarnings("unchecked") public AExplicitFunctionDefinition getPreDefinition( AImplicitOperationDefinition d, Environment base) { List<List<PPattern>> parameters = new Vector<List<PPattern>>(); List<PPattern> plist = new Vector<PPattern>(); for (APatternListTypePair pl : (LinkedList<APatternListTypePair>) d.getParameterPatterns()) { plist.addAll((Collection<PPattern>) pl.getPatterns().clone()); } AStateDefinition state = d.getState(); if (state != null) { plist.add(AstFactory.newAIdentifierPattern(state.getName().clone())); } else if (base.isVDMPP() && !af.createPAccessSpecifierAssistant().isStatic(d.getAccess())) { plist.add(AstFactory.newAIdentifierPattern(d.getName().getSelfName())); } parameters.add(plist); PExp preop = AstFactory.newAPreOpExp(d.getName().clone(), d.getPrecondition(), d.getErrors(), d.getState()); AExplicitFunctionDefinition def = AstFactory.newAExplicitFunctionDefinition(d.getName().getPreName(d.getPrecondition().getLocation()), NameScope.GLOBAL, null, af.createAOperationTypeAssistant().getPreType((AOperationType) d.getType(), state, d.getClassDefinition(), af.createPAccessSpecifierAssistant().isStatic(d.getAccess())), parameters, preop, null, null, false, null); // Operation precondition functions are effectively not static as // their expression can directly refer to instance variables, even // though at runtime these are passed via a "self" parameter. def.setAccess(af.createPAccessSpecifierAssistant().getStatic(d, false)); def.setClassDefinition(d.getClassDefinition()); return def; }
PExp postop = AstFactory.newAPostOpExp(d.getName().clone(), d.getPrecondition(), d.getPostcondition(), d.getErrors(), d.getState());
List<AErrorCase> copy = new ArrayList<AErrorCase>(node.getErrors()); for( AErrorCase e : copy)
List<AErrorCase> copy = new ArrayList<AErrorCase>(node.getErrors()); for( AErrorCase e : copy)