inABlockSimpleBlockStm(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this, question); List<PStm> copy = new ArrayList<PStm>(node.getStatements()); for( PStm e : copy) List<AAssignmentDefinition> copy = new ArrayList<AAssignmentDefinition>(node.getAssignmentDefs()); for( AAssignmentDefinition e : copy)
/** * Returns a deep clone of this {@link ABlockSimpleBlockStm} node. * @return a deep clone of this {@link ABlockSimpleBlockStm} node */ public ABlockSimpleBlockStm clone() { return new ABlockSimpleBlockStm( _location, _type, cloneList(_statements), cloneList(_assignmentDefs) ); }
public static ABlockSimpleBlockStm newABlockSimpleBlockStm( ILexLocation token, List<AAssignmentDefinition> assignmentDefs) { ABlockSimpleBlockStm result = new ABlockSimpleBlockStm(); initStatement(result, token); result.setAssignmentDefs(assignmentDefs); return result; }
@Override public void caseABlockSimpleBlockStm(ABlockSimpleBlockStm node) throws AnalysisException { if (!proceed(node)) { return; } int adds = 0; for (AAssignmentDefinition d : node.getAssignmentDefs()) { defsInScope.add(d); adds++; } for (PStm stm : node.getStatements()) { stm.apply(this); } for (int i = 0; i < adds; i++) { defsInScope.remove(defsInScope.size() - 1); } }
public static String getBlockSimpleBlockString(ABlockSimpleBlockStm node) { StringBuilder sb = new StringBuilder(); sb.append("(\n"); for (PDefinition d : node.getAssignmentDefs()) { sb.append(d); sb.append("\n"); } sb.append("\n"); sb.append(getSimpleBlockString(node)); sb.append(")"); return sb.toString(); }
@Override public Value caseABlockSimpleBlockStm(ABlockSimpleBlockStm node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); Context evalContext = new Context(ctxt.assistantFactory, node.getLocation(), "block statement", ctxt); for (PDefinition d : node.getAssignmentDefs()) { evalContext.putList(ctxt.assistantFactory.createPDefinitionAssistant().getNamedValues(d, evalContext)); } return this.evalBlock(node, evalContext); }
@Override public PType caseABlockSimpleBlockStm(ABlockSimpleBlockStm node, TypeCheckInfo question) throws AnalysisException { // Each dcl definition is in scope for later definitions... Environment local = question.env; for (PDefinition d : node.getAssignmentDefs()) { local = new FlatCheckedEnvironment(question.assistantFactory, d, local, question.scope); // cumulative question.assistantFactory.createPDefinitionAssistant().implicitDefinitions(d, local); d.setType(question.assistantFactory.createPTypeAssistant().typeResolve(d.getType(), null, THIS, question)); d.apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, question.qualifiers, d.getType(), question.returnType)); } // For type checking purposes, the definitions are treated as // local variables. At runtime (below) they have to be treated // more like (updatable) state. PType r = defaultSSimpleBlockStm(node, new TypeCheckInfo(question.assistantFactory, local, question.scope, null, null, question.returnType)); local.unusedCheck(question.env); node.setType(r); return r; }
for (int i = 0; i < node.getStatements().size(); i++) PStm stmt = node.getStatements().get(i); stmt.apply(this); PType stype = stmt.getType(); node.getStatements().remove(unreachStmIndices.get(i).intValue());
@Override public void caseABlockSimpleBlockStm(ABlockSimpleBlockStm node) throws AnalysisException { if (!proceed(node)) { return; } DefinitionInfo defInfo = new DefinitionInfo(node.getAssignmentDefs(), af); visitDefs(defInfo.getNodeDefs()); openScope(defInfo, node); visitStms(node.getStatements()); endScope(defInfo); }
@Override public LexNameSet caseABlockSimpleBlockStm(ABlockSimpleBlockStm node, FreeVarInfo info) throws AnalysisException { FreeVarInfo local = info; for (AAssignmentDefinition d: node.getAssignmentDefs()) { local = local.set(new FlatEnvironment(af, d, local.env)); // cumulative } return defaultSSimpleBlockStm(node, local); }
block.getStatements().add(readStatement()); if (lastToken().isNot(VDMToken.KET) && lastToken().isNot(VDMToken.SEMICOLON)) if (!problems && block.getStatements().isEmpty())
inABlockSimpleBlockStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this); List<PStm> copy = new ArrayList<PStm>(node.getStatements()); for( PStm e : copy) List<AAssignmentDefinition> copy = new ArrayList<AAssignmentDefinition>(node.getAssignmentDefs()); for( AAssignmentDefinition e : copy)
blockStm.setScoped(question.getStmAssistant().isScoped(node)); LinkedList<AAssignmentDefinition> assignmentDefs = node.getAssignmentDefs(); LinkedList<PStm> stms = node.getStatements();
@Override public IProofObligationList caseABlockSimpleBlockStm( ABlockSimpleBlockStm node, IPOContextStack question) throws AnalysisException { try { IProofObligationList obligations = aF.createPDefinitionAssistant().getProofObligations(node.getAssignmentDefs(), rootVisitor, question); question.push(new POScopeContext()); obligations.addAll(defaultSSimpleBlockStm(node, question)); question.pop(); return obligations; } catch (Exception e) { throw new POException(node, e.getMessage()); } }
/** * Creates a deep clone of this {@link ABlockSimpleBlockStm} 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 ABlockSimpleBlockStm} node */ public ABlockSimpleBlockStm clone(Map<INode,INode> oldToNewMap) { ABlockSimpleBlockStm node = new ABlockSimpleBlockStm( _location, _type, cloneList(_statements, oldToNewMap), cloneList(_assignmentDefs, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
inABlockSimpleBlockStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this); List<PStm> copy = new ArrayList<PStm>(node.getStatements()); for( PStm e : copy) List<AAssignmentDefinition> copy = new ArrayList<AAssignmentDefinition>(node.getAssignmentDefs()); for( AAssignmentDefinition e : copy)
mergeReturns(retVal,inABlockSimpleBlockStm(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) mergeReturns(retVal,node.getType().apply(this, question)); List<PStm> copy = new ArrayList<PStm>(node.getStatements()); for( PStm e : copy) List<AAssignmentDefinition> copy = new ArrayList<AAssignmentDefinition>(node.getAssignmentDefs()); for( AAssignmentDefinition e : copy)
mergeReturns(retVal,inABlockSimpleBlockStm(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) mergeReturns(retVal,node.getType().apply(this)); List<PStm> copy = new ArrayList<PStm>(node.getStatements()); for( PStm e : copy) List<AAssignmentDefinition> copy = new ArrayList<AAssignmentDefinition>(node.getAssignmentDefs()); for( AAssignmentDefinition e : copy)