public static AMkBasicExp newAMkBasicExp(SBasicType type, PExp arg) { AMkBasicExp result = new AMkBasicExp(); initExpression(result, type.getLocation()); result.setType(type); result.setArg(arg); return result; }
/** * Returns a deep clone of this {@link AMkBasicExp} node. * @return a deep clone of this {@link AMkBasicExp} node */ public AMkBasicExp clone() { return new AMkBasicExp( _type, _location, cloneNode(_arg) ); }
/** * Called by the {@link AMkBasicExp} node from {@link AMkBasicExp#apply(IAnalysis)}. * @param node the calling {@link AMkBasicExp} node */ public void caseAMkBasicExp(AMkBasicExp node) throws AnalysisException { _visitedNodes.add(node); inAMkBasicExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getArg() != null && !_visitedNodes.contains(node.getArg())) { node.getArg().apply(this); } outAMkBasicExp(node); }
@Override public PType caseAMkBasicExp(AMkBasicExp node, TypeCheckInfo question) throws AnalysisException { PType argtype = node.getArg().apply(THIS, question.newConstraint(null)); if (!(node.getType() instanceof ATokenBasicType) && !question.assistantFactory.createPTypeAssistant().equals(argtype, node.getType())) { TypeCheckerErrors.report(3125, "Argument of mk_" + node.getType() + " is the wrong type", node.getLocation(), node); } return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }
@Override public ValueList caseAMkBasicExp(AMkBasicExp exp, ObjectContext ctxt) throws AnalysisException { return exp.getArg().apply(THIS, ctxt); }
/** * Creates a new tree field only constructor {@code AMkBasicExp TAG=mkBasic} 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 arg_ the {@link PExp} node for the {@code arg} child of this {@link AMkBasicExp} node */ public AMkBasicExp(ILexLocation location_, PExp arg_) { super(null,location_); this.setArg(arg_); }
/** * Called by the {@link AMkBasicExp} node from {@link AMkBasicExp#apply(IAnalysis)}. * @param node the calling {@link AMkBasicExp} node */ public void caseAMkBasicExp(AMkBasicExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inAMkBasicExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getArg() != null && !_visitedNodes.contains(node.getArg())) { node.getArg().apply(this, question); } outAMkBasicExp(node, question); }
@Override public Value caseAMkBasicExp(AMkBasicExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); Value v = node.getArg().apply(VdmRuntime.getExpressionEvaluator(), ctxt); if (node.getType() instanceof ATokenBasicType) { return new TokenValue(v); } else { try { v = v.convertTo(node.getType(), ctxt); } catch (ValueException e) { VdmRuntimeError.abort(node.getLocation(), 4022, "mk_ type argument is not " + node.getType(), ctxt); } } return v; }
@Override public IProofObligationList caseAMkBasicExp(AMkBasicExp node, IPOContextStack question) throws AnalysisException { return node.getArg().apply(mainVisitor, question); }
/** * Creates a new complete constructor {@code AMkBasicExp} 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 arg_ the {@link PExp} node for the {@code arg} child of this {@link AMkBasicExp} node */ public AMkBasicExp(PType type_, ILexLocation location_, PExp arg_) { super(type_,location_); this.setArg(arg_); }
/** * Called by the {@link AMkBasicExp} node from {@link AMkBasicExp#apply(IPOFAnalysis)}. * @param node the calling {@link AMkBasicExp} node */ public void caseAMkBasicExp(AMkBasicExp node) throws AnalysisException { _visitedNodes.add(node); inAMkBasicExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getArg() != null && !_visitedNodes.contains(node.getArg())) { node.getArg().apply(this); } outAMkBasicExp(node); }
@Override public PExp caseAMkBasicExp(AMkBasicExp exp, Integer lineno) throws AnalysisException { PExp found = findExpressionBaseCase(exp, lineno); if (found != null) { return found; } return exp.getArg().apply(THIS, lineno); }
/** * Creates a deep clone of this {@link AMkBasicExp} 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 AMkBasicExp} node */ public AMkBasicExp clone(Map<INode,INode> oldToNewMap) { AMkBasicExp node = new AMkBasicExp( _type, _location, cloneNode(_arg, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
public LexNameList caseAMkBasicExp(AMkBasicExp expression) throws org.overture.ast.analysis.AnalysisException { return af.createPExpAssistant().getOldNames(expression.getArg()); }
/** * Called by the {@link AMkBasicExp} node from {@link AMkBasicExp#apply(IAnalysis)}. * @param node the calling {@link AMkBasicExp} node */ public A caseAMkBasicExp(AMkBasicExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAMkBasicExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getArg() != null && !_visitedNodes.contains(node.getArg())) { mergeReturns(retVal,node.getArg().apply(this, question)); } mergeReturns(retVal,outAMkBasicExp(node, question)); return retVal; }
/** * Called by the {@link AMkBasicExp} node from {@link AMkBasicExp#apply(IAnalysis)}. * @param node the calling {@link AMkBasicExp} node */ public A caseAMkBasicExp(AMkBasicExp node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAMkBasicExp(node)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this)); } if(node.getArg() != null && !_visitedNodes.contains(node.getArg())) { mergeReturns(retVal,node.getArg().apply(this)); } mergeReturns(retVal,outAMkBasicExp(node)); return retVal; }
@Override public SExpIR caseAMkBasicExp(AMkBasicExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); if (!(type instanceof ATokenBasicType)) { question.addUnsupportedNode(node, "Expected token type for mk basic expression. Got: " + type); return null; } PExp arg = node.getArg(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); SExpIR argCg = arg.apply(question.getExpVisitor(), question); AMkBasicExpIR mkBasicExp = new AMkBasicExpIR(); mkBasicExp.setType(typeCg); mkBasicExp.setArg(argCg); return mkBasicExp; }