@Override public PType caseAPostOpExp(APostOpExp node, TypeCheckInfo question) throws AnalysisException { node.setType(node.getPostexpression().apply(THIS, question.newConstraint(null))); return node.getType(); }
/** * Creates a new complete constructor {@code APostOpExp} 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 opname_ the {@link ILexNameToken} node for the {@code opname} child of this {@link APostOpExp} node * @param preexpression_ the {@link PExp} <b>graph</a> node for the {@code preexpression} child of this {@link APostOpExp} node. * <i>The parent of this {@code preexpression } will not be changed by adding it to this node.</i> * @param postexpression_ the {@link PExp} <b>graph</a> node for the {@code postexpression} child of this {@link APostOpExp} node. * <i>The parent of this {@code postexpression } will not be changed by adding it to this node.</i> * @param errors_ the {@link GraphNodeList} <b>graph</a> node for the {@code errors} child of this {@link APostOpExp} node. * <i>The parent of this {@code errors } will not be changed by adding it to this node.</i> * @param state_ the {@link AStateDefinition} <b>graph</a> node for the {@code state} child of this {@link APostOpExp} node. * <i>The parent of this {@code state } will not be changed by adding it to this node.</i> * @param errorLocation_ the {@link ILexLocation} node for the {@code errorLocation} child of this {@link APostOpExp} node */ public APostOpExp(PType type_, ILexLocation location_, ILexNameToken opname_, PExp preexpression_, PExp postexpression_, List<? extends AErrorCase> errors_, AStateDefinition state_, ILexLocation errorLocation_) { super(type_,location_); this.setOpname(opname_); this.setPreexpression(preexpression_); this.setPostexpression(postexpression_); this.setErrors(errors_); this.setState(state_); this.setErrorLocation(errorLocation_); }
/** * Creates a new tree field only constructor {@code APostOpExp TAG=postOp} 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 opname_ the {@link ILexNameToken} node for the {@code opname} child of this {@link APostOpExp} node * @param errorLocation_ the {@link ILexLocation} node for the {@code errorLocation} child of this {@link APostOpExp} node */ public APostOpExp(ILexLocation location_, ILexNameToken opname_, ILexLocation errorLocation_) { super(null,location_); this.setOpname(opname_); this.setErrorLocation(errorLocation_); }
public static APostOpExp newAPostOpExp(ILexNameToken opname, PExp preexpression, PExp postexpression, List<AErrorCase> errors, AStateDefinition state) { APostOpExp result = new APostOpExp(); initExpression(result, postexpression.getLocation()); result.setOpname(opname); result.setPreexpression(preexpression); result.setPostexpression(postexpression); result.setErrors(errors); result.setState(state); return result; }
inAPostOpExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this); if(node.getOpname() != null ) node.getOpname().apply(this); if(node.getPreexpression() != null && !_visitedNodes.contains(node.getPreexpression())) node.getPreexpression().apply(this); if(node.getPostexpression() != null && !_visitedNodes.contains(node.getPostexpression())) node.getPostexpression().apply(this); List<AErrorCase> copy = new ArrayList<AErrorCase>(node.getErrors()); for( AErrorCase e : copy) if(node.getState() != null && !_visitedNodes.contains(node.getState())) node.getState().apply(this);
if (node.getState() != null) RecordValue sigma = ctxt.lookup(node.getState().getName()).recordValue(ctxt); for (AFieldField field : node.getState().getFields()) RecordValue oldsigma = ctxt.lookup(node.getState().getName().getOldName()).recordValue(ctxt); for (AFieldField field : node.getState().getFields()) ILexNameToken selfname = node.getOpname().getSelfName(); ILexNameToken oldselfname = selfname.getOldName(); ObjectValue subself = ctxt.assistantFactory.createAPostOpExpAssistant().findObject(node, node.getOpname().getModule(), self); VdmRuntimeError.abort(node.getLocation(), 4026, "Cannot create post_op environment", ctxt); ILexNameToken selfname = node.getOpname().getSelfName(); ILexNameToken oldselfname = selfname.getOldName(); ValueMap oldvalues = ctxt.lookup(oldselfname).mapValue(ctxt); ctxt.assistantFactory.createAPostOpExpAssistant().populate(node, ctxt, node.getOpname().getModule(), oldvalues); boolean result = (node.getErrors().isEmpty() || node.getPreexpression() == null || node.getPreexpression().apply(VdmRuntime.getExpressionEvaluator(), ctxt).boolValue(ctxt)) && node.getPostexpression().apply(VdmRuntime.getExpressionEvaluator(), ctxt).boolValue(ctxt); node.setErrorLocation(node.getLocation());// FIXME not good if (node.getErrors() != null)
@Override public PExp caseAPostOpExp(APostOpExp exp, Integer lineno) throws AnalysisException { return exp.getPostexpression().apply(THIS, lineno); }
@Override public PExp caseAPostOpExp(APostOpExp node, Substitution question) throws AnalysisException { PExp sub = node.getPostexpression().clone().apply(main, question); node.setPostexpression(sub.clone()); return node; }
inAPostOpExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this); if(node.getOpname() != null ) node.getOpname().apply(this); if(node.getPreexpression() != null && !_visitedNodes.contains(node.getPreexpression())) node.getPreexpression().apply(this); if(node.getPostexpression() != null && !_visitedNodes.contains(node.getPostexpression())) node.getPostexpression().apply(this); List<AErrorCase> copy = new ArrayList<AErrorCase>(node.getErrors()); for( AErrorCase e : copy) if(node.getState() != null && !_visitedNodes.contains(node.getState())) node.getState().apply(this);
public LexNameList caseAPostOpExp(APostOpExp expression) throws org.overture.ast.analysis.AnalysisException { return af.createPExpAssistant().getOldNames(expression.getPostexpression()); }
inAPostOpExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this, question); if(node.getOpname() != null ) node.getOpname().apply(this, question); if(node.getPreexpression() != null && !_visitedNodes.contains(node.getPreexpression())) node.getPreexpression().apply(this, question); if(node.getPostexpression() != null && !_visitedNodes.contains(node.getPostexpression())) node.getPostexpression().apply(this, question); List<AErrorCase> copy = new ArrayList<AErrorCase>(node.getErrors()); for( AErrorCase e : copy) if(node.getState() != null && !_visitedNodes.contains(node.getState())) node.getState().apply(this, question);
@Override public SExpIR caseAPostOpExp(APostOpExp node, IRInfo question) throws AnalysisException { PExp exp = node.getPostexpression(); return exp.apply(question.getExpVisitor(), question); }
mergeReturns(retVal,inAPostOpExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) mergeReturns(retVal,node.getType().apply(this)); if(node.getOpname() != null ) mergeReturns(retVal,node.getOpname().apply(this)); if(node.getPreexpression() != null && !_visitedNodes.contains(node.getPreexpression())) mergeReturns(retVal,node.getPreexpression().apply(this)); if(node.getPostexpression() != null && !_visitedNodes.contains(node.getPostexpression())) mergeReturns(retVal,node.getPostexpression().apply(this)); List<AErrorCase> copy = new ArrayList<AErrorCase>(node.getErrors()); for( AErrorCase e : copy) if(node.getState() != null && !_visitedNodes.contains(node.getState())) mergeReturns(retVal,node.getState().apply(this));
private PExp rewritePost(PExp post_exp, List<Substitution> subs, IPogAssistantFactory af) { if (post_exp instanceof APostOpExp) { // post-expression bodies are wrapped in a PostOpExp for some reason... post_exp = ((APostOpExp) post_exp).getPostexpression(); } for (Substitution sub : subs) { try { post_exp = post_exp.clone().apply(af.getVarSubVisitor(), sub); } catch (AnalysisException e) { e.printStackTrace(); } } return post_exp; }
mergeReturns(retVal,inAPostOpExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) mergeReturns(retVal,node.getType().apply(this, question)); if(node.getOpname() != null ) mergeReturns(retVal,node.getOpname().apply(this, question)); if(node.getPreexpression() != null && !_visitedNodes.contains(node.getPreexpression())) mergeReturns(retVal,node.getPreexpression().apply(this, question)); if(node.getPostexpression() != null && !_visitedNodes.contains(node.getPostexpression())) mergeReturns(retVal,node.getPostexpression().apply(this, question)); List<AErrorCase> copy = new ArrayList<AErrorCase>(node.getErrors()); for( AErrorCase e : copy) if(node.getState() != null && !_visitedNodes.contains(node.getState())) mergeReturns(retVal,node.getState().apply(this, question));