@Override public LexNameSet caseASubseqExp(ASubseqExp node, FreeVarInfo info) throws AnalysisException { LexNameSet names = node.getFrom().apply(this, info); names.addAll(node.getTo().apply(this, info)); return names; }
@Override public ValueList caseASubseqExp(ASubseqExp exp, ObjectContext ctxt) throws AnalysisException { ValueList list = exp.getSeq().apply(THIS, ctxt); list.addAll(exp.getFrom().apply(THIS, ctxt)); list.addAll(exp.getTo().apply(THIS, ctxt)); return list; }
@Override public IProofObligationList caseASubseqExp(ASubseqExp node, IPOContextStack question) throws AnalysisException { IProofObligationList list = node.getSeq().apply(mainVisitor, question); list.addAll(node.getFrom().apply(mainVisitor, question)); list.addAll(node.getTo().apply(mainVisitor, question)); return list; }
@Override public PExp caseASubseqExp(ASubseqExp exp, Integer lineno) throws AnalysisException { PExp found = findExpressionBaseCase(exp, lineno); if (found != null) { return found; } found = exp.getSeq().apply(THIS, lineno); if (found != null) { return found; } found = exp.getFrom().apply(THIS, lineno); if (found != null) { return found; } found = exp.getTo().apply(THIS, lineno); if (found != null) { return found; } return null; }
public LexNameList caseASubseqExp(ASubseqExp expression) throws org.overture.ast.analysis.AnalysisException { LexNameList list = af.createPExpAssistant().getOldNames(expression.getSeq()); list.addAll(af.createPExpAssistant().getOldNames(expression.getFrom())); list.addAll(af.createPExpAssistant().getOldNames(expression.getTo())); return list; }
double tr = node.getTo().apply(VdmRuntime.getExpressionEvaluator(), ctxt).realValue(ctxt); int fi = (int) Math.ceil(fr); int ti = (int) Math.floor(tr);
@Override public SExpIR caseASubseqExp(ASubseqExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); PExp from = node.getFrom(); PExp to = node.getTo(); PExp seq = node.getSeq(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); SExpIR fromCg = from.apply(question.getExpVisitor(), question); SExpIR toCg = to.apply(question.getExpVisitor(), question); SExpIR seqCg = seq.apply(question.getExpVisitor(), question); ASubSeqExpIR subSeq = new ASubSeqExpIR(); subSeq.setType(typeCg); subSeq.setFrom(fromCg); subSeq.setTo(toCg); subSeq.setSeq(seqCg); return subSeq; }
@Override public PType caseASubseqExp(ASubseqExp node, TypeCheckInfo question) throws AnalysisException { TypeCheckInfo noConstraint = question.newConstraint(null); question.qualifiers = null; PType stype = node.getSeq().apply(THIS, noConstraint); question.qualifiers = null; node.setFtype(node.getFrom().apply(THIS, noConstraint)); PType ftype = node.getFtype(); question.qualifiers = null; node.setTtype(node.getTo().apply(THIS, noConstraint)); PType ttype = node.getTtype(); if (!question.assistantFactory.createPTypeAssistant().isSeq(stype)) { TypeCheckerErrors.report(3174, "Subsequence is not of a sequence type", node.getLocation(), node); } question.assistantFactory.createPTypeAssistant(); if (!question.assistantFactory.createPTypeAssistant().isNumeric(ftype)) { TypeCheckerErrors.report(3175, "Subsequence range start is not a number", node.getLocation(), node); } question.assistantFactory.createPTypeAssistant(); if (!question.assistantFactory.createPTypeAssistant().isNumeric(ttype)) { TypeCheckerErrors.report(3176, "Subsequence range end is not a number", node.getLocation(), node); } node.setType(stype); return stype; }