Skip to content

NodeWith[D: NodeData val]

[Source]

An AST node with specific semantic data.

class val NodeWith[D: NodeData val] is
  Node val

Implements


Constructors

create

[Source]

new val create(
  src_info': SrcInfo val,
  children': ReadSeq[Node val] val,
  data': D,
  annotation': (NodeWith[Annotation val] val | None val) = reference,
  doc_strings': Array[NodeWith[DocString val] val] val = array,
  pre_trivia': Array[NodeWith[Trivia val] val] val = array,
  post_trivia': Array[NodeWith[Trivia val] val] val = array,
  ast_type': (AstType val | None val) = reference,
  scope_index': (USize val | None val) = reference)
: NodeWith[D] val^

Parameters

Returns


from

[Source]

new val from(
  orig: NodeWith[D] val,
  src_info': (SrcInfo val | None val) = reference,
  children': (ReadSeq[Node val] val | None val) = reference,
  data': (D | 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)
: NodeWith[D] val^

Parameters

Returns


Public Functions

clone

[Source]

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]

The kind of data that is stored in this node.

fun box name()
: String val

Returns


src_info

[Source]

Source file information for this node.

fun box src_info()
: SrcInfo val

Returns


children

[Source]

The complete list of children of this node.

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

Returns


data

[Source]

Semantic data associated with this node. Node references in data must reference nodes in children.

fun box data()
: D

Returns

  • D

doc_strings

[Source]

Zero or more doc strings associated with this node. Must be references to nodes in children.

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

Returns


annotation

[Source]

The node's annotation, if any. Must be a reference to a node in children.

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

Returns


pre_trivia

[Source]

Trivia (whitespace, comments) that appears before the significant content of this node. Likely only appears in SrcFile. Must be references to nodes in children.

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

Returns


post_trivia

[Source]

Trivia (whitespace, comments) that appears after the significant content of this node. Must be references to nodes in children.

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

Returns


ast_type

[Source]

The resolved type of this node, if any.

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


string

[Source]

fun box string()
: String iso^

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