public POForAllContext(PBind bind, PExp exp) { // Create new binding for "bind.pattern in set elems exp" bindings = new Vector<PMultipleBind>(); List<PPattern> pl = new ArrayList<PPattern>(); pl.add(bind.getPattern().clone()); AElementsUnaryExp elems = AstFactory.newAElementsUnaryExp(exp.getLocation(), exp.clone()); ASetMultipleBind msb = AstFactory.newASetMultipleBind(pl, elems); bindings.add(msb); }
@Override public ILexLocation defaultPBind(PBind node) throws AnalysisException { return node.getLocation(); }
if (node.getBind().getPattern() != null) question.assistantFactory.createPPatternAssistant().typeResolve(node.getBind().getPattern(), THIS, question); TypeCheckerErrors.report(3198, "Type bind not compatible with expression", node.getBind().getLocation(), node.getBind()); TypeCheckerErrors.detail2("Bind", typebind.getType(), "Exp", type); TypeCheckerErrors.report(3199, "Set bind not compatible with expression", node.getBind().getLocation(), node.getBind()); TypeCheckerErrors.report(3199, "Set bind not compatible with expression", node.getBind().getLocation(), node.getBind()); TypeCheckerErrors.detail2("Bind", settype.getSetof(), "Exp", type); TypeCheckerErrors.report(3199, "Seq bind not compatible with expression", node.getBind().getLocation(), node.getBind()); TypeCheckerErrors.report(3199, "Seq bind not compatible with expression", node.getBind().getLocation(), node.getBind()); TypeCheckerErrors.detail2("Bind", seqtype.getSeqof(), "Exp", type); PDefinition def = AstFactory.newAMultiBindListDefinition(node.getBind().getLocation(), question.assistantFactory.createPBindAssistant().getMultipleBindList(node.getBind()));
/** * Sets the {@code _bind} child of this {@link ADefPatternBind} node. * @param value the new {@code _bind} child of this {@link ADefPatternBind} node */ public void setBind(PBind 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; }
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)); } }
/** * Sets the {@code _bind} child of this {@link AIotaExp} node. * @param value the new {@code _bind} child of this {@link AIotaExp} node */ public void setBind(PBind 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; }
public List<PMultipleBind> getMultipleBindList(PBind bind) { try { return bind.apply(af.getMultipleBindLister()); } catch (AnalysisException e) { return null; } }
public List<PMultipleBind> getMultipleBindList(PBind bind) { List<PPattern> plist = new ArrayList<PPattern>(); plist.add(bind.getPattern()); List<PMultipleBind> mblist = new Vector<PMultipleBind>(); if (bind instanceof ASetBind) { mblist.add(AstFactory.newASetMultipleBind(plist, ((ASetBind)bind).getSet())); } else { mblist.add(AstFactory.newASetMultipleBind(plist, ((ASeqBind)bind).getSeq())); } return mblist; } }
TypeCheckerErrors.report(3198, "Type bind not compatible with expression", bind.getLocation(), bind); TypeCheckerErrors.detail2("Bind", typebind.getType(), "Exp", type); TypeCheckerErrors.report(3199, "Set bind not compatible with expression", bind.getLocation(), bind); TypeCheckerErrors.detail2("Bind", settype.getSetof(), "Exp", type); PDefinition def = AstFactory.newAMultiBindListDefinition(bind.getLocation(), question.assistantFactory.createPBindAssistant().getMultipleBindList(bind));
/** * Sets the {@code _bind} child of this {@link AExists1Exp} node. * @param value the new {@code _bind} child of this {@link AExists1Exp} node */ public void setBind(PBind 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; }
public ValueList getValues(PBind bind, ObjectContext ctxt) { try { return bind.apply(af.getBindValueCollector(), ctxt);// FIXME: should we handle exceptions like this } catch (AnalysisException e) { return new ValueList(); } }
evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(node.getBind().getPattern(), val, ctxt));
public ADefPatternBind readPatternOrBind() throws ParserException, LexException { ParserException bindError = null; try { reader.push(); PBind bind = readBind(); reader.unpush(); return AstFactory.newADefPatternBind(bind.getLocation(), bind); } catch (ParserException e) { e.adjustDepth(reader.getTokensRead()); reader.pop(); bindError = e; } try { reader.push(); PPattern p = getPatternReader().readPattern(); reader.unpush(); return AstFactory.newADefPatternBind(p.getLocation(), p); } catch (ParserException e) { e.adjustDepth(reader.getTokensRead()); reader.pop(); throw e.deeperThan(bindError) ? e : bindError; } }
public ValueList getBindValues(PBind bind, Context ctxt, boolean permuted) throws AnalysisException { return bind.apply(af.getSingleBindValuesCollector(), new BindState(ctxt, permuted)); }
pattern = node.getPatternBind().getBind().getPattern();
@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()); }
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; }
evalContext.putList(ctxt.assistantFactory.createPPatternAssistant().getNamedValues(node.getBind().getPattern(), val, ctxt));
public LexNameList caseAIotaExp(AIotaExp expression) throws org.overture.ast.analysis.AnalysisException { LexNameList list = expression.getBind().apply(this); list.addAll(af.createPExpAssistant().getOldNames(expression.getPredicate())); return list; }