sources

package
v1.2.85 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BasicKind = TypeKind(iota + 1)
	BuiltinKind
	IdentKind
	InterfaceKind
	StructKind
	StructFieldKind
	PointerKind
	ArrayKind
	MapKind
	AnyKind
	ParadigmKind
	ParadigmElementKind
	ReferenceKind
)

Variables

View Source
var AnyType = &Type{
	Kind:        AnyKind,
	Path:        "",
	Name:        "",
	Annotations: nil,
	Paradigms:   nil,
	Tags:        nil,
	Elements:    nil,
}

Functions

func GOPATH

func GOPATH() (gopath string, has bool)

func GOROOT

func GOROOT() (goroot string, has bool)

func LatestVersion

func LatestVersion(path string) (v string, err error)

func LatestVersionFromProxy

func LatestVersionFromProxy(path string) (v string, err error)

func PKG

func PKG() (pkg string)

Types

type Annotation

type Annotation struct {
	Name   string
	Params []string
}

func NewAnnotation

func NewAnnotation(name string, params ...string) Annotation

type Annotations

type Annotations []Annotation

func ParseAnnotations

func ParseAnnotations(s string) (annotations Annotations, err error)

func (*Annotations) Add

func (annotations *Annotations) Add(name string, param string)

func (*Annotations) FirstParam

func (annotations *Annotations) FirstParam(name string) (value string, has bool)

func (*Annotations) Get

func (annotations *Annotations) Get(name string) (annotation Annotation, has bool)

func (*Annotations) Set

func (annotations *Annotations) Set(name string, param string)

func (*Annotations) Value added in v1.2.0

func (annotations *Annotations) Value(name string) (value string, has bool)

type DepResult

type DepResult struct {
	Version DepVersion `json:"version"`
}

type DepVersion

type DepVersion struct {
	Version string `json:"version"`
}

type Import

type Import struct {
	Path  string
	Alias string
}

func (*Import) Ident

func (i *Import) Ident() (ident string)

func (*Import) Name

func (i *Import) Name() (name string)

type Imports

type Imports map[string]*Import

Imports 一个fn文件一个,所以key不会重复,

func MergeImports

func MergeImports(ss []Imports) (v Imports)

MergeImports 在service里增加fn的imports用

func NewImportsFromAstFileImports added in v1.2.0

func NewImportsFromAstFileImports(specs []*ast.ImportSpec) (v Imports)

func (Imports) Add

func (s Imports) Add(i *Import)

func (Imports) Find

func (s Imports) Find(ident string) (v *Import, has bool)

func (Imports) Len

func (s Imports) Len() (n int)

func (Imports) Path

func (s Imports) Path(path string) (v *Import, has bool)

type Module

type Module struct {
	Dir      string
	Path     string
	Version  string
	Requires Requires
	Work     *Work
	Replace  *Module
	// contains filtered or unexported fields
}

func New

func New(path string) (v *Module, err error)

func NewWithWork

func NewWithWork(path string, workPath string) (v *Module, err error)

func (*Module) GetBuiltinType added in v1.2.0

func (mod *Module) GetBuiltinType(path string, name string) (typ *Type, has bool)

func (*Module) GetType

func (mod *Module) GetType(path string, name string) (typ *Type, has bool)

func (*Module) Parse

func (mod *Module) Parse(ctx context.Context) (err error)

func (*Module) ParseType

func (mod *Module) ParseType(ctx context.Context, path string, name string) (typ *Type, err error)

func (*Module) RegisterBuiltinType added in v1.2.0

func (mod *Module) RegisterBuiltinType(typ *Type)

func (*Module) Sources added in v1.2.0

func (mod *Module) Sources() *Sources

func (*Module) String

func (mod *Module) String() (s string)

func (*Module) Types

func (mod *Module) Types() (types *Types)

type Requires

type Requires []*Module

func (Requires) Len

func (requires Requires) Len() int

func (Requires) Less

func (requires Requires) Less(i, j int) (ok bool)

func (Requires) Swap

func (requires Requires) Swap(i, j int)

type SourceDirReader

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

func (*SourceDirReader) Each

func (reader *SourceDirReader) Each(fn func(file *ast.File, filename string) (err error)) (err error)

func (*SourceDirReader) Find

func (reader *SourceDirReader) Find(matcher func(file *ast.File) (ok bool)) (file *ast.File, err error)

type SourceFile

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

func (*SourceFile) File

func (sf *SourceFile) File() (file *ast.File, err error)

type Sources

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

func (*Sources) DestinationPath added in v1.2.0

func (sources *Sources) DestinationPath(path string) (v string, err error)

func (*Sources) FindFileInDir

func (sources *Sources) FindFileInDir(path string, matcher func(file *ast.File) (ok bool)) (file *ast.File, err error)

func (*Sources) FindTypeSpec

func (sources *Sources) FindTypeSpec(path string, name string) (spec *ast.TypeSpec, imports Imports, genericDoc string, err error)

func (*Sources) ReadDir

func (sources *Sources) ReadDir(path string, fn func(file *ast.File, filename string) (err error)) (err error)

func (*Sources) ReadFile

func (sources *Sources) ReadFile(path string, name string) (file *ast.File, filename string, err error)

type Type

type Type struct {
	Kind            TypeKind
	Path            string
	Name            string
	Annotations     Annotations
	Paradigms       []*TypeParadigm
	Tags            map[string]string
	Elements        []*Type
	ParadigmsPacked *Type
}

func (*Type) Basic

func (typ *Type) Basic() (name string, ok bool)

func (*Type) Clone added in v1.2.0

func (typ *Type) Clone() (v *Type)

func (*Type) Flats

func (typ *Type) Flats() (v map[string]*Type)

func (*Type) GetTopPaths

func (typ *Type) GetTopPaths() (paths []string)

func (*Type) Key

func (typ *Type) Key() (key string)

func (*Type) String

func (typ *Type) String() (v string)

type TypeKind

type TypeKind int

func (TypeKind) String

func (kind TypeKind) String() string

type TypeParadigm

type TypeParadigm struct {
	Name  string
	Types []*Type
}

func (*TypeParadigm) String

func (tp *TypeParadigm) String() (v string)

type TypeScope

type TypeScope struct {
	Path       string
	Mod        *Module
	Imports    Imports
	GenericDoc string
}

type Types

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

func (*Types) IsCodeErrorType added in v1.2.0

func (types *Types) IsCodeErrorType(expr ast.Expr, imports Imports) (ok bool)

func (*Types) IsContextType added in v1.2.0

func (types *Types) IsContextType(expr ast.Expr, imports Imports) (ok bool)

func (*Types) ParseExpr added in v1.2.0

func (types *Types) ParseExpr(ctx context.Context, x ast.Expr, scope *TypeScope) (typ *Type, err error)

type Work

type Work struct {
	Dir      string
	Filename string
	Uses     []*Module
	Replaces []*Module
	// contains filtered or unexported fields
}

func (*Work) Parse

func (work *Work) Parse() (err error)

func (*Work) Use

func (work *Work) Use(path string) (v *Module, used bool)

Jump to

Keyboard shortcuts

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