typed

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ReferenceKind

type ReferenceKind bool

ReferenceKind denotes the style of a reference, which influences compilation and linking requirements.

const (
	// ImportStatement references must be made available to the compiler via the provided `importcfg`.
	ImportStatement ReferenceKind = true
	// RelocationTarget references must be made available to the linker, and must be referenced (directly or not) by the main package.
	RelocationTarget ReferenceKind = false
)

func (ReferenceKind) String

func (k ReferenceKind) String() string

type ReferenceMap

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

ReferenceMap associates import paths to ReferenceKind values.

func (*ReferenceMap) AddImport

func (r *ReferenceMap) AddImport(file *dst.File, path string, alias string) bool

AddImport determines whether a new import declaration needs to be added to make the provided path available within the specified file. Returns true if that is the case. False if the import path is already available within the file.

func (r *ReferenceMap) AddLink(file *dst.File, path string) bool

AddLink registers the provided path as a relocation target resolution source. If this path is already registered as an import, this method does nothing and returns false.

func (*ReferenceMap) AddSyntheticImports

func (r *ReferenceMap) AddSyntheticImports(file *dst.File) bool

AddSyntheticImports adds the registered imports to the provided *dst.File. This is not safe to call during an AST traversal by dstutil.Apply, as this may offset the declaration list by 1 in case a new import declaration needs to be added, which would result in re-traversing current declaration when the cursor moves forward. Instead, it is advise to call this method after dstutil.Apply has returned.

func (*ReferenceMap) Count

func (r *ReferenceMap) Count() int

func (*ReferenceMap) Map

func (r *ReferenceMap) Map() map[string]ReferenceKind

func (*ReferenceMap) Merge

func (r *ReferenceMap) Merge(other ReferenceMap)

Jump to

Keyboard shortcuts

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