@Override public String caseAParameterType(AParameterType type) throws AnalysisException { return "@" + type.getName(); }
@Override public PType caseAParameterType(AParameterType type, Newquestion question) throws AnalysisException { if (type.getResolved()) { return type; } else { type.setResolved(true); } PDefinition p = question.question.env.findName(type.getName(), NameScope.NAMES); if (p == null || !(question.question.assistantFactory.createPDefinitionAssistant().getType(p) instanceof AParameterType)) { TypeCheckerErrors.report(3433, "Parameter type @" + type.getName() + " not defined", type.getLocation(), type); } return type; }
/** * Returns a deep clone of this {@link AParameterType} node. * @return a deep clone of this {@link AParameterType} node */ public AParameterType clone() { return new AParameterType( _location, _resolved, _definitions, cloneNode(_name) ); }
public static AParameterType newAParameterType(ILexNameToken name) { AParameterType result = new AParameterType(); initType(result, name.getLocation()); result.setName(name); return result; }
@Override public PType caseAParameterType(AParameterType type, Context ctxt) throws AnalysisException { Value t = ctxt.lookup(type.getName()); if (t == null) { VdmRuntimeError.abort(type.getLocation(), 4008, "No such type parameter @" + type.getName() + " in scope", ctxt); } else if (t instanceof ParameterValue) { ParameterValue tv = (ParameterValue)t; return tv.type; } else { VdmRuntimeError.abort(type.getLocation(), 4009, "Type parameter/local variable name clash, @" + type.getName(), ctxt); } return null; }
/** * Called by the {@link AParameterType} node from {@link AParameterType#apply(IAnalysis)}. * @param node the calling {@link AParameterType} node */ public void caseAParameterType(AParameterType node, Q question) throws AnalysisException { _visitedNodes.add(node); inAParameterType(node, question); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } if(node.getName() != null ) { node.getName().apply(this, question); } outAParameterType(node, question); }
/** * Called by the {@link AParameterType} node from {@link AParameterType#apply(IAnalysis)}. * @param node the calling {@link AParameterType} node */ public void caseAParameterType(AParameterType node) throws AnalysisException { _visitedNodes.add(node); inAParameterType(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getName() != null ) { node.getName().apply(this); } outAParameterType(node); }
/** * Called by the {@link AParameterType} node from {@link AParameterType#apply(IPOFAnalysis)}. * @param node the calling {@link AParameterType} node */ public void caseAParameterType(AParameterType node) throws AnalysisException { _visitedNodes.add(node); inAParameterType(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getName() != null ) { node.getName().apply(this); } outAParameterType(node); }
@Override public PType caseAParameterType(AParameterType type, Newquestion question) throws AnalysisException { return type.getName().equals(question.pname) ? question.actualType : type; }
/** * Creates a deep clone of this {@link AParameterType} 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 AParameterType} node */ public AParameterType clone(Map<INode,INode> oldToNewMap) { AParameterType node = new AParameterType( _location, _resolved, _definitions, cloneNode(_name, oldToNewMap) ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link AParameterType} node from {@link AParameterType#apply(IAnalysis)}. * @param node the calling {@link AParameterType} node */ public A caseAParameterType(AParameterType node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAParameterType(node, question)); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } if(node.getName() != null ) { mergeReturns(retVal,node.getName().apply(this, question)); } mergeReturns(retVal,outAParameterType(node, question)); return retVal; }
@Override public Integer caseAParameterType(AParameterType type) throws AnalysisException { return type.getName().apply(THIS); }
/** * Called by the {@link AParameterType} node from {@link AParameterType#apply(IAnalysis)}. * @param node the calling {@link AParameterType} node */ public A caseAParameterType(AParameterType node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAParameterType(node)); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } if(node.getName() != null ) { mergeReturns(retVal,node.getName().apply(this)); } mergeReturns(retVal,outAParameterType(node)); return retVal; }
@Override public ValueList caseAParameterType(AParameterType type, Context ctxt) throws AnalysisException { Value t = ctxt.lookup(type.getName()); if (t == null) { throw new ValueException(4008, "No such type parameter @" + type.getName() + " in scope", ctxt); } else if (t instanceof ParameterValue) { ParameterValue tv = (ParameterValue) t; return tv.type.apply(THIS, ctxt); } throw new ValueException(4009, "Type parameter/local variable name clash, @" + type.getName(), ctxt); }
@Override public STypeIR caseAParameterType(AParameterType node, IRInfo question) throws AnalysisException { String name = node.getName().getName(); ATemplateTypeIR templateType = new ATemplateTypeIR(); templateType.setName(name); return templateType; }
PDefinition d = question.env.findName(pt.getName(), question.scope);
if (ptype.getName().equals(name)) // Referring to "T" of @T