/** * Creates a new complete constructor {@code ASetRangeSetExp} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param first_ the {@link PExp} node for the {@code first} child of this {@link ASetRangeSetExp} node * @param last_ the {@link PExp} node for the {@code last} child of this {@link ASetRangeSetExp} node * @param ftype_ the {@link PType} <b>graph</a> node for the {@code ftype} child of this {@link ASetRangeSetExp} node. * <i>The parent of this {@code ftype } will not be changed by adding it to this node.</i> * @param ltype_ the {@link PType} <b>graph</a> node for the {@code ltype} child of this {@link ASetRangeSetExp} node. * <i>The parent of this {@code ltype } will not be changed by adding it to this node.</i> */ public ASetRangeSetExp(PType type_, ILexLocation location_, SSetType setType_, PExp first_, PExp last_, PType ftype_, PType ltype_) { super(type_,location_,setType_); this.setFirst(first_); this.setLast(last_); this.setFtype(ftype_); this.setLtype(ltype_); }
@Override public PType caseASetRangeSetExp(ASetRangeSetExp node, TypeCheckInfo question) throws AnalysisException { PExp first = node.getFirst(); PExp last = node.getLast(); question.qualifiers = null; node.setFtype(first.apply(THIS, question.newConstraint(null))); question.qualifiers = null; node.setLtype(last.apply(THIS, question.newConstraint(null))); PType ftype = node.getFtype(); PType ltype = node.getLtype(); if (!question.assistantFactory.createPTypeAssistant().isNumeric(ftype)) { TypeCheckerErrors.report(3166, "Set range type must be a number", first.getLocation(), ftype); ftype = AstFactory.newAIntNumericBasicType(node.getLocation()); } SNumericBasicType ntype = question.assistantFactory.createPTypeAssistant().getNumeric(ftype); if (question.assistantFactory.createSNumericBasicTypeAssistant().getWeight(ntype) > 1) { ftype = AstFactory.newAIntNumericBasicType(node.getLocation()); // Caused by ceiling/floor } if (!question.assistantFactory.createPTypeAssistant().isNumeric(ltype)) { TypeCheckerErrors.report(3167, "Set range type must be a number", last.getLocation(), ltype); } node.setType(AstFactory.newASetSetType(first.getLocation(), ftype)); return question.assistantFactory.createPTypeAssistant().possibleConstraint(question.constraint, node.getType(), node.getLocation()); }