irutil

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Code generated by the `ir/codegen` package. DO NOT EDIT.

Code generated by the `ir/codegen` package. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FmtNode

func FmtNode(n ir.Node) string

FmtNode returns string representation of n.

func Inspect

func Inspect(root ir.Node, visit func(ir.Node) bool)

func IsAssign

func IsAssign(n ir.Node) bool

func NodeClone

func NodeClone(x ir.Node) ir.Node

func NodeEqual

func NodeEqual(x, y ir.Node) bool

func NodeSliceClone

func NodeSliceClone(xs []ir.Node) []ir.Node

func NodeSliceEqual

func NodeSliceEqual(xs, ys []ir.Node) bool

func Unparen

func Unparen(e ir.Node) ir.Node

Unparen returns n with all parenthesis removed.

func Unquote

func Unquote(s string) string

Unquote returns unquoted version of s, if there are any quotes.

Types

type NodeSet

type NodeSet struct {
	// contains filtered or unexported fields
}

NodeSet is a set of unique AST nodes.

It's possible to avoid allocations in most cases if node set is reused with Reset(). If this is not possible, use NewNodeSet() to create a set that can do fewer allocations than a zero value set.

NodeSet is not thread-safe, but since Root/Block walkers always operate in isolation, we can share on per RootWalker level.

func NewNodeSet

func NewNodeSet() NodeSet

NewNodeSet returns a node set with preallocated storage.

Intended to be used in places where reusing root node set is tricky or impossible (function is reentrant).

func (*NodeSet) Add

func (set *NodeSet) Add(x ir.Node) bool

Add attempts to insert x into the node set.

Returns true if element was inserted. If x is already in the set, false is returned and no insertion is performed.

func (*NodeSet) Len

func (set *NodeSet) Len() int

Len returns the number of unique node elements present in the set.

func (*NodeSet) Reset

func (set *NodeSet) Reset()

Reset clears the set state and prepares it for another round.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL