public SatisfiabilityObligation(ATypeDefinition node, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(node, POType.TYPE_INV_SAT, ctxt, node.getLocation(), af); AExistsExp exists_exp = new AExistsExp(); exists_exp.setType(new ABooleanBasicType()); ATypeMultipleBind tmb = new ATypeMultipleBind(); List<PPattern> pats = new LinkedList<PPattern>(); pats.add(node.getInvPattern().clone()); tmb.setPlist(pats); tmb.setType(node.getInvType().clone()); List<PMultipleBind> binds = new LinkedList<PMultipleBind>(); binds.add(tmb); exists_exp.setBindList(binds); exists_exp.setPredicate(node.getInvExpression().clone()); stitch = exists_exp; valuetree.setPredicate(ctxt.getPredWithContext(exists_exp)); }
public AExplicitFunctionDefinition getInvDefinition(ATypeDefinition d) { ILexLocation loc = d.getInvPattern().getLocation(); List<PPattern> params = new Vector<PPattern>(); params.add(d.getInvPattern().clone()); List<List<PPattern>> parameters = new Vector<List<PPattern>>(); parameters.add(params); PTypeList ptypes = new PTypeList(); if (d.getInvType() instanceof ARecordInvariantType) { // Records are inv_R: R +> bool ptypes.add(AstFactory.newAUnresolvedType(d.getName().clone())); } else { // Named types are inv_T: x +> bool, for T = x ANamedInvariantType nt = (ANamedInvariantType) d.getInvType(); ptypes.add(nt.getType().clone()); } AFunctionType ftype = AstFactory.newAFunctionType(loc, false, ptypes, AstFactory.newABooleanBasicType(loc)); AExplicitFunctionDefinition def = AstFactory.newAExplicitFunctionDefinition(d.getName().getInvName(loc), NameScope.GLOBAL, null, ftype, parameters, d.getInvExpression(), null, null, true, null); def.setAccess(d.getAccess().clone()); // Same as type's def.setClassDefinition(d.getClassDefinition()); return def; }
if(node.getInvPattern() != null && !_visitedNodes.contains(node.getInvPattern())) node.getInvPattern().apply(this);
if(node.getInvPattern() != null && !_visitedNodes.contains(node.getInvPattern())) node.getInvPattern().apply(this, question);
if(node.getInvPattern() != null && !_visitedNodes.contains(node.getInvPattern())) node.getInvPattern().apply(this);
if(node.getInvPattern() != null && !_visitedNodes.contains(node.getInvPattern())) mergeReturns(retVal,node.getInvPattern().apply(this));
if(node.getInvPattern() != null && !_visitedNodes.contains(node.getInvPattern())) mergeReturns(retVal,node.getInvPattern().apply(this, question));
throws AnalysisException if (node.getInvPattern() != null)
af.createPPatternAssistant().typeResolve(node.getInvPattern(), question.rootVisitor, question.question);