/** * Creates a new complete constructor {@code AInheritedDefinition} 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 superdef_ the {@link PDefinition} <b>graph</a> node for the {@code superdef} child of this {@link AInheritedDefinition} node. * <i>The parent of this {@code superdef } will not be changed by adding it to this node.</i> * @param oldname_ the {@link ILexNameToken} node for the {@code oldname} child of this {@link AInheritedDefinition} node */ public AInheritedDefinition(ILexLocation location_, ILexNameToken name_, NameScope nameScope_, Boolean used_, SClassDefinition classDefinition_, AAccessSpecifierAccessSpecifier access_, PType type_, Pass pass_, PDefinition superdef_, ILexNameToken oldname_) { super(location_,name_,nameScope_,used_,classDefinition_,access_,type_,pass_); this.setSuperdef(superdef_); this.setOldname(oldname_); }
public static void checkSuperDefinition(AInheritedDefinition d) { // This is used to get over the case where an inherited definition // is a ValueDefinition that has since been replaced with a new // LocalDefinition. It would be better to somehow list the // inherited definitions that refer to a LocalDefinition and update // them... if (d.getSuperdef() instanceof AUntypedDefinition) { if (d.getClassDefinition() != null) { d.setSuperdef(af.createPDefinitionAssistant().findName(d.getClassDefinition(), d.getSuperdef().getName(), d.getNameScope())); } } }
public static AInheritedDefinition newAInheritedDefinition( ILexNameToken localname, PDefinition d) { AInheritedDefinition result = new AInheritedDefinition(); initDefinition(result, d.getPass(), d.getLocation(), localname, d.getNameScope()); result.setSuperdef(d); result.setOldname(localname.getOldName()); result.setType(d.getType()); af.createPDefinitionAssistant().setClassDefinition(result, d.getClassDefinition()); result.setAccess(d.getAccess().clone()); return result; }
@Override public NameValuePairList caseAInheritedDefinition(AInheritedDefinition def, Context initialContext) throws AnalysisException { NameValuePairList renamed = new NameValuePairList(); if (def.getSuperdef() instanceof AUntypedDefinition) { if (def.getClassDefinition() != null) { def.setSuperdef(af.createPDefinitionAssistant().findName(def.getClassDefinition(), def.getSuperdef().getName(), def.getNameScope())); } } for (NameValuePair nv : af.createPDefinitionAssistant().getNamedValues(def.getSuperdef(), initialContext)) { renamed.add(new NameValuePair(nv.name.getModifiedName(def.getName().getModule()), nv.value)); } return renamed; }