inAFuncInstatiationExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this); if(node.getFunction() != null && !_visitedNodes.contains(node.getFunction())) node.getFunction().apply(this); List<PType> copy = new ArrayList<PType>(node.getActualTypes()); for( PType e : copy) if(node.getExpdef() != null && !_visitedNodes.contains(node.getExpdef())) node.getExpdef().apply(this); if(node.getImpdef() != null && !_visitedNodes.contains(node.getImpdef())) node.getImpdef().apply(this);
/** * Creates a new complete constructor {@code AFuncInstatiationExp} 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 function_ the {@link PExp} node for the {@code function} child of this {@link AFuncInstatiationExp} node * @param actualTypes_ the {@link GraphNodeList} <b>graph</a> node for the {@code actualTypes} child of this {@link AFuncInstatiationExp} node. * <i>The parent of this {@code actualTypes } will not be changed by adding it to this node.</i> * @param expdef_ the {@link AExplicitFunctionDefinition} <b>graph</a> node for the {@code expdef} child of this {@link AFuncInstatiationExp} node. * <i>The parent of this {@code expdef } will not be changed by adding it to this node.</i> * @param impdef_ the {@link AImplicitFunctionDefinition} <b>graph</a> node for the {@code impdef} child of this {@link AFuncInstatiationExp} node. * <i>The parent of this {@code impdef } will not be changed by adding it to this node.</i> */ public AFuncInstatiationExp(PType type_, ILexLocation location_, PExp function_, List<? extends PType> actualTypes_, AExplicitFunctionDefinition expdef_, AImplicitFunctionDefinition impdef_) { super(type_,location_); this.setFunction(function_); this.setActualTypes(actualTypes_); this.setExpdef(expdef_); this.setImpdef(impdef_); }
public static AFuncInstatiationExp newAFuncInstatiationExp(PExp function, List<PType> types) { AFuncInstatiationExp result = new AFuncInstatiationExp(); result.setLocation(function.getLocation()); result.setFunction(function); result.setActualTypes(types); return result; }
/** * Returns a deep clone of this {@link AFuncInstatiationExp} node. * @return a deep clone of this {@link AFuncInstatiationExp} node */ public AFuncInstatiationExp clone() { return new AFuncInstatiationExp( _type, _location, cloneNode(_function), _actualTypes, _expdef, _impdef ); }
PType ftype = node.getFunction().apply(THIS, question.newConstraint(null)); node.setType(ftype); return ftype; TypeCheckerErrors.report(3098, "Function value is not polymorphic", node.getLocation(), node); set.add(AstFactory.newAUnknownType(node.getLocation())); } else node.setExpdef((AExplicitFunctionDefinition) def); typeParams = node.getExpdef().getTypeParams(); } else if (def instanceof AImplicitFunctionDefinition) node.setImpdef((AImplicitFunctionDefinition) def); typeParams = node.getImpdef().getTypeParams(); } else TypeCheckerErrors.report(3099, "Polymorphic function is not in scope", node.getLocation(), node); continue; TypeCheckerErrors.concern(serious, 3100, "Function has no type parameters", node.getLocation(), node); continue; if (node.getActualTypes().size() != typeParams.size()) + " type parameters", node.getLocation(), node); continue; for (PType ptype : node.getActualTypes())
Context ctxt) throws AnalysisException BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); FunctionValue fv = node.getFunction().apply(VdmRuntime.getExpressionEvaluator(), ctxt).functionValue(ctxt); VdmRuntimeError.abort(node.getLocation(), 3034, "Function is already instantiated: " + fv.name, ctxt); for (PType ptype : node.getActualTypes()) if (node.getExpdef() == null) rv = getPolymorphicValue(ctxt.assistantFactory, node.getImpdef(), fixed); } else rv = ctxt.assistantFactory.createAExplicitFunctionDefinitionAssistant().getPolymorphicValue(ctxt.assistantFactory, node.getExpdef(), fixed); } catch (ValueException e) return VdmRuntimeError.abort(node.getLocation(), e);
@Override public SExpIR caseAFuncInstatiationExp(AFuncInstatiationExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); PExp func = node.getFunction(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); SExpIR funcCg = func.apply(question.getExpVisitor(), question); AMethodInstantiationExpIR methodInst = new AMethodInstantiationExpIR(); LinkedList<PType> actualTypes = node.getActualTypes(); for (PType actualType : actualTypes) { STypeIR actualTypeCg = actualType.apply(question.getTypeVisitor(), question); if (actualTypeCg != null) { methodInst.getActualTypes().add(actualTypeCg); } else { return null; } } methodInst.setFunc(funcCg); methodInst.setType(typeCg); return methodInst; }
AFuncInstatiationExp func_exp = new AFuncInstatiationExp(); func_exp.setActualTypes(cloneListType(fie.getActualTypes())); func_exp.setFunction(wrapName(measure.clone())); start = func_exp; } else
@Override public LexNameSet caseAFuncInstatiationExp(AFuncInstatiationExp node, FreeVarInfo info) throws AnalysisException { return node.getFunction().apply(this, info); }
func_exp.setFunction(wrapName(measure.clone())); apply_exp.setRoot(func_exp); AFuncInstatiationExp func_exp = new AFuncInstatiationExp(); func_exp.setActualTypes(cloneListType(apply.getArgtypes())); // Not sure about this? func_exp.setFunction(wrapName(measure.clone())); apply_exp.setRoot(func_exp);
@Override public void inAFuncInstatiationExp(AFuncInstatiationExp node) throws AnalysisException { if (node.getImpdef() != null) { info.addUnsupportedNode(node, "Implicit functions cannot be instantiated since they are not supported."); } }
+ Utils.listToString(fie.getActualTypes()) + "]("; } else
/** * Creates a new tree field only constructor {@code AFuncInstatiationExp TAG=funcInstatiation} 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 function_ the {@link PExp} node for the {@code function} child of this {@link AFuncInstatiationExp} node */ public AFuncInstatiationExp(ILexLocation location_, PExp function_) { super(null,location_); this.setFunction(function_); }
@Override public ILexNameToken caseAFuncInstatiationExp( AFuncInstatiationExp expression) throws AnalysisException { AFuncInstatiationExp func = AFuncInstatiationExp.class.cast(expression); return func.getFunction().apply(this); // getPreName(func.getFunction()); }
/** * Creates a deep clone of this {@link AFuncInstatiationExp} 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 AFuncInstatiationExp} node */ public AFuncInstatiationExp clone(Map<INode,INode> oldToNewMap) { AFuncInstatiationExp node = new AFuncInstatiationExp( _type, _location, cloneNode(_function, oldToNewMap), _actualTypes, _expdef, _impdef ); oldToNewMap.put(this, node); return node; }
inAFuncInstatiationExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this, question); if(node.getFunction() != null && !_visitedNodes.contains(node.getFunction())) node.getFunction().apply(this, question); List<PType> copy = new ArrayList<PType>(node.getActualTypes()); for( PType e : copy) if(node.getExpdef() != null && !_visitedNodes.contains(node.getExpdef())) node.getExpdef().apply(this, question); if(node.getImpdef() != null && !_visitedNodes.contains(node.getImpdef())) node.getImpdef().apply(this, question);
@Override public ValueList caseAFuncInstatiationExp(AFuncInstatiationExp exp, ObjectContext ctxt) throws AnalysisException { return exp.getFunction().apply(THIS, ctxt); }
inAFuncInstatiationExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) node.getType().apply(this); if(node.getFunction() != null && !_visitedNodes.contains(node.getFunction())) node.getFunction().apply(this); List<PType> copy = new ArrayList<PType>(node.getActualTypes()); for( PType e : copy) if(node.getExpdef() != null && !_visitedNodes.contains(node.getExpdef())) node.getExpdef().apply(this); if(node.getImpdef() != null && !_visitedNodes.contains(node.getImpdef())) node.getImpdef().apply(this);
@Override public IProofObligationList caseAFuncInstatiationExp( AFuncInstatiationExp node, IPOContextStack question) throws AnalysisException { return node.getFunction().apply(mainVisitor, question); }