dep

package
v0.3.0-alpha5 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package dep analyzes dependencies between values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Visit

func Visit(c *adt.OpContext, n *adt.Vertex, f VisitFunc) error

Visit calls f for all vertices referenced by the conjuncts of n without descending into the elements of list or fields of structs. Only references that do not refer to the conjuncts of n itself are reported.

func VisitAll

func VisitAll(c *adt.OpContext, n *adt.Vertex, f VisitFunc) error

VisitAll calls f for all vertices referenced by the conjuncts of n including those of descendant fields and elements. Only references that do not refer to the conjuncts of n itself are reported.

func VisitFields

func VisitFields(c *adt.OpContext, n *adt.Vertex, f VisitFunc) error

VisitFields calls f for n and all its descendent arcs that have a conjunct that originates from a conjunct in n. Only the conjuncts of n that ended up as a conjunct in an actual field are visited and they are visited for each field in which the occurs.

Types

type Dependency

type Dependency struct {
	// Node is the referenced node.
	Node *adt.Vertex

	// Reference is the expression that referenced the node.
	Reference adt.Resolver
	// contains filtered or unexported fields
}

A Dependency is a reference and the node that reference resolves to.

func (*Dependency) Import

func (d *Dependency) Import() *adt.ImportReference

Import returns the import reference or nil if the reference was within the same package as the visited Vertex.

func (*Dependency) IsRoot

func (d *Dependency) IsRoot() bool

IsRoot reports whether the dependency is referenced by the root of the original Vertex passed to any of the Visit* functions, and not one of its descendent arcs. This always returns true for Visit().

func (*Dependency) Path

func (d *Dependency) Path() []adt.Feature

type VisitFunc

type VisitFunc func(Dependency) error

VisitFunc is used for reporting dependencies.

Jump to

Keyboard shortcuts

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