solver

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExprType

func ExprType(sc *meta.Scope, cs *meta.ClassParseState, n ir.Node) types.Map

ExprType returns type of expression. Depending on whether or not is it "full mode", it will also recursively resolve all nested types.

func ExprTypeCustom

func ExprTypeCustom(sc *meta.Scope, cs *meta.ClassParseState, n ir.Node, custom []CustomType) types.Map

ExprTypeCustom is ExprType that allows to specify custom types overrides.

func ExprTypeLocal

func ExprTypeLocal(sc *meta.Scope, cs *meta.ClassParseState, n ir.Node) types.Map

ExprTypeLocal is basic expression type that does not resolve cross-file function calls and such.

func ExprTypeLocalCustom

func ExprTypeLocalCustom(sc *meta.Scope, cs *meta.ClassParseState, n ir.Node, custom []CustomType) types.Map

ExprTypeLocalCustom is ExprTypeLocal that allows to specify custom types.

func Extends added in v0.3.0

func Extends(info *meta.Info, derived, base string) bool

Extends reports whether derived class extends the base class. It returns false for the derived==base case.

func FindConstant

func FindConstant(info *meta.Info, className string, constName string) (res meta.ConstInfo, implClassName string, ok bool)

FindConstant searches for a costant in specified class and returns actual class that contains the constant.

func GetClassName

func GetClassName(cs *meta.ClassParseState, classNode ir.Node) (className string, ok bool)

GetClassName resolves class name for specified class node (as used in static calls, property fetch, etc)

func GetClosure added in v0.4.0

func GetClosure(name ir.Node, sc *meta.Scope, cs *meta.ClassParseState, custom []CustomType) (meta.FuncInfo, bool)

func GetConstant

func GetConstant(cs *meta.ClassParseState, constNode ir.Node) (constName string, ci meta.ConstInfo, ok bool)

GetConstant searches for specified constant in const fetch.

func GetFuncName added in v0.3.0

func GetFuncName(cs *meta.ClassParseState, funcNode ir.Node) (funcName string, ok bool)

GetFuncName resolves func name for the specified func node.

It doesn't handle dynamic function calls where funcNode is a variable or some other kind of non-name expression.

The main purpose of this function is to expand a function name to a FQN.

func Implements

func Implements(info *meta.Info, className, interfaceName string) bool

Implements checks if className implements interfaceName

Does not perform the actual method set comparison.

func IsClosureUseFunction added in v0.5.1

func IsClosureUseFunction(name string) bool

func ResolveTypes

func ResolveTypes(info *meta.Info, curStaticClass string, m types.Map, visitedMap ResolverMap) map[string]struct{}

ResolveTypes resolves function calls, method calls and global variables.

curStaticClass is current class name (if inside the class, otherwise "")

func SideEffectFree added in v0.3.0

func SideEffectFree(sc *meta.Scope, st *meta.ClassParseState, customTypes []CustomType, n ir.Node) bool

SideEffectFree reports whether n is a side effect free expression.

If indexing is completed, some function calls may be permitted as well if they're proven to be side effect free as well.

func SideEffectFreeFunc added in v0.3.0

func SideEffectFreeFunc(sc *meta.Scope, st *meta.ClassParseState, customTypes []CustomType, stmts []ir.Node) bool

Types

type ClosureCallerInfo added in v0.3.0

type ClosureCallerInfo struct {
	Name     string      // caller function name
	ArgTypes []types.Map // types for each arg for call caller function
}

ClosureCallerInfo containing information about the function that called the closure.

type CustomType

type CustomType struct {
	Node ir.Node
	Typ  types.Map
}

CustomType specifies a mapping between some AST structure and concrete type (e.g. for <expr> instanceof <something>).

type FindMethodResult added in v0.2.0

type FindMethodResult struct {
	Info        meta.FuncInfo
	ClassName   string
	TraitName   string
	Implemented bool
}

func FindMethod

func FindMethod(info *meta.Info, className, methodName string) (FindMethodResult, bool)

FindMethod searches for a method in specified class

func (FindMethodResult) ImplName added in v0.2.0

func (m FindMethodResult) ImplName() string

type FindPropertyResult added in v0.2.0

type FindPropertyResult struct {
	Info      meta.PropertyInfo
	ClassName string
	TraitName string
}

func FindProperty

func FindProperty(info *meta.Info, className, propertyName string) (FindPropertyResult, bool)

FindProperty searches for a property in specified class (both static and instance properties)

func (FindPropertyResult) ImplName added in v0.2.0

func (p FindPropertyResult) ImplName() string

type ResolverMap added in v0.3.0

type ResolverMap map[string]map[string]struct{}

TODO: can we make it unexported?

Jump to

Keyboard shortcuts

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