Documentation of 'org.python.indexer.ast.NNode' Java class
NNode
org.python.indexer.ast

Class NNode

    • Constructor Detail

      • NNode

        public NNode()
      • NNode

        public NNode(int start,
                     int end)
    • Method Detail

      • setParent

        public void setParent(NNode parent)
      • getParent

        public NNode getParent()
      • getAstRoot

        public NNode getAstRoot()
      • setStart

        public void setStart(int start)
      • setEnd

        public void setEnd(int end)
      • start

        public int start()
      • end

        public int end()
      • length

        public int length()
      • getTable

        public Scope getTable()
        Utility alias for getType().getTable().
      • getType

        public NType getType()
        Returns the type for this node. It is never null. If the node has not been resolved, the type will default to Indexer.idx.builtins.None.
      • setType

        public NType setType(NType newType)
        Sets the type for the node.
        Parameters:
        newType - the new type
        Returns:
        newType
        Throws:
        java.lang.IllegalArgumentException - if newType is null
      • addType

        public NType addType(NType newType)
        Adds a new type for the node, creating a union of the previous type and the new type.
        Parameters:
        newType - the new type
        Returns:
        the resulting type for the node
        Throws:
        java.lang.IllegalArgumentException - if newType is null
      • bindsName

        public boolean bindsName()
        Returns true if this is a name-binding node. Includes functions/lambdas, function/lambda params, classes, assignments, imports, and implicit assignment via for statements and except clauses.
        See Also:
        PEP 227
      • getFile

        public java.lang.String getFile()
        Returns:
        the path to the code that generated this AST
      • addChildren

        public void addChildren(NNode... nodes)
      • addChildren

        public void addChildren(java.util.List<? extends NNode> nodes)
      • resolve

        public NType resolve(Scope s)
                      throws java.lang.Exception
        Node should set the resolved type in its type field and also return it.
        Throws:
        java.lang.Exception
      • isCall

        public boolean isCall()
      • isModule

        public boolean isModule()
      • isClassDef

        public boolean isClassDef()
      • isFunctionDef

        public boolean isFunctionDef()
      • isLambda

        public boolean isLambda()
      • isName

        public boolean isName()
      • visit

        public abstract void visit(NNodeVisitor visitor)
        Visits this node and optionally its children.

        Parameters:
        visitor - the object to call with this node. If the visitor returns true, the node also passes its children to the visitor.
      • getEnclosingNamespace

        public Scope getEnclosingNamespace()
        Returns the innermost enclosing scope for doing (non-attribute) name lookups. If the current node defines a scope, it returns the parent scope for name lookups.
        Returns:
        the enclosing function, class, instance, module or builtin scope. If this node has not yet been resolved, returns the builtin namespace.
      • getDeepestNodeAtOffset

        public NNode getDeepestNodeAtOffset(int sourceOffset)
        Searches the AST for the deepest node that overlaps the specified source offset. Can be called from any node in the AST, as it traverses to the parent before beginning the search.
        Parameters:
        sourceOffset - the spot at which to look for a node
        Returns:
        the deepest AST node whose start is greater than or equal to the offset, and whose end is less than or equal to the offset. Returns null if no node overlaps sourceOffset.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.