@Override public PType defaultPMultipleBind(PMultipleBind node, TypeCheckInfo question) throws AnalysisException { return node.apply(patternDefinition, question); }
public Collection<? extends PDefinition> getDefinitions(PMultipleBind mb, PType type, TypeCheckInfo question) { List<PDefinition> defs = new Vector<PDefinition>(); for (PPattern p : mb.getPlist()) { defs.addAll(af.createPPatternAssistant().getDefinitions(p, type, question.scope)); } return defs; }
protected List<PMultipleBind> cloneListMultipleBind( List<PMultipleBind> binds) { List<PMultipleBind> r = new LinkedList<PMultipleBind>(); for (PMultipleBind bind : binds) { r.add(bind.clone()); } return r; }
public LetBeExistsObligation(ALetBeStStm stmt, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(stmt, POType.LET_BE_EXISTS, ctxt, stmt.getBind().getLocation(), af); AExistsExp exists = new AExistsExp(); List<PMultipleBind> bindList = new Vector<PMultipleBind>(); bindList.add(stmt.getBind().clone()); exists.setBindList(bindList); if (stmt.getSuchThat() != null) { exists.setPredicate(stmt.getSuchThat().clone()); } else { // we just use true since we cannot have // exists by itself ABooleanConstExp replacementNothing_exp = new ABooleanConstExp(); replacementNothing_exp.setValue(new LexBooleanToken(true, null)); exists.setPredicate(replacementNothing_exp); } stitch = exists; valuetree.setPredicate(ctxt.getPredWithContext(exists)); } }
/** * Sets the {@code _bind} child of this {@link ALetBeStBindingTraceDefinition} node. * @param value the new {@code _bind} child of this {@link ALetBeStBindingTraceDefinition} node */ public void setBind(PMultipleBind value) { if (this._bind != null) { this._bind.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._bind = value; }
@Override public ILexLocation defaultPMultipleBind(PMultipleBind node) throws AnalysisException { return node.getLocation(); }
public String toString() { return (_bind!=null?_bind.toString():this.getClass().getSimpleName())+ (_stexp!=null?_stexp.toString():this.getClass().getSimpleName())+ (_body!=null?_body.toString():this.getClass().getSimpleName())+ (_def!=null?_def.toString():this.getClass().getSimpleName()); }
public LetBeExistsObligation(ALetBeStExp exp, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(exp, POType.LET_BE_EXISTS, ctxt, exp.getBind().getLocation(), af); /** * let <binds> be st <predicate> in <exp> produces exists <binds> & <predicate> */ AExistsExp exists = new AExistsExp(); List<PMultipleBind> bindList = new Vector<PMultipleBind>(); bindList.add(exp.getBind().clone()); exists.setBindList(bindList); if (exp.getSuchThat() != null) { exists.setPredicate(exp.getSuchThat().clone()); } else { // we just use true since we cannot have // exists by itself ABooleanConstExp replacementNothing_exp = new ABooleanConstExp(); replacementNothing_exp.setValue(new LexBooleanToken(true, null)); exists.setPredicate(replacementNothing_exp); } stitch = exists; valuetree.setPredicate(ctxt.getPredWithContext(exists)); }
/** * Sets the {@code _bind} child of this {@link ALetBeStStm} node. * @param value the new {@code _bind} child of this {@link ALetBeStStm} node */ public void setBind(PMultipleBind value) { if (this._bind != null) { this._bind.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._bind = value; }
private List<PDefinition> getMultipleBindDefs(List<PMultipleBind> bindings) { List<PDefinition> defs = new Vector<PDefinition>(); for (PMultipleBind mb : bindings) { for (PPattern pattern : mb.getPlist()) { defs.addAll(af.createPPatternAssistant().getDefinitions(pattern, af.createPMultipleBindAssistant().getPossibleType(mb), NameScope.LOCAL)); } } return defs; }
/** * Sets the {@code _bind} child of this {@link ALetBeStExp} node. * @param value the new {@code _bind} child of this {@link ALetBeStExp} node */ public void setBind(PMultipleBind value) { if (this._bind != null) { this._bind.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._bind = value; }
private List<PMultipleBind> cloneBinds(List<PMultipleBind> multipleBindList) { List<PMultipleBind> r = new LinkedList<PMultipleBind>(); for (PMultipleBind pmb : multipleBindList) { r.add(pmb.clone()); } return r; }
public PType getPossibleType(PMultipleBind mb) { try { return mb.apply(af.getPossibleBindTypeFinder()); } catch (AnalysisException e) { return null; } }
for (PPattern p : mb.getPlist())
private void validateQuantifiedExp(PExp node, List<PMultipleBind> bindings, String nodeStr) throws AnalysisException { if (inUnsupportedContext(node)) { info.addUnsupportedNode(node, String.format("Generation of a %s is only supported within operations/functions", nodeStr)); } for (PMultipleBind mb : bindings) { mb.apply(this); } }
for (PPattern p : mb.getPlist())
public ValueList getValues(PMultipleBind mb, ObjectContext ctxt) { try { return mb.apply(af.getValueCollector(), ctxt);// FIXME: should we handle exceptions like this } catch (AnalysisException e) { return new ValueList(); } }
for (PPattern p : mb.getPlist())
public ValueList getBindValues(PMultipleBind mb, Context ctxt, boolean permuted) throws ValueException, AnalysisException { return mb.apply(af.getBindValuesCollector(), new BindState(ctxt, permuted)); }