public class NModule extends NNode
Constructor and Description |
---|
NModule() |
NModule(NBlock body,
int start,
int end) |
NModule(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
java.util.List<NStr> |
getExportedNameNodes()
If the module defines an
__all__ variable, returns the string
elements of the variable's list value. |
java.util.List<java.lang.String> |
getExportedNames()
Attempt to determine the actual value of the "__all__" variable in the
target module.
|
java.lang.String |
getFile() |
java.lang.String |
getMD5() |
NType |
resolve(Scope s)
Node should set the resolved type in its
NNode.type field
and also return it. |
void |
setFile(java.io.File path) |
void |
setFile(java.lang.String file) |
void |
setFileAndMD5(java.lang.String path,
java.lang.String md5)
Used when module is parsed from an in-memory string.
|
java.lang.String |
toLongString() |
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, getParent, getTable, getType, isCall, isClassDef, isFunctionDef, isLambda, isModule, isName, length, resolveExpr, resolveList, resolveListAsUnion, setEnd, setParent, setStart, setType, start, visitNode, visitNodeList
public java.lang.String name
public NBody body
public NModule()
public NModule(java.lang.String name)
public NModule(NBlock body, int start, int end)
public void setFile(java.lang.String file) throws java.lang.Exception
java.lang.Exception
public void setFile(java.io.File path) throws java.lang.Exception
java.lang.Exception
public void setFileAndMD5(java.lang.String path, java.lang.String md5) throws java.lang.Exception
path
- file pathmd5
- md5 message digest for source contentsjava.lang.Exception
public java.lang.String getFile()
public java.lang.String getMD5()
public NType resolve(Scope s) throws java.lang.Exception
NNode
NNode.type
field
and also return it.public java.util.List<java.lang.String> getExportedNames() throws java.lang.Exception
null
if __all__ is
missing, or if its initializer is not a simple list of strings.
We don't generate a warning, since complex expressions such as
__all__ = [name for name in dir() if name[0] == "e"]
are valid provided the expr result is a string list.java.lang.Exception
public java.util.List<NStr> getExportedNameNodes() throws java.lang.Exception
__all__
variable, returns the string
elements of the variable's list value.java.lang.Exception
public java.lang.String toLongString()
public java.lang.String toString()
toString
in class java.lang.Object
public void visit(NNodeVisitor v)
NNode