protected AAssignToExpStmIR assignToVar(AIdentifierVarExpIR var, SExpIR exp) { AAssignToExpStmIR assignment = new AAssignToExpStmIR(); assignment.setTarget(var.clone()); assignment.setExp(exp.clone()); return assignment; }
/** * Creates a new tree field only constructor {@code AAssignToExpStmIR TAG=assignToExp} 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 target_ the {@link SExpIR} node for the {@code target} child of this {@link AAssignToExpStmIR} node * @param exp_ the {@link SExpIR} node for the {@code exp} child of this {@link AAssignToExpStmIR} node */ public AAssignToExpStmIR(SExpIR target_, SExpIR exp_) { super(null,null,null); this.setTarget(target_); this.setExp(exp_); }
/** * Returns a deep clone of this {@link AAssignToExpStmIR} node. * @return a deep clone of this {@link AAssignToExpStmIR} node */ public AAssignToExpStmIR clone() { return new AAssignToExpStmIR( _sourceNode, _tag, _metaData, cloneNode(_target), cloneNode(_exp) ); }
SExpIR falseValue = node.getFalseValue(); AAssignToExpStmIR trueBranch = new AAssignToExpStmIR(); trueBranch.setTarget(resultVar.clone()); trueBranch.setExp(trueValue.clone()); AAssignToExpStmIR falseBranch = new AAssignToExpStmIR(); falseBranch.setTarget(resultVar.clone()); falseBranch.setExp(falseValue); trueBranch.getExp().apply(this); falseBranch.getExp().apply(this);
AAssignToExpStmIR assign = new AAssignToExpStmIR(); assign.setTarget(node.getTarget().apply(converter)); assign.setExp(node.getExp().clone()); assign.setSourceNode(node.getSourceNode()); assign.setTag(node.getTag());
throws AnalysisException if (node.getTarget() instanceof AFieldExpIR) AFieldExpIR target = (AFieldExpIR) node.getTarget(); setCall.getArgs().add(node.getExp().clone()); setCall.setType(new AVoidTypeIR()); setCall.setSourceNode(node.getSourceNode()); node.getTarget().apply(this); inTarget = false; node.getExp().apply(this);
private boolean cloneNotNeededAssign(SExpIR exp) { INode parent = exp.parent(); if (parent instanceof AAssignToExpStmIR) { AAssignToExpStmIR assignment = (AAssignToExpStmIR) parent; if (assignment.getTarget() == exp) { return true; } } return false; }
public AAssignToExpStmIR castFieldObj(AAssignToExpStmIR assign, AFieldExpIR target, STypeIR possibleType) { ACastUnaryExpIR cast = new ACastUnaryExpIR(); cast.setType(possibleType.clone()); cast.setExp(target.getObject().clone()); AAssignToExpStmIR assignCopy = assign.clone(); AFieldExpIR fieldCopy = target.clone(); transAssistant.replaceNodeWith(fieldCopy.getObject(), cast); transAssistant.replaceNodeWith(assignCopy.getTarget(), fieldCopy); return assignCopy; }
@Override public void caseAAssignToExpStmIR(AAssignToExpStmIR node) throws AnalysisException { if(transAssistant.getInfo().getDeclAssistant().parentIsTest(node.getAncestor(ADefaultClassDeclIR.class))) { return; } if(transAssistant.getInfo().getDeclAssistant().isFullyAbstract(transAssistant.getInfo().getDeclAssistant().getSourceClass(node), transAssistant.getInfo())) { return; } if (node.getTarget() instanceof SVarExpIR) { SVarExpIR var = (SVarExpIR) node.getTarget(); if (var.getIsLocal()) { return; } } handleStateUpdate(node); }
/** * Creates a new complete constructor {@code AAssignToExpStmIR} 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 target_ the {@link SExpIR} node for the {@code target} child of this {@link AAssignToExpStmIR} node * @param exp_ the {@link SExpIR} node for the {@code exp} child of this {@link AAssignToExpStmIR} node */ public AAssignToExpStmIR(SourceNode sourceNode_, Object tag_, List<? extends ClonableString> metaData_, SExpIR target_, SExpIR exp_) { super(sourceNode_,tag_,metaData_); this.setTarget(target_); this.setExp(exp_); }
@Override public void caseAAssignToExpStmIR(AAssignToExpStmIR node) throws AnalysisException { if (node.getTarget() instanceof AFieldExpIR) { AFieldExpIR field = (AFieldExpIR) node.getTarget(); if (field.getObject().getType() instanceof AUnionTypeIR) { if (p != null) { log.error("Expected no state designator data by now"); } p = this.stateDesInfo.remove(node); handAssignRighHandSide(node); handleAssignTarget(node); } } else { handAssignRighHandSide(node); } p = null; }
/** * Creates a deep clone of this {@link AAssignToExpStmIR} 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 AAssignToExpStmIR} node */ public AAssignToExpStmIR clone(Map<INode,INode> oldToNewMap) { AAssignToExpStmIR node = new AAssignToExpStmIR( _sourceNode, _tag, _metaData, cloneNode(_target, oldToNewMap), cloneNode(_exp, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
public AAssignToExpStmIR consBoolVarAssignment(SExpIR predicate, String boolVarName) { AAssignToExpStmIR boolVarAssignment = new AAssignToExpStmIR(); boolVarAssignment.setTarget(consBoolCheck(boolVarName, false)); boolVarAssignment.setExp(predicate != null ? predicate.clone() : info.getExpAssistant().consBoolLiteral(true)); return boolVarAssignment; }
/** * Called by the {@link AAssignToExpStmIR} node from {@link AAssignToExpStmIR#apply(IIsaAnalysis)}. * @param node the calling {@link AAssignToExpStmIR} node */ public void caseAAssignToExpStmIR(AAssignToExpStmIR node) throws AnalysisException { _visitedNodes.add(node); inAAssignToExpStmIR(node); if(node.getTarget() != null && !_visitedNodes.contains(node.getTarget())) { node.getTarget().apply(this); } if(node.getExp() != null && !_visitedNodes.contains(node.getExp())) { node.getExp().apply(this); } outAAssignToExpStmIR(node); }
@Override public List<SStmIR> getPreForLoopStms(AIdentifierVarExpIR setVar, List<SPatternIR> patterns, SPatternIR pattern) { if (count > 0) { AAssignToExpStmIR successAssignment = new AAssignToExpStmIR(); successAssignment.setExp(transAssist.getInfo().getExpAssistant().consBoolLiteral(false)); successAssignment.setTarget(transAssist.consSuccessVar(successVarName)); return packStm(successAssignment); } else { return null; } }
public void handAssignRighHandSide(AAssignToExpStmIR node) throws AnalysisException { if (node.getExp() != null) { node.getExp().apply(this); } if (!castNotNeeded(node.getExp(), node.getTarget().getType())) { if (!(node.getTarget().getType() instanceof AUnionTypeIR)) { correctTypes(node.getExp(), node.getTarget().getType()); } } }
private void initSuccessVar(PatternBlockData patternData, SExpIR initExp, ABlockStmIR patternBlock) { if (patternData.getSuccessVarDecl().getExp() instanceof AUndefinedExpIR) { patternData.getSuccessVarDecl().setExp(initExp); } else { AAssignToExpStmIR successVarAssignment = new AAssignToExpStmIR(); successVarAssignment.setTarget(patternData.getSuccessVar().clone()); successVarAssignment.setExp(initExp); patternBlock.getStatements().add(successVarAssignment); } }