public AApplyExpIR consUtilsToStringCall() { return consUtilCall(new AStringTypeIR(), IJavaConstants.TO_STRING); } }
/** * Called by the {@link AStringTypeIR} node from {@link AStringTypeIR#apply(IIsaAnalysis)}. * @param node the calling {@link AStringTypeIR} node */ public void caseAStringTypeIR(AStringTypeIR node) throws AnalysisException { _visitedNodes.add(node); inAStringTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outAStringTypeIR(node); }
/** * Returns a deep clone of this {@link AStringTypeIR} node. * @return a deep clone of this {@link AStringTypeIR} node */ public AStringTypeIR clone() { return new AStringTypeIR( _sourceNode, _tag, _metaData, _optional, cloneNode(_namedInvType) ); }
public STypeIR constructSeqType(SSeqTypeBase node, IRInfo question) throws AnalysisException { STypeIR seqOfCg = node.getSeqof().apply(question.getTypeVisitor(), question); boolean emptyCg = node.getEmpty(); boolean isSeq1 = node instanceof ASeq1SeqType; // This is a special case since sequence of characters are strings if (seqOfCg instanceof ACharBasicTypeIR && question.getSettings().getCharSeqAsString()) { AStringTypeIR stringTypeCg = new AStringTypeIR(); stringTypeCg.setSourceNode(new SourceNode(node)); return stringTypeCg; } ASeqSeqTypeIR seqType = new ASeqSeqTypeIR(); seqType.setSeqOf(seqOfCg); seqType.setEmpty(emptyCg); seqType.setSeq1(isSeq1); return seqType; }
AStringTypeIR returnType = new AStringTypeIR(); + "{", false); stringBuffer.setType(returnType.clone()); stringBuffer.setLeft(strStart);
/** * Essentially this.toString().equals(o.toString()). **/ @Override public boolean equals(Object o) { if (o != null && o instanceof AStringTypeIR) { return toString().equals(o.toString()); } return false; }
private ASeqConcatBinaryExpIR consNext(AStringTypeIR returnType, ASeqConcatBinaryExpIR previous, AFieldDeclIR field, boolean separate) { ASeqConcatBinaryExpIR next = new ASeqConcatBinaryExpIR(); next.setType(returnType.clone()); next.setLeft(consFieldStr(field, separate)); previous.setRight(next); return next; }
public AStringLiteralExpIR consStringLiteral(String value, boolean isNull) { AStringLiteralExpIR stringLiteral = new AStringLiteralExpIR(); stringLiteral.setType(new AStringTypeIR()); stringLiteral.setIsNull(isNull); stringLiteral.setValue(value); return stringLiteral; }
/** * Creates a deep clone of this {@link AStringTypeIR} 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 AStringTypeIR} node */ public AStringTypeIR clone(Map<INode,INode> oldToNewMap) { AStringTypeIR node = new AStringTypeIR( _sourceNode, _tag, _metaData, _optional, cloneNode(_namedInvType, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link AStringTypeIR} node from {@link AStringTypeIR#apply(IAnalysis)}. * @param node the calling {@link AStringTypeIR} node */ public void caseAStringTypeIR(AStringTypeIR node, Q question) throws AnalysisException { _visitedNodes.add(node); inAStringTypeIR(node, question); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this, question); } outAStringTypeIR(node, question); }
private void correctExpToString(SExpIR toCorrect) { ASeqToStringUnaryExpIR conversion = new ASeqToStringUnaryExpIR(); transformationAssistant.replaceNodeWith(toCorrect, conversion); conversion.setType(new AStringTypeIR()); conversion.setExp(toCorrect); } }
/** * Called by the {@link AStringTypeIR} node from {@link AStringTypeIR#apply(IAnalysis)}. * @param node the calling {@link AStringTypeIR} node */ public void caseAStringTypeIR(AStringTypeIR node) throws AnalysisException { _visitedNodes.add(node); inAStringTypeIR(node); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { node.getNamedInvType().apply(this); } outAStringTypeIR(node); }
public AMethodDeclIR consToStringSignature() { AMethodDeclIR toStringMethod = new AMethodDeclIR(); toStringMethod.setTag(new IRGeneratedTag(getClass().getName())); toStringMethod.setIsConstructor(false); toStringMethod.setAccess(IJavaConstants.PUBLIC); toStringMethod.setStatic(false); toStringMethod.setName(IJavaConstants.TO_STRING); toStringMethod.setAbstract(false); AStringTypeIR returnType = new AStringTypeIR(); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(returnType); toStringMethod.setMethodType(methodType); return toStringMethod; }
/** * Called by the {@link AStringTypeIR} node from {@link AStringTypeIR#apply(IAnalysis)}. * @param node the calling {@link AStringTypeIR} node */ public A caseAStringTypeIR(AStringTypeIR node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAStringTypeIR(node)); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { mergeReturns(retVal,node.getNamedInvType().apply(this)); } mergeReturns(retVal,outAStringTypeIR(node)); return retVal; }
str.setType(new AStringTypeIR()); str.setLeft(info.getExpAssistant().consStringLiteral(prefix + "(", false)); tmp.setType(new AStringTypeIR());
/** * Called by the {@link AStringTypeIR} node from {@link AStringTypeIR#apply(IAnalysis)}. * @param node the calling {@link AStringTypeIR} node */ public A caseAStringTypeIR(AStringTypeIR node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAStringTypeIR(node, question)); if(node.getNamedInvType() != null && !_visitedNodes.contains(node.getNamedInvType())) { mergeReturns(retVal,node.getNamedInvType().apply(this, question)); } mergeReturns(retVal,outAStringTypeIR(node, question)); return retVal; }
public AApplyExpIR consPostCheckCall(AMethodDeclIR method, AApplyExpIR postCondCall, AIdentifierVarExpIR resultVar, AStringLiteralExpIR methodName) { AExternalTypeIR externalType = new AExternalTypeIR(); externalType.setName(JavaFormat.UTILS_FILE); AMethodTypeIR methodType = new AMethodTypeIR(); methodType.setResult(new ABoolBasicTypeIR()); methodType.getParams().add(method.getMethodType().getResult().clone()); methodType.getParams().add(new ABoolBasicTypeIR()); methodType.getParams().add(new AStringTypeIR()); AExplicitVarExpIR explicitVar = new AExplicitVarExpIR(); explicitVar.setType(methodType); explicitVar.setIsLambda(false); explicitVar.setIsLocal(false); explicitVar.setName(postCheckMethodName); explicitVar.setClassType(externalType); AApplyExpIR utilsCall = new AApplyExpIR(); utilsCall.setRoot(explicitVar); utilsCall.setType(methodType.getResult().clone()); utilsCall.getArgs().add(resultVar); utilsCall.getArgs().add(postCondCall); utilsCall.getArgs().add(methodName); return utilsCall; } }
&& right.getType() instanceof AStringTypeIR) node.setType(new AStringTypeIR()); return; node.setType(new AStringTypeIR());
private SExpIR consFieldStr(AFieldDeclIR field, boolean separate) { String left = ""; if (separate) { left += ", "; } left += field.getName(); left += field.getFinal() != null && field.getFinal() ? " = " : " := "; AApplyExpIR toStringCall = consUtilsToStringCall(); AIdentifierVarExpIR fieldVar = new AIdentifierVarExpIR(); fieldVar.setType(field.getType().clone()); fieldVar.setIsLambda(false); fieldVar.setIsLocal(false); fieldVar.setName(field.getName()); toStringCall.getArgs().add(fieldVar); ASeqConcatBinaryExpIR fieldStr = new ASeqConcatBinaryExpIR(); fieldStr.setType(new AStringTypeIR()); fieldStr.setLeft(info.getExpAssistant().consStringLiteral(left, false)); fieldStr.setRight(toStringCall); return fieldStr; } }
return new AStringTypeIR(); } else