public ACallObjectExpStmIR consInstanceCallStm(STypeIR instanceType, String instanceName, String memberName, SExpIR... args) { AIdentifierVarExpIR instance = new AIdentifierVarExpIR(); instance.setName(instanceName); instance.setType(instanceType.clone()); instance.setIsLocal(true); ACallObjectExpStmIR call = new ACallObjectExpStmIR(); call.setType(new AVoidTypeIR()); call.setFieldName(memberName); call.setObj(instance); for (SExpIR arg : args) { call.getArgs().add(arg); } return call; }
/** * Called by the {@link ACallObjectExpStmIR} node from {@link ACallObjectExpStmIR#apply(IIsaAnalysis)}. * @param node the calling {@link ACallObjectExpStmIR} node */ public void caseACallObjectExpStmIR(ACallObjectExpStmIR node) throws AnalysisException { _visitedNodes.add(node); inACallObjectExpStmIR(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getObj() != null && !_visitedNodes.contains(node.getObj())) { node.getObj().apply(this); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getArgs()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outACallObjectExpStmIR(node); }
@Override public void caseACallObjectStmIR(ACallObjectStmIR node) throws AnalysisException { ACallObjectExpStmIR callObjExpStm = new ACallObjectExpStmIR(); callObjExpStm.setArgs(node.getArgs()); callObjExpStm.setObj(node.getDesignator().apply(converter)); callObjExpStm.setFieldName(node.getFieldName()); callObjExpStm.setSourceNode(node.getSourceNode()); callObjExpStm.setTag(node.getTag()); callObjExpStm.setType(node.getType()); if (node.parent() != null) { node.parent().replaceChild(node, callObjExpStm); } else { log.error("Could not find parent of " + node); } } }
/** * Creates a new tree field only constructor {@code ACallObjectExpStmIR TAG=callObjectExp} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param type_ the {@link STypeIR} node for the {@code type} child of this {@link ACallObjectExpStmIR} node * @param obj_ the {@link SExpIR} node for the {@code obj} child of this {@link ACallObjectExpStmIR} node * @param fieldName_ the {@link String} node for the {@code fieldName} child of this {@link ACallObjectExpStmIR} node * @param args_ the {@link NodeList} node for the {@code args} child of this {@link ACallObjectExpStmIR} node */ public ACallObjectExpStmIR(STypeIR type_, SExpIR obj_, String fieldName_, List<? extends SExpIR> args_) { super(null,null,null); this.setType(type_); this.setObj(obj_); this.setFieldName(fieldName_); this.setArgs(args_); }
/** * Returns a deep clone of this {@link ACallObjectExpStmIR} node. * @return a deep clone of this {@link ACallObjectExpStmIR} node */ public ACallObjectExpStmIR clone() { return new ACallObjectExpStmIR( _sourceNode, _tag, _metaData, cloneNode(_type), cloneNode(_obj), _fieldName, cloneList(_args) ); }
for (SExpIR arg : node.getArgs()) SExpIR objExp = node.getObj(); STypeIR type = node.getType(); LinkedList<SExpIR> args = node.getArgs(); String fieldName = node.getFieldName(); SourceNode sourceNode = node.getSourceNode(); ACallObjectExpStmIR call = new ACallObjectExpStmIR(); call.setObj(objExp); call.setType(type.clone()); call.setArgs((List<? extends SExpIR>) args.clone()); call.setFieldName(fieldName); call.setSourceNode(sourceNode); AVarDeclIR objDecl = transAssistant.getInfo().getDeclAssistant().consLocalVarDecl(node.getSourceNode().getVdmNode(), objType.clone(), id, objExp.clone()); objVar.setSourceNode(node.getSourceNode()); objVar.setIsLambda(false); objVar.setIsLocal(true); ACallObjectExpStmIR callCopy = call.clone(); correctArgTypes(callCopy.getArgs(), methodType.getParams(), true); } else
SExpIR obj = callObj.getObj(); String field = callObj.getFieldName(); LinkedList<SExpIR> args = callObj.getArgs();
@Override public void caseACallObjectExpStmIR(ACallObjectExpStmIR node) throws AnalysisException { if (node.getObj() instanceof SVarExpIR) { SVarExpIR obj = (SVarExpIR) node.getObj(); handleStateUpdate(node, obj); } else if (node.getObj() instanceof ACastUnaryExpIR) { ACastUnaryExpIR cast = (ACastUnaryExpIR) node.getObj(); if (cast.getExp() instanceof SVarExpIR) { SVarExpIR obj = (SVarExpIR) cast.getExp(); handleStateUpdate(node, obj); } else { log.error("Expected subject of cast expression to be a variable expression at this point. Got: " + cast.getExp()); } } else { log.error("Expected object of call object statement " + " to be a variable or cast expression by now. Got: " + node.getObj()); } }
} else if (callStm instanceof ACallObjectExpStmIR) args = ((ACallObjectExpStmIR) callStm).getArgs(); } else
/** * Creates a new complete constructor {@code ACallObjectExpStmIR} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param type_ the {@link STypeIR} node for the {@code type} child of this {@link ACallObjectExpStmIR} node * @param obj_ the {@link SExpIR} node for the {@code obj} child of this {@link ACallObjectExpStmIR} node * @param fieldName_ the {@link String} node for the {@code fieldName} child of this {@link ACallObjectExpStmIR} node * @param args_ the {@link NodeList} node for the {@code args} child of this {@link ACallObjectExpStmIR} node */ public ACallObjectExpStmIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, STypeIR type_, SExpIR obj_, String fieldName_, List<? extends SExpIR> args_) { super(sourceNode_,tag_,metaData_); this.setType(type_); this.setObj(obj_); this.setFieldName(fieldName_); this.setArgs(args_); }
/** * Creates a deep clone of this {@link ACallObjectExpStmIR} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link ACallObjectExpStmIR} node */ public ACallObjectExpStmIR clone(Map<INode,INode> oldToNewMap) { ACallObjectExpStmIR node = new ACallObjectExpStmIR( _sourceNode, _tag, _metaData, cloneNode(_type, oldToNewMap), cloneNode(_obj, oldToNewMap), _fieldName, cloneList(_args, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
ACallObjectExpStmIR setCall = new ACallObjectExpStmIR(); setCall.setFieldName(consSetCallName(target.getMemberName())); setCall.getArgs().add(node.getExp().clone()); setCall.setType(new AVoidTypeIR()); setCall.setObj(obj); setCall.setSourceNode(node.getSourceNode()); setCall.getObj().apply(this); inTarget = false; setCall.getArgs().getFirst().apply(this);
/** * Called by the {@link ACallObjectExpStmIR} node from {@link ACallObjectExpStmIR#apply(IAnalysis)}. * @param node the calling {@link ACallObjectExpStmIR} node */ public void caseACallObjectExpStmIR(ACallObjectExpStmIR node) throws AnalysisException { _visitedNodes.add(node); inACallObjectExpStmIR(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getObj() != null && !_visitedNodes.contains(node.getObj())) { node.getObj().apply(this); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getArgs()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outACallObjectExpStmIR(node); }
public boolean simpleRecSetCallOutsideAtomic(ACallObjectExpStmIR node) { if (handler.getInvTrans().getJmlGen().getJavaGen().getInfo().getStmAssistant().inAtomic(node)) { return false; } SExpIR obj = node.getObj(); if (!(obj.getType() instanceof ARecordTypeIR)) { return false; } if (obj instanceof SVarExpIR) { return true; } if (obj instanceof ACastUnaryExpIR && ((ACastUnaryExpIR) obj).getExp() instanceof SVarExpIR) { return true; } return false; }
sentinelVar.setType(fieldType); ACallObjectExpStmIR callSentinel = new ACallObjectExpStmIR(); callSentinel.setObj(sentinelVar); callSentinel.setFieldName(concPrefixes.stateChangedMethodName()); callSentinel.setType(new AVoidTypeIR());
/** * Called by the {@link ACallObjectExpStmIR} node from {@link ACallObjectExpStmIR#apply(IAnalysis)}. * @param node the calling {@link ACallObjectExpStmIR} node */ public void caseACallObjectExpStmIR(ACallObjectExpStmIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inACallObjectExpStmIR(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getObj() != null && !_visitedNodes.contains(node.getObj())) { node.getObj().apply(this, question); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getArgs()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } outACallObjectExpStmIR(node, question); }
SExpIR recObj = node.getObj();
ACallObjectExpStmIR paramExp = new ACallObjectExpStmIR(); paramExp.setObj(cast); paramExp.setFieldName(name); paramExp.setType(type.clone()); paramExp.getArgs().add(arg.clone()); paramExp.setSourceNode(sourceNode);