/** * 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()); }
@Override public ValueList caseATupleExp(ATupleExp exp, ObjectContext ctxt) throws AnalysisException { return af.createPExpAssistant().getValues(exp.getArgs(), ctxt); }
@Override public SExpIR caseATupleExp(ATupleExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); LinkedList<PExp> args = node.getArgs(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); ATupleExpIR tupleExp = new ATupleExpIR(); tupleExp.setType(typeCg); for (PExp exp : args) { SExpIR expCg = exp.apply(question.getExpVisitor(), question); if (expCg != null) { tupleExp.getArgs().add(expCg); } else { return null; } } return tupleExp; }
@Override public Value caseATupleExp(ATupleExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); ValueList argvals = new ValueList(); for (PExp arg : node.getArgs()) { argvals.add(arg.apply(VdmRuntime.getExpressionEvaluator(), ctxt)); } return new TupleValue(argvals); }
/** * Creates a new tree field only constructor {@code ATupleExp TAG=tuple} 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 */ public ATupleExp(ILexLocation location_, List<? extends PExp> args_) { super(null,location_); this.setArgs(args_); }
public LexNameList caseATupleExp(ATupleExp expression) throws org.overture.ast.analysis.AnalysisException { return af.createPExpAssistant().getOldNames(expression.getArgs()); }
/** * Creates a deep clone of this {@link ATupleExp} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link ATupleExp} node */ public ATupleExp clone(Map<INode,INode> oldToNewMap) { ATupleExp node = new ATupleExp( _type, _location, cloneList(_args, oldToNewMap), _types ); oldToNewMap.put(this, node); return node; }
@Override public LexNameSet caseATupleExp(ATupleExp node, FreeVarInfo info) throws AnalysisException { LexNameSet names = new LexNameSet(); for (PExp exp: node.getArgs()) { names.addAll(exp.apply(this, info)); } return names; }
public PExp caseATuplePattern(ATuplePattern node) throws AnalysisException { ATupleExp tuple = new ATupleExp(); List<PExp> values = new Vector<PExp>(); for (PPattern p : node.getPlist()) { PExp e = p.apply(this); values.add(e.clone()); } addPossibleType(tuple, node); tuple.setArgs(values); return tuple; }
mergeReturns(retVal,inATupleExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) mergeReturns(retVal,node.getType().apply(this, question)); List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for( PExp e : copy) List<PType> copy = new ArrayList<PType>(node.getTypes()); for( PType e : copy)
@Override public PExp caseATupleExp(ATupleExp exp, Integer lineno) throws AnalysisException { PExp found = findExpressionBaseCase(exp, lineno); if (found != null) { return found; } return af.createPExpAssistant().findExpression(exp.getArgs(), lineno); }
mergeReturns(retVal,inATupleExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) mergeReturns(retVal,node.getType().apply(this)); List<PExp> copy = new ArrayList<PExp>(node.getArgs()); for( PExp e : copy) List<PType> copy = new ArrayList<PType>(node.getTypes()); for( PType e : copy)
@Override public IProofObligationList caseATupleExp(ATupleExp node, IPOContextStack question) throws AnalysisException { IProofObligationList obligations = new ProofObligationList(); for (PExp exp : node.getArgs()) { obligations.addAll(exp.apply(mainVisitor, question)); } return obligations; }