@Override public void caseAMapCompMapExp(AMapCompMapExp node) throws AnalysisException { if (!proceed(node)) { return; } handleMultipleBindConstruct(node, node.getBindings(), node.getFirst(), node.getPredicate()); }
/** * m(idx) = { a |-> b } */ private PExp getExistsPredicate(AMapCompMapExp exp, ILexNameToken finmap, ILexNameToken findex) { AApplyExp apply = getApplyExp(getVarExp(finmap), getVarExp(findex)); AMapEnumMapExp setEnum = new AMapEnumMapExp(); List<AMapletExp> members = new Vector<AMapletExp>(); members.add(exp.getFirst().clone()); setEnum.setMembers(members); return getEqualsExp(apply, setEnum); } }
@Override public PExp caseAMapCompMapExp(AMapCompMapExp 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 caseAMapCompMapExp(AMapCompMapExp 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 caseAMapCompMapExp(AMapCompMapExp 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; }
AMapletExp first = node.getFirst(); PExp predicate = node.getPredicate();
ASetEnumSetExp setEnumExp = new ASetEnumSetExp(); List<PExp> member = new LinkedList<PExp>(); member.add(mapCompExp.getFirst().clone()); setEnumExp.setMembers(member); setExp.setFirst(setEnumExp);
&& (node.getPredicate() == null || node.getPredicate().apply(VdmRuntime.getExpressionEvaluator(), evalContext).boolValue(ctxt))) Value dom = node.getFirst().getLeft().apply(VdmRuntime.getExpressionEvaluator(), evalContext); Value rng = node.getFirst().getRight().apply(VdmRuntime.getExpressionEvaluator(), evalContext); node.getFirst().getLocation().hit();
@Override public PType caseAMapCompMapExp(AMapCompMapExp node, TypeCheckInfo question) throws AnalysisException { PDefinition def = AstFactory.newAMultiBindListDefinition(node.getLocation(), node.getBindings()); def.apply(THIS, question.newConstraint(null)); Environment local = new FlatCheckedEnvironment(question.assistantFactory, def, question.env, question.scope); PExp predicate = node.getPredicate(); TypeCheckInfo pquestion = new TypeCheckInfo(question.assistantFactory, local, question.scope, null, AstFactory.newABooleanBasicType(node.getLocation()), null); if (predicate != null && !question.assistantFactory.createPTypeAssistant().isType(predicate.apply(THIS, pquestion), ABooleanBasicType.class)) { TypeCheckerErrors.report(3118, "Predicate is not boolean", predicate.getLocation(), predicate); } node.setType(node.getFirst().apply(THIS, question.newInfo(local))); local.unusedCheck(); return node.getType(); }
obligations.addAll(node.getFirst().apply(mainVisitor, question)); question.pop();