/** * Called by the {@link ANewExpIR} node from {@link ANewExpIR#apply(IIsaAnalysis)}. * @param node the calling {@link ANewExpIR} node */ public void caseANewExpIR(ANewExpIR node) throws AnalysisException { _visitedNodes.add(node); inANewExpIR(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getName() != null && !_visitedNodes.contains(node.getName())) { node.getName().apply(this); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getArgs()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outANewExpIR(node); }
/** * Creates a new complete constructor {@code ANewExpIR} 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 name_ the {@link ATypeNameIR} node for the {@code name} child of this {@link ANewExpIR} node * @param args_ the {@link NodeList} node for the {@code args} child of this {@link ANewExpIR} node */ public ANewExpIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, STypeIR type_, ATypeNameIR name_, List<? extends SExpIR> args_) { super(sourceNode_,tag_,metaData_,type_); this.setName(name_); this.setArgs(args_); }
protected ABlockStmIR consDecl(String classTypeName, String varName, SExpIR... args) { ATypeNameIR typeName = getTransAssist().consTypeNameForClass(classTypeName); AClassTypeIR classType = getTransAssist().consClassType(classTypeName); ANewExpIR newExp = new ANewExpIR(); newExp.setName(typeName); newExp.setType(classType); for (SExpIR arg : args) { newExp.getArgs().add(arg); } return getTransAssist().wrap(getTransAssist().consDecl(varName, classType.clone(), newExp)); }
/** * Called by the {@link ANewObjectDesignatorIR} node from {@link ANewObjectDesignatorIR#apply(IIsaAnalysis)}. * @param node the calling {@link ANewObjectDesignatorIR} node */ public void caseANewObjectDesignatorIR(ANewObjectDesignatorIR node) throws AnalysisException { _visitedNodes.add(node); inANewObjectDesignatorIR(node); if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this); } outANewObjectDesignatorIR(node); }
newStmTraceNodeExp.getArgs().add(getInfo().getExpAssistant().consIdVar(callStmName, callStmType.clone()));
STypeIR newExpType = newExp.getType();
public String formatName(INode node) throws AnalysisException { if (node instanceof ANewExpIR) { ANewExpIR newExp = (ANewExpIR) node; return formatTypeName(node, newExp.getName()); } else if (node instanceof ARecordTypeIR) { ARecordTypeIR record = (ARecordTypeIR) node; ATypeNameIR typeName = record.getName(); return formatTypeName(node, typeName); } throw new AnalysisException("Unexpected node in formatName: " + node.getClass().getName()); }
private SExpIR getInitExp(AStateDeclIR stateDecl) { if (stateDecl.getInitExp() instanceof AEqualsBinaryExpIR) { AEqualsBinaryExpIR eqExp = (AEqualsBinaryExpIR) stateDecl.getInitExp(); return eqExp.getRight().clone(); } else { ANewExpIR defaultRecInit = new ANewExpIR(); defaultRecInit.setName(transAssistant.getTypeName(stateDecl)); defaultRecInit.setType(transAssistant.getRecType(stateDecl)); for (int i = 0; i < stateDecl.getFields().size(); i++) { defaultRecInit.getArgs().add(transAssistant.getInfo().getExpAssistant().consUndefinedExp()); } return defaultRecInit; } }
/** * Creates a deep clone of this {@link ANewExpIR} 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 ANewExpIR} node */ public ANewExpIR clone(Map<INode,INode> oldToNewMap) { ANewExpIR node = new ANewExpIR( _sourceNode, _tag, _metaData, cloneNode(_type, oldToNewMap), cloneNode(_name, oldToNewMap), cloneList(_args, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Creates a new tree field only constructor {@code ANewExpIR TAG=new} 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 name_ the {@link ATypeNameIR} node for the {@code name} child of this {@link ANewExpIR} node * @param args_ the {@link NodeList} node for the {@code args} child of this {@link ANewExpIR} node */ public ANewExpIR(STypeIR type_, ATypeNameIR name_, List<? extends SExpIR> args_) { super(null,null,null,type_); this.setName(name_); this.setArgs(args_); }
/** * Called by the {@link ANewObjectDesignatorIR} node from {@link ANewObjectDesignatorIR#apply(IAnalysis)}. * @param node the calling {@link ANewObjectDesignatorIR} node */ public void caseANewObjectDesignatorIR(ANewObjectDesignatorIR node) throws AnalysisException { _visitedNodes.add(node); inANewObjectDesignatorIR(node); if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this); } outANewObjectDesignatorIR(node); }
/** * Called by the {@link ANewExpIR} node from {@link ANewExpIR#apply(IAnalysis)}. * @param node the calling {@link ANewExpIR} node */ public void caseANewExpIR(ANewExpIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inANewExpIR(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getName() != null && !_visitedNodes.contains(node.getName())) { node.getName().apply(this, question); } { List<SExpIR> copy = new ArrayList<SExpIR>(node.getArgs()); for( SExpIR e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } outANewExpIR(node, question); }
/** * Called by the {@link ANewObjectDesignatorIR} node from {@link ANewObjectDesignatorIR#apply(IAnalysis)}. * @param node the calling {@link ANewObjectDesignatorIR} node */ public void caseANewObjectDesignatorIR(ANewObjectDesignatorIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inANewObjectDesignatorIR(node, question); if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this, question); } outANewObjectDesignatorIR(node, question); }
public ACallObjectExpStmIR consAddTraceVarCall(AIdentifierVarExpIR subject, AIdentifierVarExpIR t) { ANewExpIR newVar = new ANewExpIR(); newVar.setName(getTransAssist().consTypeNameForClass(traceTrans.getTracePrefixes().traceVarClassName())); newVar.setType(getTransAssist().consClassType(traceTrans.getTracePrefixes().traceVarClassName())); newVar.getArgs().add(getInfo().getExpAssistant().consStringLiteral(t.getName(), false)); newVar.getArgs().add(getInfo().getExpAssistant().consStringLiteral("" + getTransAssist().getInfo().getTypeAssistant().getVdmType(t.getType()), false)); newVar.getArgs().add(traceTrans.getToStringBuilder().toStringOf(t.clone())); return getTransAssist().consInstanceCallStm(subject.getType(), subject.getName(), traceTrans.getTracePrefixes().addVarFirstMethodName(), newVar); }