public class NQname extends NNode
NAttribute
, but handles
leading dots and other import-specific special cases.
Qualified names with leading dots are given NQname
elements for each
leading dot. Dots separating simple names are not given NQname
elements.
Constructor and Description |
---|
NQname(NQname next,
NName name) |
NQname(NQname next,
NName name,
int start,
int end) |
Modifier and Type | Method and Description |
---|---|
NQname |
getBottom()
Returns the last/bottom component of the chain.
|
NName |
getName()
Returns this component of the qname chain.
|
NQname |
getNext()
Returns the next component of the chain, or
null if this is
the last component. |
NQname |
getPrevious()
Returns the previous component of this qname chain, or
null if
this is the first component. |
NQname |
getTop()
Returns the top (first) component in the chain.
|
boolean |
isBottom()
Returns
true if this is the last/bottom component of the chain,
or if the name is unqualified (i.e. |
boolean |
isDot()
Returns
true if this qname component is a leading dot. |
boolean |
isTop()
Returns
true if this is the first/top component of the chain,
or if the name is unqualified (i.e. |
boolean |
isUnqualified()
Returns
true if this qname represents a simple, non-dotted module
name such as "os", "random" or "foo". |
NType |
resolve(Scope s)
Resolves and loads the module named by this qname.
|
java.lang.String |
thisQname()
Returns the qname down to (and including) this component, ending
with this component's name.
|
java.lang.String |
toQname()
Joins all components in this qname chain, beginning with the
current component.
|
java.lang.String |
toString() |
void |
visit(NNodeVisitor v)
Visits this node and optionally its children.
|
addChildren, addChildren, addError, addError, addType, addWarning, addWarning, bindNames, bindsName, end, getAstRoot, getDeepestNodeAtOffset, getEnclosingNamespace, getFile, getParent, getTable, getType, isCall, isClassDef, isFunctionDef, isLambda, isModule, isName, length, resolveExpr, resolveList, resolveListAsUnion, setEnd, setParent, setStart, setType, start, visitNode, visitNodeList
public NName getName()
public NQname getPrevious()
null
if
this is the first component.public NQname getNext()
null
if this is
the last component.public NQname getBottom()
public boolean isTop()
true
if this is the first/top component of the chain,
or if the name is unqualified (i.e. has only one component, no dots).public boolean isBottom()
true
if this is the last/bottom component of the chain,
or if the name is unqualified (i.e. has only one component, no dots).public boolean isUnqualified()
true
if this qname represents a simple, non-dotted module
name such as "os", "random" or "foo".public java.lang.String toQname()
public java.lang.String thisQname()
NQname
instance represents the foo
in org.foo.bar
, this
method will return org.foo
.public NQname getTop()
public boolean isDot()
true
if this qname component is a leading dot.public NType resolve(Scope s) throws java.lang.Exception
public java.lang.String toString()
toString
in class java.lang.Object
public void visit(NNodeVisitor v)
NNode