selection

package
v0.0.0-...-1151cc2 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package selection manages fields and methods of types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GroupMethods

func GroupMethods(defs map[*ast.Ident]types.Object) (implMap map[*types.Func][]Method)

GroupMethods groups all the declared method in a package by the implementation of same interface method. The implMap[mtd] is a list of methods(include mtd itself) that implement the same interface method of mtd.

func HasName

func HasName(t typ, name string) bool

HasName returns whether the type t has a field or method with the given name.

Types

type Method

type Method struct {
	ID *ast.Ident
	F  *types.Func
}

func (Method) String

func (mtd Method) String() string

type Selection

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

Selection manages fields and methods of types.

func New

func New(pkg *packages.Package) *Selection

New creates a new Selection of a package.

func (*Selection) CanRenameEmbedded

func (sel *Selection) CanRenameEmbedded(def token.Pos, name, newName string) bool

RenameEmbedded returns whether embedded fields of type T which is defined at a specified position can be renamed to a new name.

func (*Selection) CanRenameFieldMethod

func (sel *Selection) CanRenameFieldMethod(name string, pos token.Pos, newName string) bool

CanRenameFieldMethod returns whether a field or method defined at a specified position can be renamed to a new name.

func (*Selection) RenameEmbedded

func (sel *Selection) RenameEmbedded(def token.Pos, newName string)

RenameEmbedded renames embedded fields of type T which is defined at a specified position to a new name.

func (*Selection) RenameFieldMethod

func (sel *Selection) RenameFieldMethod(name string, pos token.Pos, newName string)

RenameFieldMethod renames a field or method defined at a specified position to a new name.

Jump to

Keyboard shortcuts

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