Documentation ¶
Index ¶
- Variables
- func Assert(condition bool, errmsg string)
- func FindFunction(pkgs map[string]*ast.Package, funcName string) (*ast.FuncDecl, error)
- func FindMethod(pkgs map[string]*ast.Package, recvType, funcName string) *ast.FuncDecl
- func FindPackageExportedFunction(pkgs map[string]*ast.Package, pkgName, funcName string) (*ast.FuncDecl, error)
- func FindServiceExportedFunction(pkgs map[string]*ast.Package, pkgName, recvType, funcName string) (*ast.FuncDecl, error)
- func FunctionContainsStmt(fset *token.FileSet, stmt ast.Stmt) (*ast.FuncDecl, error)
- func FunctionFullName(fset *token.FileSet, fn *ast.FuncDecl) (string, error)
- func FunctionNameContainsStmt(fset *token.FileSet, stmt ast.Stmt) (string, error)
- func Functions(fset *token.FileSet, file *ast.File, filter Filter) ([]*ast.FuncDecl, error)
- func MethodReceiverTypeName(fn *ast.FuncDecl) (string, error)
- func PackageNameContainsFunc(fset *token.FileSet, fn *ast.FuncDecl) (string, error)
- func PackageNameContainsStmt(fset *token.FileSet, stmt ast.Stmt) (string, error)
- func ParseDir(dir string, recursive bool) (*token.FileSet, map[string]*ast.Package, error)
- func ParseFile(file string) (*token.FileSet, *ast.File, error)
- func PosToString(fset *token.FileSet, begin, end token.Pos) (string, error)
- func Print(filename string) error
- func ReceiverTypeOrPackageName(fset *token.FileSet, selectorExpr *ast.SelectorExpr) (typ string, err error)
- func RenderForStmt(fset *token.FileSet, stmt *ast.ForStmt, buf *bytes.Buffer) error
- func RenderForStmtWithConsole(fset *token.FileSet, stmt *ast.ForStmt) error
- func RenderFunction(funcDecl *ast.FuncDecl, fset *token.FileSet, pkgs map[string]*ast.Package) (*bytes.Buffer, error)
- func RenderIfStmt(fset *token.FileSet, stmt *ast.IfStmt, depth int, buf *bytes.Buffer) error
- func RenderIfStmtWithConsole(fset *token.FileSet, stmt *ast.IfStmt, depth int) error
- func RenderStmt(fset *token.FileSet, stmt ast.Stmt) ([]byte, error)
- func RenderStmtWithConsole(fset *token.FileSet, stmt ast.Stmt) error
- func RenderSwitchStmt(fset *token.FileSet, stmt *ast.SwitchStmt, buf *bytes.Buffer) error
- func RenderSwitchStmtWithConsole(fset *token.FileSet, stmt *ast.SwitchStmt) error
- func RenderXSelStmt(fset *token.FileSet, stmt ast.Stmt, depth int, buf *bytes.Buffer) error
- type Filter
Constants ¶
This section is empty.
Variables ¶
var (
ErrIgnoreStmt = errors.New("render not supported for this kind of ast.Stmt")
)
Functions ¶
func FindFunction ¶
ReceiverTypeOrPackageName the function to analyze, like main.main or main.(*helloworldServiceImpl).Hello
func FindMethod ¶
BUG: recvType是否只检查了接受者类型,没有检查package名?
func FindPackageExportedFunction ¶
func FindPackageExportedFunction(pkgs map[string]*ast.Package, pkgName, funcName string) (*ast.FuncDecl, error)
TODO how to seperate *Student and Student
func FunctionContainsStmt ¶
FunctionContainsStmt 返回包含语句stmt的函数全名$xxx.$func
func FunctionFullName ¶
FunctionFullName 返回完整函数名,如果是方法,则返回$receiver.$func,如果是包导出函数,则返回$package.$func
func FunctionNameContainsStmt ¶
FunctionNameContainsStmt 返回包含语句stmt的函数全名$xxx.$func
func MethodReceiverTypeName ¶
MethodReceiverTypeName 返回方法接收器类型
func PackageNameContainsFunc ¶
PackageNameContainsFunc 返回方法所在包名
func PackageNameContainsStmt ¶
PackageNameContainsStmt 返回包含语句stmt的package名
func ParseDir ¶
ParseDir 解析目录对应package,如果recursive为true则递归解析子目录对应package, 返回map结构key为package名,value为对应的*ast.Package语法树结构.
func RenderForStmt ¶
RenderForStmt 渲染forstmt,在plantuml中显示
func RenderFunction ¶
func RenderFunction(funcDecl *ast.FuncDecl, fset *token.FileSet, pkgs map[string]*ast.Package) (*bytes.Buffer, error)
RenderFunction 渲染一个函数,在plantuml中显示
func RenderStmt ¶
RenderStmt render ast.Stmt with plantuml
func RenderSwitchStmt ¶
RenderSwitchStmtWithConsole 渲染switchstmt,在console中显示
func RenderSwitchStmtWithConsole ¶
func RenderSwitchStmtWithConsole(fset *token.FileSet, stmt *ast.SwitchStmt) error
RenderSwitchStmtWithConsole 渲染switchstmt,在console中显示
Deprecated