Documentation
¶
Index ¶
- func ExprType(sc *meta.Scope, cs *meta.ClassParseState, n ir.Node) types.Map
- func ExprTypeCustom(sc *meta.Scope, cs *meta.ClassParseState, n ir.Node, custom []CustomType) types.Map
- func ExprTypeLocal(sc *meta.Scope, cs *meta.ClassParseState, n ir.Node) types.Map
- func ExprTypeLocalCustom(sc *meta.Scope, cs *meta.ClassParseState, n ir.Node, custom []CustomType) types.Map
- func Extends(info *meta.Info, derived, base string) bool
- func FindConstant(info *meta.Info, className string, constName string) (res meta.ConstInfo, implClassName string, ok bool)
- func GetClassName(cs *meta.ClassParseState, classNode ir.Node) (className string, ok bool)
- func GetClosure(name ir.Node, sc *meta.Scope, cs *meta.ClassParseState, custom []CustomType) (meta.FuncInfo, bool)
- func GetConstant(cs *meta.ClassParseState, constNode ir.Node) (constName string, ci meta.ConstInfo, ok bool)
- func GetFuncName(cs *meta.ClassParseState, funcNode ir.Node) (funcName string, ok bool)
- func Implements(info *meta.Info, className, interfaceName string) bool
- func IsClosureUseFunction(name string) bool
- func ResolveTypes(info *meta.Info, curStaticClass string, m types.Map, visitedMap ResolverMap) map[string]struct{}
- func SideEffectFree(sc *meta.Scope, st *meta.ClassParseState, customTypes []CustomType, n ir.Node) bool
- func SideEffectFreeFunc(sc *meta.Scope, st *meta.ClassParseState, customTypes []CustomType, ...) bool
- type ClosureCallerInfo
- type CustomType
- type FindMethodResult
- type FindPropertyResult
- type ResolverMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExprType ¶
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 ¶
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
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 ¶
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
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 ¶
Implements checks if className implements interfaceName
Does not perform the actual method set comparison.
func IsClosureUseFunction ¶ added in v0.5.1
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 ¶
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
TODO: can we make it unexported?