/** * Called by the {@link ARenamedDefinition} node from {@link ARenamedDefinition#apply(IPOFAnalysis)}. * @param node the calling {@link ARenamedDefinition} node */ public void caseARenamedDefinition(ARenamedDefinition node) throws AnalysisException { _visitedNodes.add(node); inARenamedDefinition(node); if(node.getName() != null ) { node.getName().apply(this); } if(node.getClassDefinition() != null && !_visitedNodes.contains(node.getClassDefinition())) { node.getClassDefinition().apply(this); } if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) { node.getAccess().apply(this); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { node.getDef().apply(this); } outARenamedDefinition(node); }
/** * Returns a deep clone of this {@link ARenamedDefinition} node. * @return a deep clone of this {@link ARenamedDefinition} node */ public ARenamedDefinition clone() { return new ARenamedDefinition( _location, _name, _nameScope, _used, _classDefinition, cloneNode(_access), _type, _pass, _def ); }
@Override public Boolean caseARenamedDefinition(ARenamedDefinition def) throws AnalysisException { return def.getDef().apply(THIS); }
@Override public PDefinition caseARenamedDefinition(ARenamedDefinition node, Newquestion question) throws AnalysisException { // We can only find an import if it is being sought from the module that // imports it. if (question.fromModule != null && !node.getLocation().getModule().equals(question.fromModule)) { return null; // Someone else's import } PDefinition renamed = af.createPDefinitionAssistant().findName(node, question.sought, NameScope.TYPENAME); if (renamed != null && node.getDef() instanceof ATypeDefinition) { af.createPDefinitionAssistant().markUsed(node.getDef()); return renamed; } else { return af.createPDefinitionAssistant().findType(node.getDef(), question.sought, question.fromModule); } }
public static ARenamedDefinition newARenamedDefinition(ILexNameToken name, PDefinition def) { ARenamedDefinition result = new ARenamedDefinition(); initDefinition(result, def.getPass(), name.getLocation(), name, def.getNameScope()); result.setDef(def); return result; }
@Override public Boolean caseARenamedDefinition(ARenamedDefinition node) throws AnalysisException { return node.getDef().apply(THIS); }
@Override public NameValuePairList caseARenamedDefinition(ARenamedDefinition def, Context initialContext) throws AnalysisException { NameValuePairList renamed = new NameValuePairList(); for (NameValuePair nv : af.createPDefinitionAssistant().getNamedValues(def.getDef(), initialContext)) { // We exclude any name from the definition other than the one // explicitly renamed. Otherwise, generated names like pre_f // come through and are not renamed. if (nv.name.equals(def.getDef().getName())) { renamed.add(new NameValuePair(def.getName(), nv.value)); } } return renamed; }
/** * Called by the {@link ARenamedDefinition} node from {@link ARenamedDefinition#apply(IAnalysis)}. * @param node the calling {@link ARenamedDefinition} node */ public void caseARenamedDefinition(ARenamedDefinition node, Q question) throws AnalysisException { _visitedNodes.add(node); inARenamedDefinition(node, question); if(node.getName() != null ) { node.getName().apply(this, question); } if(node.getClassDefinition() != null && !_visitedNodes.contains(node.getClassDefinition())) { node.getClassDefinition().apply(this, question); } if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) { node.getAccess().apply(this, question); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { node.getDef().apply(this, question); } outARenamedDefinition(node, question); }
@Override public Boolean caseARenamedDefinition(ARenamedDefinition def) throws AnalysisException { return def.getDef().apply(THIS); }
/** * Creates a deep clone of this {@link ARenamedDefinition} 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 ARenamedDefinition} node */ public ARenamedDefinition clone(Map<INode,INode> oldToNewMap) { ARenamedDefinition node = new ARenamedDefinition( _location, _name, _nameScope, _used, _classDefinition, cloneNode(_access, oldToNewMap), _type, _pass, _def ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link ARenamedDefinition} node from {@link ARenamedDefinition#apply(IAnalysis)}. * @param node the calling {@link ARenamedDefinition} node */ public void caseARenamedDefinition(ARenamedDefinition node) throws AnalysisException { _visitedNodes.add(node); inARenamedDefinition(node); if(node.getName() != null ) { node.getName().apply(this); } if(node.getClassDefinition() != null && !_visitedNodes.contains(node.getClassDefinition())) { node.getClassDefinition().apply(this); } if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) { node.getAccess().apply(this); } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) { node.getDef().apply(this); } outARenamedDefinition(node); }
@Override public PType caseARenamedDefinition(ARenamedDefinition node) throws AnalysisException { return ((ARenamedDefinition) node).getDef().apply(THIS); }
mergeReturns(retVal,inARenamedDefinition(node)); if(node.getName() != null ) mergeReturns(retVal,node.getName().apply(this)); if(node.getClassDefinition() != null && !_visitedNodes.contains(node.getClassDefinition())) mergeReturns(retVal,node.getClassDefinition().apply(this)); if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) mergeReturns(retVal,node.getAccess().apply(this)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) mergeReturns(retVal,node.getType().apply(this)); if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) mergeReturns(retVal,node.getDef().apply(this));
@Override public Boolean caseARenamedDefinition(ARenamedDefinition def) throws AnalysisException { return def.getDef().apply(THIS); }
mergeReturns(retVal,inARenamedDefinition(node, question)); if(node.getName() != null ) mergeReturns(retVal,node.getName().apply(this, question)); if(node.getClassDefinition() != null && !_visitedNodes.contains(node.getClassDefinition())) mergeReturns(retVal,node.getClassDefinition().apply(this, question)); if(node.getAccess() != null && !_visitedNodes.contains(node.getAccess())) mergeReturns(retVal,node.getAccess().apply(this, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) mergeReturns(retVal,node.getType().apply(this, question)); if(node.getDef() != null && !_visitedNodes.contains(node.getDef())) mergeReturns(retVal,node.getDef().apply(this, question));
@Override public PDefinition caseARenamedDefinition(ARenamedDefinition node) throws AnalysisException { return node.getDef().apply(THIS); }
@Override public Boolean caseARenamedDefinition(ARenamedDefinition def) throws AnalysisException { return def.getDef().apply(THIS); }