asthelper

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockStmt

func BlockStmt(stmts ...ast.Stmt) *ast.BlockStmt

BlockStmt a block of multiple statments e.g. a function body

func BoundsCheck

func BoundsCheck(name string, pos int) *ast.AssignStmt

BoundsCheck "_ = name[pos]"

func CallExpr

func CallExpr(fun ast.Expr, args ...ast.Expr) *ast.CallExpr

CallExpr "fun(arg)"

func DataToByteSlice

func DataToByteSlice(data []byte) *ast.CallExpr

DataToByteSlice turns a byte slice like []byte{1, 2, 3} into an AST expression

func ExprStmt

func ExprStmt(expr ast.Expr) *ast.ExprStmt

ExprStmt convert an ast.Expr to an ast.Stmt

func Float32Lit

func Float32Lit(value float32) *ast.BasicLit

Float32Lit returns an ast.BasicLit of kind FLOAT, 32 bit

func Float64Lit

func Float64Lit(value float64) *ast.BasicLit

Float64Lit returns an ast.BasicLit of kind FLOAT, 64 bit

func IndexExpr

func IndexExpr(name string, index ast.Expr) *ast.IndexExpr

IndexExpr "name[index]"

func IntLit

func IntLit(value int) *ast.BasicLit

IntLit returns an ast.BasicLit of kind INT

func LambdaCall

func LambdaCall(resultType ast.Expr, block *ast.BlockStmt) *ast.CallExpr

LambdaCall "func() resultType {block}()"

func ReturnStmt

func ReturnStmt(results ...ast.Expr) *ast.ReturnStmt

ReturnStmt "return result"

func StringLit

func StringLit(value string) *ast.BasicLit

StringLit returns an ast.BasicLit of kind STRING

Types

This section is empty.

Jump to

Keyboard shortcuts

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