ssa2ast

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("unsupported")

Functions

func Convert

func Convert(ssaFunc *ssa.Function, cfg *ConverterConfig) (*ast.FuncDecl, error)

Types

type AstBlock

type AstBlock struct {
	Index   int
	HasRefs bool
	Body    []ast.Stmt
	Phi     []ast.Stmt
	Exit    ast.Stmt
}

type AstFunc

type AstFunc struct {
	Vars   map[string]types.Type
	Blocks []*AstBlock
}

type ConverterConfig

type ConverterConfig struct {
	// ImportNameResolver function to get the actual import name.
	// Because converting works at function level, only the caller knows actual name of the import.
	ImportNameResolver ImportNameResolver

	// NamePrefix prefix added to all new local variables. Must be reasonably unique
	NamePrefix string

	// SsaValueRemap is used to replace ssa.Value with the specified ssa.Expr.
	// Note: Replacing ssa.Expr does not guarantee the correctness of the generated code.
	// When using it, strictly adhere to the value types.
	SsaValueRemap map[ssa.Value]ast.Expr
}

func DefaultConfig

func DefaultConfig() *ConverterConfig

type ImportNameResolver

type ImportNameResolver func(pkg *types.Package) *ast.Ident

type NameType

type NameType int

Jump to

Keyboard shortcuts

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