effectplan

package
v0.3.47 Latest Latest
Warning

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

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

Documentation

Overview

Package effectplan performs whole-project call-graph analysis for backend effects that remain intentionally absent from TypeRB source signatures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ORMOperation

func ORMOperation(intrinsic string) bool

ORMOperation identifies intrinsics that may execute database work. It is shared by TypeScript suspension and portable execution-scope propagation.

Types

type Options

type Options struct {
	Intrinsic       func(string) bool
	Runtime         func(*ir.RuntimeBinding) bool
	Conversion      func(ir.ConversionKind) bool
	Transform       func(*ir.Transform) bool
	WebNext         bool
	CaptureLambdas  bool
	PassToFunctions bool
}

Options chooses effect roots while retaining one call-graph model.

type Plan

type Plan struct {
	Methods           map[*ir.Method]bool
	ParameterDefaults map[*ir.Method]bool
	// ClassConstructors includes direct field defaults and the class's own
	// initialize method, but never an inherited initializer.
	ClassConstructors   map[*ir.Class]bool
	RecordDefaults      map[*ir.Record]bool
	RecordFieldDefaults map[*ir.RecordField]bool
	// RecordConstructDefaults marks sites that evaluate an omitted selected
	// effect. RecordConstructSync marks sites that still need the declaration's
	// helper ABI but supplied every field whose default has that effect.
	RecordConstructDefaults map[*ir.RecordConstruct]bool
	RecordConstructSync     map[*ir.RecordConstruct]bool
	Lambdas                 map[*ir.Lambda]bool
	Calls                   map[*ir.Call]bool
	CallParameterDefaults   map[*ir.Call]bool
	EnumCalls               map[*ir.EnumCall]bool
	EnumCallDefaults        map[*ir.EnumCall]bool
	Expressions             map[ir.Expression]bool
	Iterations              map[*ir.Iterate]bool
	StructuredBlocks        map[*ir.StructuredBlock]bool
	// LambdaModules retains the source module that owns each first-class
	// function. Backend policy can use that identity without moving target-
	// specific suspension rules into shared TypeRB semantics.
	LambdaModules map[*ir.Lambda]string
	// contains filtered or unexported fields
}

Plan records the declarations and expressions that transitively reach one of the backend effects selected by Options.

func Analyze

func Analyze(programs []*ir.Program, options Options) *Plan

func ExecutionScope

func ExecutionScope(programs []*ir.Program) *Plan

ExecutionScope computes the functions that must receive the compiler-owned cancellation/deadline scope. The list contains operations whose native implementations can observe cancellation, plus web runtime boundaries that forward a child scope.

func (*Plan) Method

func (p *Plan) Method(module, owner, name string) bool

Method reports whether a named project method transitively reaches an effect root. Integrations use this stable identity when dispatch code is generated outside the module that owns the method.

func (*Plan) RecordDefault added in v0.3.44

func (p *Plan) RecordDefault(module, name string) bool

RecordDefault reports whether evaluating a record's omitted field defaults transitively reaches an effect root.

func (*Plan) RecordDefaultFor added in v0.3.44

func (p *Plan) RecordDefaultFor(record *ir.Record) bool

RecordDefaultFor reports the effect of one exact record declaration. Code generators use declaration identity so same-named records in namespaces do not accidentally share a hidden ABI.

func (*Plan) RecordFieldDefaultFor added in v0.3.44

func (p *Plan) RecordFieldDefaultFor(field *ir.RecordField) bool

RecordFieldDefaultFor reports whether one field's default reaches an effect root. Calls use this finer-grained fact so explicitly supplied fields do not make an otherwise synchronous construction effectful.

Jump to

Keyboard shortcuts

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