Node

open class Node : Iterable<Node>

Root of the intermediate representation: a weakly typed tree node holding a linked list of children and a linked list of properties.

KMP: upstream exposes type, lineno and column as protected fields alongside public accessors, and subclasses write the raw field to bypass any accessor override. The port keeps both halves: typeField/linenoField/columnField are the raw storage, type/lineno/column are the (overridable) accessors.

Inheritors

Constructors

Link copied to clipboard
constructor(nodeType: Int)
constructor(nodeType: Int, child: Node)
constructor(nodeType: Int, left: Node, right: Node)
constructor(nodeType: Int, left: Node, mid: Node, right: Node)
constructor(nodeType: Int, line: Int, column: Int)
constructor(nodeType: Int, child: Node, line: Int, column: Int)
constructor(nodeType: Int, left: Node, right: Node, line: Int, column: Int)
constructor(nodeType: Int, left: Node, mid: Node, right: Node, line: Int, column: Int)

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Iterates over the children of this Node. Supports child removal. Not thread-safe: if anyone changes the child list before the iterator finishes, the results are undefined and probably bad.

Properties

Link copied to clipboard
open var bigInt: KBigInt?

Only valid when type == Token.BIGINT.

Link copied to clipboard
open val column: Int

The column where this node is defined in source, one-based. -1 means it was never initialized. May be overridden by subclasses.

Link copied to clipboard

Only valid when type == Token.NUMBER.

Link copied to clipboard
Link copied to clipboard

The JsDoc comment string attached to this node, or null.

Link copied to clipboard

The JsDoc Comment attached to this node, or null.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val lineno: Int

The line number recorded for this node.

Link copied to clipboard
open var scope: Scope?

Only valid when the node has String context.

Link copied to clipboard

Only valid when the node has String context.

Link copied to clipboard
open var type: Int

The node type, e.g. Token.NAME.

Functions

Link copied to clipboard
fun addChildAfter(newChild: Node, node: Node)

Add newChild after node.

Link copied to clipboard
fun addChildBefore(newChild: Node, node: Node)

Add newChild before node.

Link copied to clipboard
fun addChildrenToBack(children: Node)
Link copied to clipboard
fun addChildrenToFront(children: Node)
Link copied to clipboard
fun addChildToBack(child: Node)
Link copied to clipboard
fun addChildToFront(child: Node)
Link copied to clipboard
fun getChildBefore(child: Node): Node?
Link copied to clipboard
fun getExistingIntProp(propType: Int): Int
Link copied to clipboard
fun getIntProp(propType: Int, defaultValue: Int): Int
Link copied to clipboard
fun getProp(propType: Int): Any?
Link copied to clipboard
Link copied to clipboard

Checks that every return usage in a function body is consistent with strict mode. See the END_* flags for what the analysis reports.

Link copied to clipboard
Link copied to clipboard
open operator override fun iterator(): MutableIterator<Node>
Link copied to clipboard
fun labelId(): Int
fun labelId(labelId: Int)
Link copied to clipboard
fun putIntProp(propType: Int, prop: Int)
Link copied to clipboard
fun putProp(propType: Int, prop: Any?)
Link copied to clipboard
fun removeChild(child: Node)
Link copied to clipboard
Link copied to clipboard
fun removeProp(propType: Int)
Link copied to clipboard
fun replaceChild(child: Node, newChild: Node)
Link copied to clipboard
fun replaceChildAfter(prevChild: Node, newChild: Node)
Link copied to clipboard

Recursively unlabel every TARGET or YIELD node in the tree. Used only for inlining finally blocks where jsr instructions used to be.

Link copied to clipboard
fun setLineColumnNumber(lineno: Int, column: Int)
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard