private void checkRunReturnType(ADefaultClassDeclIR classCg) { isVoidRun = false; for (AMethodDeclIR m : classCg.getMethods()) { if (m.getName().equals("Run") && m.getMethodType().getResult() instanceof AVoidTypeIR) { isVoidRun = true; } } }
if(node.getMethodType() != null && !_visitedNodes.contains(node.getMethodType())) node.getMethodType().apply(this);
if(node.getMethodType() != null && !_visitedNodes.contains(node.getMethodType())) node.getMethodType().apply(this);
if(node.getMethodType() != null && !_visitedNodes.contains(node.getMethodType())) node.getMethodType().apply(this, question);
LinkedList<STypeIR> params = method.getMethodType().getParams(); return method.getMethodType().clone();
public AMethodDeclIR genHashcodeMethod(ARecordDeclIR record) throws AnalysisException { AMethodDeclIR hashcodeMethod = consHashcodeMethodSignature(); AReturnStmIR returnStm = new AReturnStmIR(); if (record.getFields().isEmpty()) { AExternalExpIR zero = new AExternalExpIR(); zero.setType(hashcodeMethod.getMethodType().getResult().clone()); zero.setTargetLangExp("0"); returnStm.setExp(zero); } else { returnStm.setExp(javaFormat.getJavaFormatAssistant().consUtilCallUsingRecFields(record, hashcodeMethod.getMethodType().getResult(), hashcodeMethod.getName())); } hashcodeMethod.setBody(returnStm); return hashcodeMethod; }
if(node.getMethodType() != null && !_visitedNodes.contains(node.getMethodType())) mergeReturns(retVal,node.getMethodType().apply(this, question));
if(node.getMethodType() != null && !_visitedNodes.contains(node.getMethodType())) mergeReturns(retVal,node.getMethodType().apply(this));
&& m.getMethodType().getResult() instanceof ARecordTypeIR)
LinkedList<STypeIR> paramTypes = preCondMethod.getMethodType().getParams(); paramTypes.remove(paramTypes.size() - 1);
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; } }
@Override public void caseAReturnStmIR(AReturnStmIR node) throws AnalysisException { if (node.getExp() == null) { return; // When the return type of the method is 'void' } if (node.getExp() instanceof ANullExpIR) { return; } node.getExp().apply(this); AMethodDeclIR methodDecl = node.getAncestor(AMethodDeclIR.class); STypeIR expectedType = methodDecl.getMethodType().getResult(); if (expectedType instanceof AUnknownTypeIR) { return; } if (!(expectedType instanceof AUnionTypeIR)) { correctTypes(node.getExp(), expectedType); } }
lambdaDecl.getMethodType().setResult(methodType.getResult().clone());
call.setSourceNode(m.getBody().getSourceNode()); call.setTag(m.getBody().getTag()); call.setType(m.getMethodType().getResult().clone());
@Override public void inAReturnStmIR(AReturnStmIR node) throws AnalysisException { SExpIR exp = node.getExp(); if (exp != null) { exp.apply(this); } else { return; } AMethodDeclIR method = node.getAncestor(AMethodDeclIR.class); AMethodTypeIR methodType = method.getMethodType(); if (methodType.getResult() instanceof AStringTypeIR) { if (!(exp.getType() instanceof SSeqTypeIR)) { return; } correctExpToString(exp); ; } else if (methodType.getResult() instanceof SSeqTypeIR) { if (!(exp.getType() instanceof AStringTypeIR)) { return; } correctExpToSeq(exp, exp.getType()); } }
AVarDeclIR resultDecl = transAssistant.consDecl(funcResultVarName, method.getMethodType().getResult().clone(), node.getExp().clone()); AIdentifierVarExpIR resultVar = transAssistant.getInfo().getExpAssistant().consIdVar(funcResultVarName, resultDecl.getType().clone());
STypeIR strType = toStringMethod.getMethodType().getResult(); emptyRecStr.setType(strType.clone());
condVar.setType(predMethod.getMethodType().clone()); condVar.setName(predMethod.getName()); condVar.setIsLambda(false);
public void handleReturn(AReturnStmIR node) throws AnalysisException { /** * The idea is to extract the return value to variable and return that variable. Then it becomes the * responsibility of the variable declaration case to assert if the named invariant type is violated. */ SExpIR exp = node.getExp(); AMethodDeclIR encMethod = decorator.getJmlGen().getUtil().getEnclosingMethod(node); if (encMethod == null) { return; } STypeIR returnType = encMethod.getMethodType().getResult(); AbstractTypeInfo typeInfo = util.findTypeInfo(returnType); if (!proceed(typeInfo)) { return; } String name = getInfo().getTempVarNameGen().nextVarName(RET_VAR_NAME_PREFIX); AIdentifierPatternIR id = getInfo().getPatternAssistant().consIdPattern(name); AIdentifierVarExpIR varExp = getInfo().getExpAssistant().consIdVar(name, returnType.clone()); getTransAssist().replaceNodeWith(exp, varExp); AVarDeclIR varDecl = getInfo().getDeclAssistant().consLocalVarDecl(returnType.clone(), id, exp.clone()); ABlockStmIR replBlock = new ABlockStmIR(); replBlock.getLocalDefs().add(varDecl); getTransAssist().replaceNodeWith(node, replBlock); replBlock.getStatements().add(node); varDecl.apply(decorator); }
if (correctArgTypes(args, method.getMethodType().getParams(), true))