size

package
v1.54.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package size defines the canonical identity of input-size variables shared by the complexity engine and the annotation layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cap

func Cap(param string) bound.Var

Cap is the size variable for cap(param).

func FromRef

func FromRef(r annotation.SizeRef) bound.Var

FromRef maps a parsed annotation size reference to a canonical size variable.

func IsFieldPath added in v1.5.0

func IsFieldPath(v bound.Var) bool

IsFieldPath reports whether the variable names a field-path size — one whose subject contains a field selection, e.g. len(s.items) or s.limit. Field-path sizes are frame-local: they must never leak through a call into a caller's bound (the caller cannot interpret the callee's receiver name).

func Len

func Len(param string) bound.Var

Len is the size variable for len(param).

func Num

func Num(param string) bound.Var

Num is the size variable for a numeric parameter's value.

func Value added in v1.2.0

func Value(v ssa.Value) (bound.Var, bool)

Value returns the canonical size variable of an SSA value when it is a parameter whose size is meaningful, and false otherwise.

Types

type Class added in v1.2.2

type Class int

Class is the kind of size a value contributes to a bound.

const (
	// Length marks slice/map/array/string values, sized by len().
	Length Class = iota
	// Numeric marks integer values, sized by their own magnitude.
	Numeric
)

func ValueClass added in v1.2.2

func ValueClass(v ssa.Value) (bound.Var, Class, bool)

ValueClass returns the canonical size variable of an SSA value and which kind of size it denotes: a parameter of slice/map/array/string type yields (len(p), Length); an integer parameter yields (p, Numeric).

Jump to

Keyboard shortcuts

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