Skip to content

Node

[Source]

An AST node.

trait val Node

Public Functions

clone

[Source]

Used to clone the node with certain updated properties during AST transformation.

fun val clone(
  src_info': (SrcInfo val | None val) = reference,
  new_children': (ReadSeq[Node val] val | None val) = reference,
  update_map': (HashMap[Node val, Node val, HashIs[Node val] val] val | None val) = reference,
  annotation': (NodeWith[Annotation val] val | None val) = reference,
  doc_strings': (Array[NodeWith[DocString val] val] val | None val) = reference,
  pre_trivia': (Array[NodeWith[Trivia val] val] val | None val) = reference,
  post_trivia': (Array[NodeWith[Trivia val] val] val | None val) = reference,
  ast_type': (AstType val | None val) = reference,
  scope_index': (USize val | None val) = reference)
: Node val

Parameters

Returns


name

[Source]

An informative identifier for the kind of data the node stores.

fun box name()
: String val

Returns


src_info

[Source]

Source location information.

fun box src_info()
: SrcInfo val

Returns


children

[Source]

fun box children()
: ReadSeq[Node val] val

Returns


annotation

[Source]

fun box annotation()
: (NodeWith[Annotation val] val | None val)

Returns


doc_strings

[Source]

fun box doc_strings()
: Array[NodeWith[DocString val] val] val

Returns


pre_trivia

[Source]

fun box pre_trivia()
: Array[NodeWith[Trivia val] val] val

Returns


post_trivia

[Source]

fun box post_trivia()
: Array[NodeWith[Trivia val] val] val

Returns


ast_type

[Source]

The resolved type of the node.

fun box ast_type()
: (AstType val | None val)

Returns


scope_index

[Source]

fun box scope_index()
: (USize val | None val)

Returns


get_json

[Source]

Get a JSON representation of the node.

fun box get_json()
: Object ref

Returns


map[D: NodeData val]

[Source]

fun box map[D: NodeData val](
  seq: Array[NodeWith[D] val] val,
  updates: HashMap[Node val, Node val, HashIs[Node val] val] val)
: Array[NodeWith[D] val] val

Parameters

Returns


child_ref

[Source]

fun box child_ref(
  child: Node val)
: (Object box | Sequence box | String box | 
    I128 val | F64 val | Bool val | 
    Null val)

Parameters

Returns


child_refs

[Source]

fun box child_refs(
  childs: ReadSeq[Node val] val)
: (Object box | Sequence box | String box | 
    I128 val | F64 val | Bool val | 
    Null val)

Parameters

Returns


string

[Source]

fun box string()
: String iso^

Returns