/** * 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; }
/** * 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) ); }
protected AAssignToExpStmIR assignToVar(AIdentifierVarExpIR var, SExpIR exp) { AAssignToExpStmIR assignment = new AAssignToExpStmIR(); assignment.setTarget(var.clone()); assignment.setExp(exp.clone()); return assignment; }
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; }
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); } }
@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; } }
protected SStmIR consOrExpCheck(AOrBoolBinaryExpIR node, String orResultVarName) { SExpIR left = node.getLeft().clone(); SExpIR right = node.getRight().clone(); AIfStmIR leftCheck = new AIfStmIR(); leftCheck.setIfExp(left); AAssignToExpStmIR setOrResultVarTrue = new AAssignToExpStmIR(); setOrResultVarTrue.setTarget(transAssistant.consBoolCheck(orResultVarName, false)); setOrResultVarTrue.setExp(transAssistant.getInfo().getAssistantManager().getExpAssistant().consBoolLiteral(true)); leftCheck.setThenStm(setOrResultVarTrue); AAssignToExpStmIR setOrResultVarToRightExp = new AAssignToExpStmIR(); setOrResultVarToRightExp.setTarget(transAssistant.consBoolCheck(orResultVarName, false)); setOrResultVarToRightExp.setExp(right); leftCheck.setElseStm(setOrResultVarToRightExp); return leftCheck; }
private AAssignToExpStmIR declareAndAssignIdVarAssignment( ABlockStmIR declBlock, SPatternIR currentPattern, STypeIR currentType, SExpIR valueToMatch) { AIdentifierPatternIR currentId = (AIdentifierPatternIR) currentPattern; AVarDeclIR idVarDecl = transAssistant.getInfo().getDeclAssistant().consLocalVarDecl(currentType.clone(), currentPattern.clone(), new AUndefinedExpIR()); declBlock.getLocalDefs().add(idVarDecl); AIdentifierVarExpIR var = new AIdentifierVarExpIR(); var.setType(currentType.clone()); var.setName(currentId.getName()); var.setIsLocal(true); var.setIsLambda(false); AAssignToExpStmIR localAssignment = new AAssignToExpStmIR(); localAssignment.setTarget(var); localAssignment.setExp(valueToMatch); return localAssignment; }
varExp.setName(((AIdentifierPatternIR) nextDeclPattern).getName()); AAssignToExpStmIR assignment = new AAssignToExpStmIR(); assignment.setTarget(varExp); assignment.setExp(assignedExp.clone());
protected AIfStmIR consAndExpCheck(AAndBoolBinaryExpIR node, String andResultVarName) { SExpIR left = node.getLeft().clone(); SExpIR right = node.getRight().clone(); AIfStmIR leftCheck = new AIfStmIR(); leftCheck.setIfExp(left); AIfStmIR rightCheck = new AIfStmIR(); rightCheck.setIfExp(right); AAssignToExpStmIR assignAndVar = new AAssignToExpStmIR(); assignAndVar.setTarget(transAssistant.consBoolCheck(andResultVarName, false)); assignAndVar.setExp(transAssistant.getInfo().getAssistantManager().getExpAssistant().consBoolLiteral(true)); rightCheck.setThenStm(assignAndVar); leftCheck.setThenStm(rightCheck); return leftCheck; }
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);
ifStm.setThenStm(recordPatternBlock); AAssignToExpStmIR setFalse = new AAssignToExpStmIR(); setFalse.setTarget(patternData.getSuccessVar().clone()); setFalse.setExp(transAssistant.getInfo().getExpAssistant().consBoolLiteral(false));
outerBlock.getLocalDefs().add(resultDecl); AAssignToExpStmIR setLetBeStResult = new AAssignToExpStmIR(); setLetBeStResult.setTarget(transAssistant.getInfo().getExpAssistant().consIdVar(var, value.getType().clone())); setLetBeStResult.setExp(value);
AAssignToExpStmIR resultAssign = new AAssignToExpStmIR(); STypeIR elementType = transAssist.getElementType(setVar.getType()); resultAssign.setTarget(transAssist.getInfo().getExpAssistant().consIdVar(resultVarName, elementType));
AAssignToExpStmIR assign = new AAssignToExpStmIR(); assign.setTarget(node.getTarget().apply(converter)); assign.setExp(node.getExp().clone());
field.setMemberName(name); AAssignToExpStmIR assignment = new AAssignToExpStmIR(); assignment.setTarget(field); assignment.setExp(value);
private AMethodDeclIR consSetter(AFieldDeclIR f) { AMethodDeclIR setter = new AMethodDeclIR(); setter.setAbstract(false); setter.setAccess(IRConstants.PUBLIC); setter.setAsync(false); setter.setImplicit(false); setter.setIsConstructor(false); setter.setName(consSetCallName(f.getName())); setter.setStatic(false); setter.setSourceNode(f.getSourceNode()); String paramName = consParamName(f); AFormalParamLocalParamIR param = new AFormalParamLocalParamIR(); param.setType(f.getType().clone()); param.setPattern(jmlGen.getJavaGen().getInfo().getPatternAssistant().consIdPattern(paramName)); setter.getFormalParams().add(param); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(new AVoidTypeIR()); methodType.getParams().add(f.getType().clone()); setter.setMethodType(methodType); AAssignToExpStmIR fieldUpdate = new AAssignToExpStmIR(); fieldUpdate.setTarget(jmlGen.getJavaGen().getInfo().getExpAssistant().consIdVar(f.getName(), f.getType().clone())); fieldUpdate.setExp(jmlGen.getJavaGen().getInfo().getExpAssistant().consIdVar(paramName, f.getType().clone())); setter.setBody(fieldUpdate); return setter; }
newQuote.setType(quoteClassType); AAssignToExpStmIR assignInstance = new AAssignToExpStmIR(); assignInstance.setTarget(instanceId); assignInstance.setExp(newQuote);
AAssignToExpStmIR assignment = new AAssignToExpStmIR(); AIdentifierVarExpIR id = new AIdentifierVarExpIR(); id.setName(name);
superCall.setRoot(superVar); AAssignToExpStmIR assignHashcode = new AAssignToExpStmIR(); assignHashcode.setTarget(hashCodeId); assignHashcode.setExp(superCall);