models

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database struct {
	Graphs  []*Graph
	Funcs   FuncMap
	Globals Globals
}

func (*Database) GetFuncByID

func (d *Database) GetFuncByID(id int64) *Func

type FQN

type FQN struct {
	Namespace_ string
	ClassName_ string
	Name_      string
}

func (FQN) ClassName

func (f FQN) ClassName() string

func (FQN) FQN

func (f FQN) FQN() string

func (FQN) Func

func (f FQN) Func() string

func (FQN) Method

func (f FQN) Method() string

func (FQN) Name

func (f FQN) Name() string

func (FQN) Namespace

func (f FQN) Namespace() string

func (FQN) String

func (f FQN) String() string

type Func

type Func struct {
	ID int64

	Fqn  FQN
	Pos_ Pos
	Rem  bool

	Globals_ Globals

	Calls_ FuncCalls

	UseCount int64
}

func (Func) Calls

func (f Func) Calls() models.IFuncCalls

func (Func) ClassName

func (f Func) ClassName() string

func (Func) CountUse

func (f Func) CountUse() int64

func (Func) FullName

func (f Func) FullName() string

func (Func) Globals

func (f Func) Globals() models.IGlobals

func (Func) Name

func (f Func) Name() string

func (Func) Namespace

func (f Func) Namespace() string

func (Func) Pos

func (f Func) Pos() Pos

type FuncCall

type FuncCall struct {
	ID int64

	Pos   Pos
	Args_ FuncCallArgs
}

func (FuncCall) Arg

func (c FuncCall) Arg(index int64) models.IFuncArg

func (FuncCall) Args

func (c FuncCall) Args() int64

func (FuncCall) File

func (c FuncCall) File() string

type FuncCallArg

type FuncCallArg struct {
	Type  FuncCallArgType
	Value string
}

func (FuncCallArg) IsBool

func (a FuncCallArg) IsBool() bool

func (FuncCallArg) IsConstant

func (a FuncCallArg) IsConstant() bool

func (FuncCallArg) IsExpression

func (a FuncCallArg) IsExpression() bool

func (FuncCallArg) IsFloat

func (a FuncCallArg) IsFloat() bool

func (FuncCallArg) IsInt

func (a FuncCallArg) IsInt() bool

func (FuncCallArg) IsString

func (a FuncCallArg) IsString() bool

func (FuncCallArg) IsVariable

func (a FuncCallArg) IsVariable() bool

func (FuncCallArg) String

func (a FuncCallArg) String() string

type FuncCallArgType

type FuncCallArgType uint8
const (
	IntArg FuncCallArgType = iota
	FloatArg
	BoolArg
	StringArg
	VariableArg
	ConstantArg
	ExpressionArg
)

type FuncCallArgs

type FuncCallArgs []FuncCallArg

type FuncCallTable

type FuncCallTable struct {
	Cols []TableCol
	Data []FuncCall
}

func (*FuncCallTable) NeedShowCol

func (t *FuncCallTable) NeedShowCol(name string) bool

type FuncCalls

type FuncCalls []FuncCall

func (FuncCalls) Count

func (f FuncCalls) Count() int64

type FuncMap

type FuncMap map[FQN]*Func

type FuncPath

type FuncPath []*Func

func (FuncPath) At

func (f FuncPath) At(index int64) models.IFunc

func (FuncPath) Begin

func (f FuncPath) Begin() models.IFunc

func (FuncPath) Contains

func (f FuncPath) Contains(funcsRaw models.IFuncTable) bool

func (FuncPath) End

func (f FuncPath) End() models.IFunc

func (FuncPath) Length

func (f FuncPath) Length() int64

type FuncTable

type FuncTable struct {
	Cols []TableCol
	Data []*Func
}

func (*FuncTable) Iterate

func (t *FuncTable) Iterate(f func(fun models.IFunc))

func (*FuncTable) Length

func (t *FuncTable) Length() int64

func (*FuncTable) NeedShowCol

func (t *FuncTable) NeedShowCol(name string) bool

type Global

type Global struct {
	ID int64

	Name_    string
	UseCount int64
}

func (Global) CountUse

func (g Global) CountUse() int64

func (Global) Id

func (g Global) Id() int64

func (Global) Name

func (g Global) Name() string

type GlobalTable

type GlobalTable struct {
	Cols []TableCol
	Data []Global
}

func (GlobalTable) Contains

func (t GlobalTable) Contains(globals models.IGlobals) bool

func (GlobalTable) Count

func (t GlobalTable) Count() int64

func (GlobalTable) Has

func (t GlobalTable) Has(global models.IGlobal) bool

func (GlobalTable) Iterate

func (t GlobalTable) Iterate(f func(fun models.IGlobal) bool)

func (GlobalTable) Length

func (t GlobalTable) Length() int64

func (GlobalTable) NeedShowCol

func (t GlobalTable) NeedShowCol(name string) bool

type Globals

type Globals struct {
	ByID   map[int64]Global
	ByName map[string]Global
}

func (Globals) Contains

func (g Globals) Contains(globals models.IGlobals) bool

func (Globals) Count

func (g Globals) Count() int64

func (Globals) Has

func (g Globals) Has(global models.IGlobal) bool

func (Globals) Iterate

func (g Globals) Iterate(cb func(global models.IGlobal) bool)

type Graph

type Graph struct {
	Nodes Nodes

	Root     int64
	Graph    RawGraph
	RevGraph RawGraph
}

Graph is a structure for storing the complete call graph, as well as the functions that are included in it.

func (*Graph) FindPaths

func (g *Graph) FindPaths(db *Database, parentID, childID int64, maxLevel int64) [][]*Func

func (*Graph) Remove

func (g *Graph) Remove(node *Node)

Remove is a function that removes the passed node from the Graph.

Note: Node is not removed from the RevGraph.

func (*Graph) ReversePaths

func (g *Graph) ReversePaths(funcs [][]*Func)

type Node

type Node struct {
	ID   int64
	Data Func

	Next NodesIDs
	Prev NodesIDs
}

Node is a structure for storing node.

func NewNode

func NewNode(id int64) *Node

NewNode creates new node with ID.

func (*Node) String

func (n *Node) String() string

String method for debugging.

type Nodes

type Nodes map[int64]*Node

func (Nodes) Remove

func (n Nodes) Remove(node *Node) Nodes

Remove is a function that removes the passed node from the slice if any.

type NodesIDs

type NodesIDs []int64

NodesIDs is an alias for a slice of graph nodes for which a Remove function is defined for ease of interaction.

func (NodesIDs) Remove

func (n NodesIDs) Remove(node *Node) NodesIDs

Remove is a function that removes the passed node from the slice if any.

type Pos

type Pos struct {
	Filename string
	Line     int32
	EndLine  int32
	Col      int32
	Length   int32 // body length
}

func (Pos) String

func (p Pos) String() string

type RawGraph

type RawGraph map[int64]NodesIDs

RawGraph is a map that stores all the functions that are called in the function or the function in which the function is called.

type TableCol

type TableCol struct {
	Name   string
	IdName string
	Hide   bool
}

Jump to

Keyboard shortcuts

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