public POForAllPredicateContext(ITypeCheckerAssistantFactory af, AExists1Exp exp) { super(af, exp); this.predicate = exp.getPredicate(); }
public static AExists1Exp newAExists1Exp(ILexLocation start, PBind bind, PExp predicate) { AExists1Exp result = new AExists1Exp(); initExpression(result, start); result.setBind(bind); result.setPredicate(predicate); return result; }
/** * Creates a new tree field only constructor {@code AExists1Exp TAG=exists1} 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 bind_ the {@link PBind} node for the {@code bind} child of this {@link AExists1Exp} node * @param predicate_ the {@link PExp} node for the {@code predicate} child of this {@link AExists1Exp} node * @param def_ the {@link PDefinition} node for the {@code def} child of this {@link AExists1Exp} node */ public AExists1Exp(ILexLocation location_, PBind bind_, PExp predicate_, PDefinition def_) { super(null,location_); this.setBind(bind_); this.setPredicate(predicate_); this.setDef(def_); }
/** * Returns a deep clone of this {@link AExists1Exp} node. * @return a deep clone of this {@link AExists1Exp} node */ public AExists1Exp clone() { return new AExists1Exp( _type, _location, cloneNode(_bind), cloneNode(_predicate), cloneNode(_def) ); }
/** * Called by the {@link AExists1Exp} node from {@link AExists1Exp#apply(IAnalysis)}. * @param node the calling {@link AExists1Exp} node */ public void caseAExists1Exp(AExists1Exp node, Q question) throws AnalysisException { _visitedNodes.add(node); inAExists1Exp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getBind() != null && !_visitedNodes.contains(node.getBind())) { node.getBind().apply(this, question); } if(node.getPredicate() != null && !_visitedNodes.contains(node.getPredicate())) { node.getPredicate().apply(this, question); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { node.getDef().apply(this, question); } outAExists1Exp(node, question); }
@Override public PType caseAExists1Exp(AExists1Exp node, TypeCheckInfo question) throws AnalysisException { node.setDef(AstFactory.newAMultiBindListDefinition(node.getBind().getLocation(), question.assistantFactory.createPBindAssistant().getMultipleBindList(node.getBind()))); node.getDef().apply(THIS, question.newConstraint(null)); Environment local = new FlatCheckedEnvironment(question.assistantFactory, node.getDef(), question.env, question.scope); if (node.getBind() instanceof ATypeBind) { ATypeBind tb = (ATypeBind) node.getBind(); question.assistantFactory.createATypeBindAssistant().typeResolve(tb, THIS, question); } question.qualifiers = null; if (!question.assistantFactory.createPTypeAssistant().isType(node.getPredicate().apply(THIS, new TypeCheckInfo(question.assistantFactory, local, question.scope, null, AstFactory.newABooleanBasicType(node.getLocation()), null)), ABooleanBasicType.class)) { TypeCheckerErrors.report(3088, "Predicate is not boolean", node.getPredicate().getLocation(), node.getPredicate()); } local.unusedCheck(); node.setType(AstFactory.newABooleanBasicType(node.getLocation())); return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }
@Override public LexNameSet caseAExists1Exp(AExists1Exp node, FreeVarInfo info) throws AnalysisException { PDefinition def = node.getDef(); FreeVarInfo local = info.set(new FlatEnvironment(af, def, info.env)); LexNameSet names = new LexNameSet(); if (node.getPredicate() != null) { names.addAll(node.getPredicate().apply(this, local)); } names.addAll(node.getBind().apply(this, local)); return names; }
@Override public SExpIR caseAExists1Exp(AExists1Exp node, IRInfo question) throws AnalysisException { PBind bind = node.getBind(); SBindIR bindCg = bind.apply(question.getBindVisitor(), question); PType type = node.getType(); PExp predicate = node.getPredicate(); SMultipleBindIR multipleBind = question.getBindAssistant().convertToMultipleBind(bindCg); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); SExpIR predicateCg = predicate.apply(question.getExpVisitor(), question); AExists1QuantifierExpIR exists1Exp = new AExists1QuantifierExpIR(); exists1Exp.getBindList().add(multipleBind); exists1Exp.setType(typeCg); exists1Exp.setPredicate(predicateCg); return exists1Exp; }
throws AnalysisException BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); ValueList allValues = null; boolean alreadyFound = false; allValues = ctxt.assistantFactory.createPBindAssistant().getBindValues(node.getBind(), ctxt, false); } catch (ValueException e) VdmRuntimeError.abort(node.getLocation(), e); Context evalContext = new Context(ctxt.assistantFactory, node.getLocation(), "exists1", ctxt); evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(node.getBind().getPattern(), val, ctxt)); if (node.getPredicate().apply(VdmRuntime.getExpressionEvaluator(), evalContext).boolValue(ctxt)) VdmRuntimeError.abort(node.getLocation(), e); } catch (PatternMatchException e)
@Override public ValueList caseAExists1Exp(AExists1Exp exp, ObjectContext ctxt) throws AnalysisException { ValueList list = af.createPBindAssistant().getValues(exp.getBind(), ctxt); list.addAll(exp.getPredicate().apply(THIS, ctxt)); return list; }
@Override public void caseAExists1Exp(AExists1Exp node) throws AnalysisException { if (inUnsupportedContext(node)) { info.addUnsupportedNode(node, String.format("Generation of an %s is only supported within operations/functions", "exists1 expression")); } if (node.getBind() instanceof ATypeBind) { info.addUnsupportedNode(node, String.format("Generation of an %s is only supported for set binds or sequence binds", "exists1 expression")); } }
/** * Called by the {@link AExists1Exp} node from {@link AExists1Exp#apply(IPOFAnalysis)}. * @param node the calling {@link AExists1Exp} node */ public void caseAExists1Exp(AExists1Exp node) throws AnalysisException { _visitedNodes.add(node); inAExists1Exp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getBind() != null && !_visitedNodes.contains(node.getBind())) { node.getBind().apply(this); } if(node.getPredicate() != null && !_visitedNodes.contains(node.getPredicate())) { node.getPredicate().apply(this); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { node.getDef().apply(this); } outAExists1Exp(node); }
public LexNameList caseAExists1Exp(AExists1Exp expression) throws org.overture.ast.analysis.AnalysisException { LexNameList list = expression.getBind().apply(this); list.addAll(af.createPExpAssistant().getOldNames(expression.getPredicate())); return list; }
public POForAllContext(ITypeCheckerAssistantFactory af, AExists1Exp exp) { this.bindings = af.createPBindAssistant().getMultipleBindList(exp.getBind()); }
/** * Creates a deep clone of this {@link AExists1Exp} 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 AExists1Exp} node */ public AExists1Exp clone(Map<INode,INode> oldToNewMap) { AExists1Exp node = new AExists1Exp( _type, _location, cloneNode(_bind, oldToNewMap), cloneNode(_predicate, oldToNewMap), cloneNode(_def, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link AExists1Exp} node from {@link AExists1Exp#apply(IAnalysis)}. * @param node the calling {@link AExists1Exp} node */ public void caseAExists1Exp(AExists1Exp node) throws AnalysisException { _visitedNodes.add(node); inAExists1Exp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getBind() != null && !_visitedNodes.contains(node.getBind())) { node.getBind().apply(this); } if(node.getPredicate() != null && !_visitedNodes.contains(node.getPredicate())) { node.getPredicate().apply(this); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { node.getDef().apply(this); } outAExists1Exp(node); }
@Override public PExp caseAExists1Exp(AExists1Exp exp, Integer lineno) throws AnalysisException { PExp found = findExpressionBaseCase(exp, lineno); if (found != null) { return found; } return exp.getPredicate().apply(THIS, lineno);// PExpAssistantInterpreter.findExpression(exp.getPredicate(), // lineno); }
public UniqueExistenceObligation(AIotaExp iota, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(iota, POType.UNIQUE_EXISTENCE, ctxt, iota.getLocation(), af); // exists1 iotaBinds & iotaPredicate AExists1Exp exists1Exp = new AExists1Exp(); exists1Exp.setBind(iota.getBind().clone()); exists1Exp.setPredicate(iota.getPredicate().clone()); // valuetree.setContext(ctxt.getContextNodeList()); stitch = exists1Exp; valuetree.setPredicate(ctxt.getPredWithContext(exists1Exp)); } }
/** * Creates a new complete constructor {@code AExists1Exp} 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 bind_ the {@link PBind} node for the {@code bind} child of this {@link AExists1Exp} node * @param predicate_ the {@link PExp} node for the {@code predicate} child of this {@link AExists1Exp} node * @param def_ the {@link PDefinition} node for the {@code def} child of this {@link AExists1Exp} node */ public AExists1Exp(PType type_, ILexLocation location_, PBind bind_, PExp predicate_, PDefinition def_) { super(type_,location_); this.setBind(bind_); this.setPredicate(predicate_); this.setDef(def_); }
/** * Called by the {@link AExists1Exp} node from {@link AExists1Exp#apply(IAnalysis)}. * @param node the calling {@link AExists1Exp} node */ public A caseAExists1Exp(AExists1Exp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAExists1Exp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getBind() != null && !_visitedNodes.contains(node.getBind())) { mergeReturns(retVal,node.getBind().apply(this, question)); } if(node.getPredicate() != null && !_visitedNodes.contains(node.getPredicate())) { mergeReturns(retVal,node.getPredicate().apply(this, question)); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { mergeReturns(retVal,node.getDef().apply(this, question)); } mergeReturns(retVal,outAExists1Exp(node, question)); return retVal; }