@Override public PTypeSet caseALetStm(ALetStm statement) throws AnalysisException { return statement.getStatement().apply(THIS); }
@Override public Value caseALetStm(ALetStm node, Context ctxt) throws AnalysisException { return evalLet(node, node.getLocation(), node.getLocalDefs(), node.getStatement(), "statement", ctxt); }
/** * Called by the {@link ALetStm} node from {@link ALetStm#apply(IAnalysis)}. * @param node the calling {@link ALetStm} node */ public void caseALetStm(ALetStm node) throws AnalysisException { _visitedNodes.add(node); inALetStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } { List<PDefinition> copy = new ArrayList<PDefinition>(node.getLocalDefs()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getStatement() != null && !_visitedNodes.contains(node.getStatement())) { node.getStatement().apply(this); } outALetStm(node); }
/** * Called by the {@link ALetStm} node from {@link ALetStm#apply(IAnalysis)}. * @param node the calling {@link ALetStm} node */ public void caseALetStm(ALetStm node, Q question) throws AnalysisException { _visitedNodes.add(node); inALetStm(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } { List<PDefinition> copy = new ArrayList<PDefinition>(node.getLocalDefs()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } if(node.getStatement() != null && !_visitedNodes.contains(node.getStatement())) { node.getStatement().apply(this, question); } outALetStm(node, question); }
/** * Called by the {@link ALetStm} node from {@link ALetStm#apply(IPOFAnalysis)}. * @param node the calling {@link ALetStm} node */ public void caseALetStm(ALetStm node) throws AnalysisException { _visitedNodes.add(node); inALetStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } { List<PDefinition> copy = new ArrayList<PDefinition>(node.getLocalDefs()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getStatement() != null && !_visitedNodes.contains(node.getStatement())) { node.getStatement().apply(this); } outALetStm(node); }
@Override public PExp caseALetStm(ALetStm stm, Integer lineno) throws AnalysisException { PExp found = af.createPDefinitionListAssistant().findExpression(stm.getLocalDefs(), lineno); if (found != null) { return found; } return stm.getStatement().apply(THIS, lineno); }
@Override public PType caseALetStm(ALetStm node, TypeCheckInfo question) throws AnalysisException { node.setType(typeCheckLet(node, node.getLocalDefs(),node.getStatement(),question)); return node.getType(); }
/** * Called by the {@link ALetStm} node from {@link ALetStm#apply(IAnalysis)}. * @param node the calling {@link ALetStm} node */ public A caseALetStm(ALetStm node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inALetStm(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } { List<PDefinition> copy = new ArrayList<PDefinition>(node.getLocalDefs()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } if(node.getStatement() != null && !_visitedNodes.contains(node.getStatement())) { mergeReturns(retVal,node.getStatement().apply(this)); } mergeReturns(retVal,outALetStm(node)); return retVal; }
/** * Called by the {@link ALetStm} node from {@link ALetStm#apply(IAnalysis)}. * @param node the calling {@link ALetStm} node */ public A caseALetStm(ALetStm node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inALetStm(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } { List<PDefinition> copy = new ArrayList<PDefinition>(node.getLocalDefs()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } if(node.getStatement() != null && !_visitedNodes.contains(node.getStatement())) { mergeReturns(retVal,node.getStatement().apply(this, question)); } mergeReturns(retVal,outALetStm(node, question)); return retVal; }
@Override public PStm caseALetStm(ALetStm stm, Integer lineno) throws AnalysisException { PStm found = findStatementBaseCase(stm, lineno); if (found != null) { return found; } found = af.createPDefinitionAssistant().findStatement(stm.getLocalDefs(), lineno); if (found != null) { return found; } return stm.getStatement().apply(THIS, lineno); // StmAssistantInterpreter.findStatement(stm.getStatement(), // lineno); }
@Override public SStmIR caseALetStm(ALetStm node, IRInfo question) throws AnalysisException { ABlockStmIR block = new ABlockStmIR(); block.setScoped(question.getStmAssistant().isScoped(node)); question.getDeclAssistant().setFinalLocalDefs(node.getLocalDefs(), block.getLocalDefs(), question); SStmIR stm = node.getStatement().apply(question.getStmVisitor(), question); if (stm != null) { block.getStatements().add(stm); } return block; }
@Override public void caseALetStm(ALetStm node) throws AnalysisException { if (!proceed(node)) { return; } DefinitionInfo defInfo = new DefinitionInfo(node.getLocalDefs(), af); visitDefs(defInfo.getNodeDefs()); openScope(defInfo, node); node.getStatement().apply(this); endScope(defInfo); }
@Override public LexNameSet caseALetStm(ALetStm node, FreeVarInfo info) throws AnalysisException { FreeVarInfo local = info; LexNameSet names = new LexNameSet(); for (PDefinition d : node.getLocalDefs()) { if (d instanceof AExplicitFunctionDefinition) { // ignore } else { local = info.set(new FlatEnvironment(af, d, local.env)); names.addAll(d.apply(this, local)); } } names.addAll(node.getStatement().apply(this, local)); return names; }
@Override public IProofObligationList caseALetStm(ALetStm node, IPOContextStack question) throws AnalysisException { try { IProofObligationList obligations = new ProofObligationList(); for (PDefinition localDef : node.getLocalDefs()) { // PDefinitionAssistantTC.get question.push(new PONameContext(aF.createPDefinitionAssistant().getVariableNames(localDef))); obligations.addAll(localDef.apply(rootVisitor, question)); question.pop(); } question.push(new POScopeContext()); obligations.addAll(node.getStatement().apply(mainVisitor, question)); question.pop(); return obligations; } catch (Exception e) { throw new POException(node, e.getMessage()); } }