public String getName(SPatternIR id) { if (!(id instanceof AIdentifierPatternIR)) { log.error("Expected identifier pattern " + "to be an identifier pattern at this point. Got: " + id); return null; } return ((AIdentifierPatternIR) id).getName(); }
public String getMethodCondArgName(SPatternIR pattern) { // By now all patterns should be identifier patterns if (pattern instanceof AIdentifierPatternIR) { String paramName = ((AIdentifierPatternIR) pattern).getName(); if (jmlGen.getJavaGen().getInfo().getExpAssistant().isOld(paramName)) { paramName = toJmlOldExp(paramName); } else if (jmlGen.getJavaGen().getInfo().getExpAssistant().isResult(paramName)) { // The type checker prohibits use of 'RESULT' as name of a user specified identifier paramName = JmlGenerator.JML_RESULT; } return paramName; } else { log.error("Expected formal parameter pattern to be an indentifier pattern. Got: " + pattern); return "UNKNOWN"; } }
String idConstName = idConstNameMap.get(idToReg.getName()); block.getStatements().add(transAssist.wrap(storeAssistant.consIdConstDecl(idConstName))); storeAssistant.appendStoreRegStms(block, idToReg.getName(), idConstName, false); traceVars.add(this.transAssist.getInfo().getExpAssistant().consIdVar(idToReg.getName(), PatternTypeFinder.getType(typeFinder, idToReg))); ACallObjectExpStmIR addCall = transAssist.consInstanceCallStm(instanceType, id.getName(), tracePrefixes.addMethodName(), subject); block.getStatements().add(addCall);
storeAssistant.getIdConstNameMap().put(occ.getName(), idConstName); outer.getLocalDefs().add(storeAssistant.consIdConstDecl(idConstName)); storeAssistant.appendStoreRegStms(declBlock, occ.getName(), idConstName, false); traceVars.add(getInfo().getExpAssistant().consIdVar(occ.getName(), PatternTypeFinder.getType(typeFinder, occ)));
this.paramName = ((AIdentifierPatternIR) param.getPattern()).getName();
@Override protected List<SStmIR> getConditionalAdd(AIdentifierVarExpIR setVar, List<SPatternIR> patterns, SPatternIR pattern) { AIdentifierVarExpIR mapCompResult = new AIdentifierVarExpIR(); mapCompResult.setType(compType.clone()); mapCompResult.setName(idPattern.getName()); mapCompResult.setIsLambda(false); mapCompResult.setIsLocal(true); AMapCompAddStmIR add = new AMapCompAddStmIR(); add.setMap(mapCompResult); add.setElement(first.clone()); return consConditionalAdd(mapCompResult, add); } }
@Override protected List<SStmIR> getConditionalAdd(AIdentifierVarExpIR setVar, List<SPatternIR> patterns, SPatternIR pattern) { AIdentifierVarExpIR seqCompResult = new AIdentifierVarExpIR(); seqCompResult.setType(compType.clone()); seqCompResult.setName(idPattern.getName()); seqCompResult.setIsLambda(false); seqCompResult.setIsLocal(true); ASeqCompAddStmIR add = new ASeqCompAddStmIR(); add.setSeq(seqCompResult); add.setElement(first.clone()); return consConditionalAdd(seqCompResult, add); }
@Override protected List<SStmIR> getConditionalAdd(AIdentifierVarExpIR setVar, List<SPatternIR> patterns, SPatternIR pattern) { AIdentifierVarExpIR setCompResult = new AIdentifierVarExpIR(); setCompResult.setType(compType.clone()); setCompResult.setName(idPattern.getName()); setCompResult.setIsLambda(false); setCompResult.setIsLocal(true); ASetCompAddStmIR add = new ASetCompAddStmIR(); add.setSet(setCompResult); add.setElement(first.clone()); return consConditionalAdd(setCompResult, add); } }
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; }
argName = ((AIdentifierPatternIR) pattern).getName(); } else
paramArg.setIsLocal(true); paramArg.setIsLambda(false); paramArg.setName(paramId.getName());
var.setIsLocal(true); var.setType(param.getType().clone()); var.setName(idPattern.getName()); var.setIsLambda(false); var.setSourceNode(pattern.getSourceNode());
var.setName(idPattern.getName()); var.setIsLambda(false); var.setIsLocal(true);
recordPatternVar.setName(idPattern.getName()); recordPatternVar.setIsLambda(false); recordPatternVar.setIsLocal(true);
tuplePatternVar.setName(idPattern.getName()); tuplePatternVar.setIsLambda(false); tuplePatternVar.setIsLocal(true);
if(pattern instanceof AIdentifierPatternIR) name = ((AIdentifierPatternIR) pattern).getName();
storeAssistant.getIdConstNameMap().put(((AIdentifierPatternIR) p).getName(), idConstName);