...

Package walk

import "cuelang.org/go/internal/core/walk"
Overview
Index

Overview ▾

walk provides functions for visiting the nodes of an ADT tree.

func Features

func Features(x adt.Expr, f func(label adt.Feature, src adt.Node))

Features calls f for all features used in x and indicates whether the feature is used as a reference or not.

type Visitor

A Visitor walks over all elements in an ADT, recursively.

type Visitor struct {
    // Feature is invoked for all field names.
    Feature func(f adt.Feature, src adt.Node)

    // Before is invoked for all invoked for all nodes in pre-order traversal.
    // Return false prevents the visitor from visiting the nodes descendant
    // elements.
    Before func(adt.Node) bool
}

func (*Visitor) Elem

func (w *Visitor) Elem(x adt.Elem)