fileparser

package
v0.0.0-...-cf4efbe Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTypeName

func GetTypeName(content string, vType ast.Expr) string

Types

type FieldInfo

type FieldInfo struct {
	Name string
	Type string
	Tag  string
}

type FileNode

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

func NewFileNode

func NewFileNode(nodeManager *NodeManager, file string, packageName string) *FileNode

func (*FileNode) AllTokens

func (f *FileNode) AllTokens(pkg string) ([]string, []string, []string)

type FunctionNode

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

func NewFunctionNode

func NewFunctionNode(fileNode *FileNode, name string, receiver string, content string, params []string, returns []string) *FunctionNode

func (*FunctionNode) SameParameter

func (s *FunctionNode) SameParameter(node *FunctionNode) bool

func (*FunctionNode) SameReturns

func (s *FunctionNode) SameReturns(node *FunctionNode) bool

func (*FunctionNode) String

func (s *FunctionNode) String() string

type InterfaceNode

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

func NewInterfaceNode

func NewInterfaceNode(fileNode *FileNode, name string, content string, embedInterface ds.BuiltinSet[string], methods map[string]*FunctionNode) *InterfaceNode

func (*InterfaceNode) AllMethods

func (i *InterfaceNode) AllMethods() []*FunctionNode

type NodeManager

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

func NewParser

func NewParser(projectPath string) *NodeManager

func (*NodeManager) AllTokens

func (n *NodeManager) AllTokens() ([]string, []string, []string)

func (*NodeManager) AnalysisInterface

func (n *NodeManager) AnalysisInterface(interfaceName string, structName string) ([]string, []string, error)

func (*NodeManager) Inspect

func (n *NodeManager) Inspect(file string) error

Inspect 解析源文件,解析出对应的结构体,接口,函数

func (*NodeManager) ParseStructFunctions

func (n *NodeManager) ParseStructFunctions()

type Parser

type Parser interface {
	// AnalysisInterface 分析为什么结构体没有实现接口,返回结构体没有实现的方法
	AnalysisInterface(interfaceName string, structName string) ([]string, []string, error)
	AllTokens() ([]string, []string, []string)
}

type StructNode

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

func NewStructNode

func NewStructNode(fileNode *FileNode, name string, embedFields ds.BuiltinSet[string], fields map[string]*FieldInfo) *StructNode

Jump to

Keyboard shortcuts

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