bbq

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodePrinter

type CodePrinter[T, E any] func(
	builder *strings.Builder,
	code []E,
	resolve bool,
	constants []constant.Constant,
	types []T,
	functionNames []string,
	colorize bool,
) error

type Contract

type Contract struct {
	Name    string
	Address []byte
}

type Function

type Function[E any] struct {
	Name               string
	QualifiedName      string
	Code               []E
	ParameterCount     uint16
	TypeParameterCount uint16
	LocalCount         uint16
	TypeIndex          uint16
	LineNumbers        LineNumberTable
}

func (Function[E]) IsAnonymous

func (f Function[E]) IsAnonymous() bool

func (Function[E]) IsNative

func (f Function[E]) IsNative() bool

type Import

type Import struct {
	Location common.Location
	Name     string
}

type InstructionProgram

type InstructionProgram = Program[opcode.Instruction, StaticType]

type LineNumberTable

type LineNumberTable struct {
	Positions []PositionInfo
}

LineNumberTable holds the instruction-index to source-position mapping. It only maintains an entry for an instruction only if the position info got changed during that instruction. i.e: If multiple consecutive instructions were emitted for the same source-code position, then only the first instruction of that instruction-set would be available in the table.

func (*LineNumberTable) AddPositionInfo

func (t *LineNumberTable) AddPositionInfo(bytecodeIndex uint16, position Position)

func (*LineNumberTable) GetSourcePosition

func (t *LineNumberTable) GetSourcePosition(instructionIndex uint16) Position

type Position

type Position struct {
	StartPos ast.Position
	EndPos   ast.Position
}

func (Position) EndPosition

func (p Position) EndPosition(_ common.MemoryGauge) ast.Position

func (Position) StartPosition

func (p Position) StartPosition() ast.Position

type PositionInfo

type PositionInfo struct {
	InstructionIndex uint16
	Position         Position
}

type Program

type Program[E, T any] struct {
	Contracts []*Contract
	Imports   []Import
	Functions []Function[E]
	Constants []constant.Constant
	Variables []Variable[E]
	Types     []T
}

type ProgramPrinter

type ProgramPrinter[E, T any] struct {
	// contains filtered or unexported fields
}

func NewBytecodeProgramPrinter

func NewBytecodeProgramPrinter(resolve bool, colorize bool) *ProgramPrinter[byte, []byte]

func NewInstructionsProgramPrinter

func NewInstructionsProgramPrinter(resolve bool, colorize bool) *ProgramPrinter[opcode.Instruction, StaticType]

func (*ProgramPrinter[E, T]) PrintProgram

func (p *ProgramPrinter[E, T]) PrintProgram(program *Program[E, T]) string

type StaticType

type StaticType = interpreter.StaticType

type TypeDecoder

type TypeDecoder[T any] func(bytes T) (StaticType, error)

type Variable

type Variable[E any] struct {
	Name   string
	Getter *Function[E]
}

Directories

Path Synopsis
gen command
vm

Jump to

Keyboard shortcuts

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