/** * Called by the {@link ANonDeterministicBlockStmIR} node from {@link ANonDeterministicBlockStmIR#apply(IAnalysis)}. * @param node the calling {@link ANonDeterministicBlockStmIR} node */ public void caseANonDeterministicBlockStmIR(ANonDeterministicBlockStmIR node) throws AnalysisException { _visitedNodes.add(node); inANonDeterministicBlockStmIR(node); { List<SStmIR> copy = new ArrayList<SStmIR>(node.getStatements()); for( SStmIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outANonDeterministicBlockStmIR(node); }
public boolean inAtomic(SStmIR stm) { return stm.getAncestor(AAtomicStmIR.class) != null; }
/** * Sets the {@code _body} child of this {@link AWhileStmIR} node. * @param value the new {@code _body} child of this {@link AWhileStmIR} node */ public void setBody(SStmIR value) { if (this._body != null) { this._body.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._body = value; }
@Override public void caseAForAllStmIR(AForAllStmIR node) throws AnalysisException { SPatternIR pattern = node.getPattern(); if (pattern instanceof AIdentifierPatternIR) { node.getExp().apply(this); node.getBody().apply(this); return; } if (pattern instanceof AIgnorePatternIR) { AIdentifierPatternIR idPattern = getIdPattern(config.getIgnorePatternPrefix()); transAssistant.replaceNodeWith(pattern, idPattern); } PatternBlockData patternData = new PatternBlockData(MismatchHandling.LOOP_CONTINUE); patternData.setPattern(pattern); ABlockStmIR declBlock = new ABlockStmIR(); patternData.setDeclBlock(declBlock); ABlockStmIR patternHandlingBlock = consPatternCheck(false, pattern, transAssistant.getInfo().getTypeAssistant().findElementType(node.getExp().getType().clone()), patternData, null); if (patternHandlingBlock != null) { declBlock.getStatements().addFirst(patternHandlingBlock); } declBlock.getStatements().add(node.getBody().clone()); transAssistant.replaceNodeWith(node.getBody(), declBlock); node.getExp().apply(this); node.getBody().apply(this); }
call.setIsStatic(m.getStatic()); call.setName(m.getName()); call.setSourceNode(m.getBody().getSourceNode()); call.setTag(m.getBody().getTag()); call.setType(m.getMethodType().getResult().clone());
@Override public void caseANonDeterministicBlockStmIR(ANonDeterministicBlockStmIR node) throws AnalysisException { super.caseANonDeterministicBlockStmIR(node); ABlockStmIR block = new ABlockStmIR(); block.setScoped(false); block.setTag(node.getTag()); block.setSourceNode(node.getSourceNode()); if(!node.getStatements().isEmpty()) { // Just use the first statement block.getStatements().add(node.getStatements().getFirst().clone()); } else { log.error("nondeterministic statement block did not contain any statements: " + node); } assist.replaceNodeWith(node, block); } }
/** * Called by the {@link ANonDeterministicBlockStmIR} node from {@link ANonDeterministicBlockStmIR#apply(IIsaAnalysis)}. * @param node the calling {@link ANonDeterministicBlockStmIR} node */ public void caseANonDeterministicBlockStmIR(ANonDeterministicBlockStmIR node) throws AnalysisException { _visitedNodes.add(node); inANonDeterministicBlockStmIR(node); { List<SStmIR> copy = new ArrayList<SStmIR>(node.getStatements()); for( SStmIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outANonDeterministicBlockStmIR(node); }
public ADefaultClassDeclIR getEnclosingClass( AIdentifierVarExpIR stateDesVar) { for (SStmIR k : stateDesVars.keySet()) { for (AIdentifierVarExpIR v : stateDesVars.get(k)) { if (v == stateDesVar) { ADefaultClassDeclIR encClass = k.getAncestor(ADefaultClassDeclIR.class); if (encClass == null) { log.error("Could not find enclosing class of " + stateDesVar); } return encClass; } } } return null; } }
/** * Sets the {@code _stm} child of this {@link ATryStmIR} node. * @param value the new {@code _stm} child of this {@link ATryStmIR} node */ public void setStm(SStmIR value) { if (this._stm != null) { this._stm.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._stm = value; }
newBody.getStatements().add(body.clone());
/** * Called by the {@link ANonDeterministicBlockStmIR} node from {@link ANonDeterministicBlockStmIR#apply(IAnalysis)}. * @param node the calling {@link ANonDeterministicBlockStmIR} node */ public void caseANonDeterministicBlockStmIR(ANonDeterministicBlockStmIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inANonDeterministicBlockStmIR(node, question); { List<SStmIR> copy = new ArrayList<SStmIR>(node.getStatements()); for( SStmIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } outANonDeterministicBlockStmIR(node, question); }
private String handleOpBody(SStmIR body) throws AnalysisException { AMethodDeclIR method = body.getAncestor(AMethodDeclIR.class); if (method == null) { log.error("Could not find enclosing method when formatting operation body. Got: " + body); } else if (method.getAsync() != null && method.getAsync()) { return "new VDMThread(){ " + "\tpublic void run() {" + "\t " + format(body) + "\t} " + "}.start();"; } return format(body); }
/** * Sets the {@code _elseStm} child of this {@link AIfStmIR} node. * @param value the new {@code _elseStm} child of this {@link AIfStmIR} node */ public void setElseStm(SStmIR value) { if (this._elseStm != null) { this._elseStm.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._elseStm = value; }
callStmCreation.setType(callStmType); AMethodDeclIR typeCheckMethod = consTypeCheckMethod(node.getCallStm().clone()); AMethodDeclIR preCondMethod = condMeetsPreCondMethod(node.getCallStm().clone()); callStmCreation.getMethods().add(consExecuteMethod(node.getCallStm().clone())); callStmCreation.getMethods().add(traceTrans.getToStringBuilder().consToString(getInfo(), node.getCallStm(), storeAssistant.getIdConstNameMap(), storeAssistant, getTransAssist())); AVarDeclIR callStmDecl = getTransAssist().consDecl(callStmName, callStmType.clone(), callStmCreation);
/** * Called by the {@link AAtomicStmIR} node from {@link AAtomicStmIR#apply(IAnalysis)}. * @param node the calling {@link AAtomicStmIR} node */ public void caseAAtomicStmIR(AAtomicStmIR node) throws AnalysisException { _visitedNodes.add(node); inAAtomicStmIR(node); { List<SStmIR> copy = new ArrayList<SStmIR>(node.getStatements()); for( SStmIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAAtomicStmIR(node); }
private STypeIR getSentinelFieldType(SStmIR node) { ADefaultClassDeclIR enclosingClass = node.getAncestor(ADefaultClassDeclIR.class); STypeIR fieldType = null; if (enclosingClass != null) { fieldType = transAssistant.getInfo().getTypeAssistant().getFieldType(enclosingClass, concPrefixes.sentinelInstanceName(), transAssistant.getInfo().getClasses()); } else { log.error("Could not find enclosing class of assignment statement"); } return fieldType; }
/** * Sets the {@code _stm} child of this {@link ADurationStmIR} node. * @param value the new {@code _stm} child of this {@link ADurationStmIR} node */ public void setStm(SStmIR value) { if (this._stm != null) { this._stm.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._stm = value; }
/** * Called by the {@link AAtomicStmIR} node from {@link AAtomicStmIR#apply(IIsaAnalysis)}. * @param node the calling {@link AAtomicStmIR} node */ public void caseAAtomicStmIR(AAtomicStmIR node) throws AnalysisException { _visitedNodes.add(node); inAAtomicStmIR(node); { List<SStmIR> copy = new ArrayList<SStmIR>(node.getStatements()); for( SStmIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAAtomicStmIR(node); }