/** * m(idx) = f(a) */ private PExp getExistsPredicate(ASetCompSetExp exp, ILexNameToken finmap, ILexNameToken findex) { AApplyExp apply = getApplyExp(getVarExp(finmap), getVarExp(findex)); return getEqualsExp(apply, exp.getFirst()); }
@Override public void caseASetCompSetExp(ASetCompSetExp node) throws AnalysisException { if (!proceed(node)) { return; } handleMultipleBindConstruct(node, node.getBindings(), node.getFirst(), node.getPredicate()); }
@Override public PExp caseASetCompSetExp(ASetCompSetExp exp, Integer lineno) throws AnalysisException { PExp found = findExpressionBaseCase(exp, lineno); if (found != null) { return found; } found = exp.getFirst().apply(THIS, lineno); if (found != null) { return found; } return exp.getPredicate() == null ? null : exp.getPredicate().apply(THIS, lineno); }
@Override public ValueList caseASetCompSetExp(ASetCompSetExp exp, ObjectContext ctxt) throws AnalysisException { ValueList list = exp.getFirst().apply(THIS, ctxt); for (PMultipleBind mb : exp.getBindings()) { list.addAll(ctxt.assistantFactory.createPMultipleBindAssistant().getValues(mb, ctxt)); } if (exp.getPredicate() != null) { list.addAll(exp.getPredicate().apply(THIS, ctxt)); } return list; }
@Override public LexNameList caseASetCompSetExp(ASetCompSetExp expression) throws AnalysisException { LexNameList list = af.createPExpAssistant().getOldNames(expression.getFirst()); for (PMultipleBind mb : expression.getBindings()) { list.addAll(mb.apply(this)); } if (expression.getPredicate() != null) { list.addAll(af.createPExpAssistant().getOldNames(expression.getPredicate())); } return list; }
PExp first = node.getFirst(); PExp predicate = node.getPredicate();
@Override public PType caseASetCompSetExp(ASetCompSetExp node, TypeCheckInfo question) throws AnalysisException { PDefinition def = AstFactory.newAMultiBindListDefinition(node.getFirst().getLocation(), node.getBindings()); def.apply(THIS, question.newConstraint(null)); Environment local = new FlatCheckedEnvironment(question.assistantFactory, def, question.env, question.scope); question = new TypeCheckInfo(question.assistantFactory, local, question.scope); PType etype = node.getFirst().apply(THIS, question.newConstraint(null)); PExp predicate = node.getPredicate(); if (predicate != null) { TypeCheckInfo pquestion = new TypeCheckInfo(question.assistantFactory, local, question.scope, null, AstFactory.newABooleanBasicType(node.getLocation()), null); if (!question.assistantFactory.createPTypeAssistant().isType(predicate.apply(THIS, pquestion), ABooleanBasicType.class)) { TypeCheckerErrors.report(3159, "Predicate is not boolean", predicate.getLocation(), predicate); } } local.unusedCheck(); SSetType setType = AstFactory.newASetSetType(node.getLocation(), etype); node.setType(setType); node.setSetType(setType); return setType; }
PExp first = node.getFirst(); PExp predicate = node.getPredicate();
&& (node.getPredicate() == null || node.getPredicate().apply(VdmRuntime.getExpressionEvaluator(), evalContext).boolValue(ctxt))) set.add(node.getFirst().apply(VdmRuntime.getExpressionEvaluator(), evalContext));