check

package
v0.0.0-...-f022186 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package check processes an ast.Function and finds used but (possibly) not initialized, and initialized but (possibly) not used. "possibly" meaning not on all code paths. Does not check nested functions (they're already codegen and not Ast) they are checked as constructed bottom up.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {

	// AllInit is the set of variables assigned to, including conditionally
	AllInit map[string]int
	// AllUsed is the set of variables read from, including conditionally
	AllUsed map[string]struct{}
	// contains filtered or unexported fields
}

func New

func New(th *Thread) *Check

New returns a Check instance

func (*Check) CheckFunc

func (ck *Check) CheckFunc(f *ast.Function)

CheckFunc is the main entry point. It can be called more than once (for nested functions).

func (*Check) CheckFunc2

func (ck *Check) CheckFunc2(f *ast.Function) set

func (*Check) CheckGlobal

func (ck *Check) CheckGlobal(name string, pos int)

CheckGlobal checks if a global name is defined. It is also called by compile constant to check class base.

func (*Check) CheckResult

func (ck *Check) CheckResult(pos int, str string)

func (*Check) CheckResults

func (ck *Check) CheckResults() []string

CheckResults returns the results sorted by code position

Jump to

Keyboard shortcuts

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