@Override public PExp caseAAtomicStm(AAtomicStm stm, Integer lineno) throws AnalysisException { PExp found = null; for (AAssignmentStm stmt : stm.getAssignments()) { found = stmt.apply(THIS, lineno); if (found != null) { break; } } return found; }
@Override public PStm caseAAtomicStm(AAtomicStm stm, Integer lineno) throws AnalysisException { PStm found = findStatementBaseCase(stm, lineno); if (found != null) { return found; } for (AAssignmentStm stmt : stm.getAssignments()) { found = stmt.apply(THIS, lineno);// PStmAssistantInterpreter.findStatement(stmt, lineno); if (found != null) { break; } } return found; }
@Override public LexNameSet caseAAtomicStm(AAtomicStm node, FreeVarInfo info) throws AnalysisException { LexNameSet names = new LexNameSet(); for (AAssignmentStm stmt: node.getAssignments()) { names.addAll(stmt.apply(this, info)); } return names; }
private PExp extractInv(AAtomicStm atom) { AAssignmentStm x = atom.getAssignments().get(0); if (x.getClassDefinition() != null) { return invDefs(x.getClassDefinition()); } else { return invDefs(x.getStateDefinition()); } }
@Override public SStmIR caseAAtomicStm(AAtomicStm node, IRInfo question) throws AnalysisException { AAtomicStmIR atomicBlock = new AAtomicStmIR(); for (AAssignmentStm assignment : node.getAssignments()) { SStmIR stmCg = assignment.apply(question.getStmVisitor(), question); if (stmCg != null) { atomicBlock.getStatements().add(stmCg); } else { return null; } } return atomicBlock; }
@Override public PType caseAAtomicStm(AAtomicStm node, TypeCheckInfo question) throws AnalysisException { for (AAssignmentStm stmt : node.getAssignments()) { stmt.apply(THIS, question); } node.setType(AstFactory.newAVoidType(node.getLocation())); return node.getType(); }
/** * Called by the {@link AAtomicStm} node from {@link AAtomicStm#apply(IAnalysis)}. * @param node the calling {@link AAtomicStm} node */ public void caseAAtomicStm(AAtomicStm node) throws AnalysisException { _visitedNodes.add(node); inAAtomicStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } { List<AAssignmentStm> copy = new ArrayList<AAssignmentStm>(node.getAssignments()); for( AAssignmentStm e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getStatedef() != null && !_visitedNodes.contains(node.getStatedef())) { node.getStatedef().apply(this); } outAAtomicStm(node); }
/** * Called by the {@link AAtomicStm} node from {@link AAtomicStm#apply(IPOFAnalysis)}. * @param node the calling {@link AAtomicStm} node */ public void caseAAtomicStm(AAtomicStm node) throws AnalysisException { _visitedNodes.add(node); inAAtomicStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } { List<AAssignmentStm> copy = new ArrayList<AAssignmentStm>(node.getAssignments()); for( AAssignmentStm e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getStatedef() != null && !_visitedNodes.contains(node.getStatedef())) { node.getStatedef().apply(this); } outAAtomicStm(node); }
/** * Called by the {@link AAtomicStm} node from {@link AAtomicStm#apply(IAnalysis)}. * @param node the calling {@link AAtomicStm} node */ public void caseAAtomicStm(AAtomicStm node, Q question) throws AnalysisException { _visitedNodes.add(node); inAAtomicStm(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } { List<AAssignmentStm> copy = new ArrayList<AAssignmentStm>(node.getAssignments()); for( AAssignmentStm e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } if(node.getStatedef() != null && !_visitedNodes.contains(node.getStatedef())) { node.getStatedef().apply(this, question); } outAAtomicStm(node, question); }
/** * Called by the {@link AAtomicStm} node from {@link AAtomicStm#apply(IAnalysis)}. * @param node the calling {@link AAtomicStm} node */ public A caseAAtomicStm(AAtomicStm node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAAtomicStm(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } { List<AAssignmentStm> copy = new ArrayList<AAssignmentStm>(node.getAssignments()); for( AAssignmentStm e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } if(node.getStatedef() != null && !_visitedNodes.contains(node.getStatedef())) { mergeReturns(retVal,node.getStatedef().apply(this)); } mergeReturns(retVal,outAAtomicStm(node)); return retVal; }
/** * Called by the {@link AAtomicStm} node from {@link AAtomicStm#apply(IAnalysis)}. * @param node the calling {@link AAtomicStm} node */ public A caseAAtomicStm(AAtomicStm node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAAtomicStm(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } { List<AAssignmentStm> copy = new ArrayList<AAssignmentStm>(node.getAssignments()); for( AAssignmentStm e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } if(node.getStatedef() != null && !_visitedNodes.contains(node.getStatedef())) { mergeReturns(retVal,node.getStatedef().apply(this, question)); } mergeReturns(retVal,outAAtomicStm(node, question)); return retVal; }
public StateInvariantObligation(AAtomicStm atom, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(atom, POType.STATE_INV, ctxt, atom.getLocation(), af); assistantFactory = af; PExp invApplyExp = makeInvApplyExp(atom); PExp invApplyExpForSub = invApplyExp.clone(); List<Substitution> subs = new LinkedList<Substitution>(); for (AAssignmentStm asgn : atom.getAssignments()) { String hash = asgn.getTarget().apply(af.getStateDesignatorNameGetter()); subs.add(new Substitution(hash, asgn.getExp().clone())); } IVariableSubVisitor varSubVisitor = af.getVarSubVisitor(); for (Substitution sub : subs) { invApplyExpForSub = invApplyExpForSub.apply(varSubVisitor, sub); } stitch = AstExpressionFactory.newAImpliesBooleanBinaryExp(invApplyExp, invApplyExpForSub); valuetree.setPredicate(stitch); }
for (AAssignmentStm stmt : node.getAssignments())
int size = node.getAssignments().size(); ValueList targets = new ValueList(size); ValueList values = new ValueList(size); for (AAssignmentStm stmt : node.getAssignments())
private PExp makeInvApplyExp(AAtomicStm atom) { AStateDefinition stateDef = atom.getAssignments().get(0).getStateDefinition(); if (stateDef == null) { return extractInv(atom); } String stateName = getStateName(stateDef); List<PExp> arglist = new Vector<PExp>(); for (AFieldField f : stateDef.getFields()) { arglist.add(getVarExp(f.getTagname().clone(), stateDef.clone(),f.getType())); } PExp mkExp = AstExpressionFactory.newAMkTypeExp(new LexNameToken("", stateName, null), stateDef.getRecordType().clone(), arglist); AApplyExp invApplyExp = getApplyExp(getVarExp(stateDef.getInvdef().getName().clone(), stateDef.getInvdef().clone(), stateDef.getInvdef().getType().clone()), new ABooleanBasicType(), mkExp); invApplyExp.getRoot().setType(stateDef.getInvdef().getType().clone()); return invApplyExp; }