/** * Creates a new complete constructor {@code ATupleExp} 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 args_ the {@link NodeList} node for the {@code args} child of this {@link ATupleExp} node * @param types_ the {@link GraphNodeList} <b>graph</a> node for the {@code types} child of this {@link ATupleExp} node. * <i>The parent of this {@code types } will not be changed by adding it to this node.</i> */ public ATupleExp(PType type_, ILexLocation location_, List<? extends PExp> args_, List<? extends PType> types_) { super(type_,location_); this.setArgs(args_); this.setTypes(types_); }
@Override public PType caseATupleExp(ATupleExp node, TypeCheckInfo question) throws AnalysisException { node.setTypes(new LinkedList<PType>()); List<PType> types = node.getTypes(); List<PType> elemConstraints = null; if (question.constraint != null && question.assistantFactory.createPTypeAssistant().isProduct(question.constraint)) { elemConstraints = question.assistantFactory.createPTypeAssistant().getProduct(question.constraint).getTypes(); if (elemConstraints.size() != node.getArgs().size()) { elemConstraints = null; } } int i = 0; for (PExp arg : node.getArgs()) { question.qualifiers = null; if (elemConstraints == null) { types.add(arg.apply(THIS, question.newConstraint(null))); } else { types.add(arg.apply(THIS, question.newConstraint(elemConstraints.get(i++)))); } } node.setType(AstFactory.newAProductType(node.getLocation(), types)); return question.assistantFactory.createPTypeAssistant().possibleConstraint(question.constraint, node.getType(), node.getLocation()); }