astutil

package
v0.8.0-alpha.2 Latest Latest
Warning

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

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

Documentation

Overview

Package astutil provides various AST utility functions for gopls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NodeContains

func NodeContains(n ast.Node, pos token.Pos) bool

NodeContains returns true if a node encloses a given position pos.

Precondition: n must not be nil.

func PurgeFuncBodies

func PurgeFuncBodies(src []byte) []byte

PurgeFuncBodies returns a copy of src in which the contents of each outermost {...} region except struct and interface types have been deleted. This reduces the amount of work required to parse the top-level declarations.

PurgeFuncBodies does not preserve newlines or position information. Also, if the input is invalid, parsing the output of PurgeFuncBodies may result in a different tree due to its effects on parser error recovery.

func UnpackRecv

func UnpackRecv(rtyp ast.Expr) (ptr bool, rname *ast.Ident, tparams []*ast.Ident)

UnpackRecv unpacks a receiver type expression, reporting whether it is a pointer recever, along with the type name identifier and any receiver type parameter identifiers.

Copied (with modifications) from go/types.

Types

This section is empty.

Jump to

Keyboard shortcuts

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