@Override public PType caseAClassInvariantStm(AClassInvariantStm node, TypeCheckInfo question) { // Definitions already checked. node.setType(AstFactory.newABooleanBasicType(node.getLocation())); return node.getType(); }
/** * Returns a deep clone of this {@link AClassInvariantStm} node. * @return a deep clone of this {@link AClassInvariantStm} node */ public AClassInvariantStm clone() { return new AClassInvariantStm( _location, _type, cloneNode(_name), _invDefs ); }
/** * Creates a new complete constructor {@code AClassInvariantStm} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param name_ the {@link ILexNameToken} node for the {@code name} child of this {@link AClassInvariantStm} node * @param invDefs_ the {@link GraphNodeList} <b>graph</a> node for the {@code invDefs} child of this {@link AClassInvariantStm} node. * <i>The parent of this {@code invDefs } will not be changed by adding it to this node.</i> */ public AClassInvariantStm(ILexLocation location_, PType type_, ILexNameToken name_, List<? extends PDefinition> invDefs_) { super(location_,type_); this.setName(name_); this.setInvDefs(invDefs_); }
/** * Called by the {@link AClassInvariantStm} node from {@link AClassInvariantStm#apply(IAnalysis)}. * @param node the calling {@link AClassInvariantStm} node */ public void caseAClassInvariantStm(AClassInvariantStm node, Q question) throws AnalysisException { _visitedNodes.add(node); inAClassInvariantStm(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getName() != null ) { node.getName().apply(this, question); } { List<PDefinition> copy = new ArrayList<PDefinition>(node.getInvDefs()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } outAClassInvariantStm(node, question); }
@Override public Value caseAClassInvariantStm(AClassInvariantStm node, Context ctxt) throws AnalysisException { for (PDefinition d : node.getInvDefs()) { AClassInvariantDefinition invdef = (AClassInvariantDefinition) d; try { if (!invdef.getExpression().apply(VdmRuntime.getStatementEvaluator(), ctxt).boolValue(ctxt)) { return new BooleanValue(false); } } catch (ValueException e) { VdmRuntimeError.abort(node.getLocation(), e); } } return new BooleanValue(true); }
for (PDefinition d : node.getInvDefs())
public static AClassInvariantStm newAClassInvariantStm(ILexNameToken name, List<PDefinition> invdefs) { AClassInvariantStm result = new AClassInvariantStm(); initStatement(result, name.getLocation()); result.setName(name); result.setInvDefs(invdefs); name.getLocation().executable(false); return result; }
/** * Called by the {@link AClassInvariantStm} node from {@link AClassInvariantStm#apply(IAnalysis)}. * @param node the calling {@link AClassInvariantStm} node */ public void caseAClassInvariantStm(AClassInvariantStm node) throws AnalysisException { _visitedNodes.add(node); inAClassInvariantStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getName() != null ) { node.getName().apply(this); } { List<PDefinition> copy = new ArrayList<PDefinition>(node.getInvDefs()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAClassInvariantStm(node); }
/** * Called by the {@link AClassInvariantStm} node from {@link AClassInvariantStm#apply(IPOFAnalysis)}. * @param node the calling {@link AClassInvariantStm} node */ public void caseAClassInvariantStm(AClassInvariantStm node) throws AnalysisException { _visitedNodes.add(node); inAClassInvariantStm(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getName() != null ) { node.getName().apply(this); } { List<PDefinition> copy = new ArrayList<PDefinition>(node.getInvDefs()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAClassInvariantStm(node); }
/** * Creates a deep clone of this {@link AClassInvariantStm} 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 AClassInvariantStm} node */ public AClassInvariantStm clone(Map<INode,INode> oldToNewMap) { AClassInvariantStm node = new AClassInvariantStm( _location, _type, cloneNode(_name, oldToNewMap), _invDefs ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link AClassInvariantStm} node from {@link AClassInvariantStm#apply(IAnalysis)}. * @param node the calling {@link AClassInvariantStm} node */ public A caseAClassInvariantStm(AClassInvariantStm node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAClassInvariantStm(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getName() != null ) { mergeReturns(retVal,node.getName().apply(this)); } { List<PDefinition> copy = new ArrayList<PDefinition>(node.getInvDefs()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } mergeReturns(retVal,outAClassInvariantStm(node)); return retVal; }
/** * Called by the {@link AClassInvariantStm} node from {@link AClassInvariantStm#apply(IAnalysis)}. * @param node the calling {@link AClassInvariantStm} node */ public A caseAClassInvariantStm(AClassInvariantStm node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAClassInvariantStm(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getName() != null ) { mergeReturns(retVal,node.getName().apply(this, question)); } { List<PDefinition> copy = new ArrayList<PDefinition>(node.getInvDefs()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } mergeReturns(retVal,outAClassInvariantStm(node, question)); return retVal; }