Skip to content

Commit

Permalink
refactor: rename for better understand
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Apr 5, 2022
1 parent 393ae68 commit b757f62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/application/call/call_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func (c CallGraph) Analysis(funcName string, clzs []core_domain.CodeDataStruct,

if lookup {
var projectMethodMap = rcall.BuildProjectMethodMap(clzs)
rcallMap := rcall.BuildRCallMethodMap(clzs, projectMethodMap)
rcallMap := rcall.BuildMethodCallMap(clzs, projectMethodMap)
graph := rcall.NewRCallGraph()
rCallChain := graph.BuildRCallChain(funcName, rcallMap)
chain = chain + rCallChain
Expand Down
16 changes: 8 additions & 8 deletions pkg/application/rcall/rcall_graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ func NewRCallGraph() RCallGraph {

func (c RCallGraph) Analysis(funcName string, clzs []core_domain.CodeDataStruct, writeCallback func(rcallMap map[string][]string)) string {
var projectMethodMap = BuildProjectMethodMap(clzs)
rcallMap := BuildRCallMethodMap(clzs, projectMethodMap)
methodCallMap := BuildMethodCallMap(clzs, projectMethodMap)

writeCallback(rcallMap)
writeCallback(methodCallMap)

chain := c.BuildRCallChain(funcName, rcallMap)
chain := c.BuildRCallChain(funcName, methodCallMap)
dotContent := ToGraphviz(chain)
return dotContent
}
Expand All @@ -42,9 +42,9 @@ func BuildProjectMethodMap(clzs []core_domain.CodeDataStruct) map[string]int {
return maps
}

func BuildRCallMethodMap(parserDeps []core_domain.CodeDataStruct, projectMaps map[string]int) map[string][]string {
var methodMap = make(map[string][]string)
for _, clz := range parserDeps {
func BuildMethodCallMap(dataStructs []core_domain.CodeDataStruct, projectMaps map[string]int) map[string][]string {
var methodCallMap = make(map[string][]string)
for _, clz := range dataStructs {
for _, method := range clz.Functions {
var caller = method.BuildFullMethodName(clz)
for _, jMethodCall := range method.FunctionCalls {
Expand All @@ -53,13 +53,13 @@ func BuildRCallMethodMap(parserDeps []core_domain.CodeDataStruct, projectMaps ma
if projectMaps[callee] < 1 {
continue
}
methodMap[callee] = append(methodMap[callee], caller)
methodCallMap[callee] = append(methodCallMap[callee], caller)
}
}
}
}

return methodMap
return methodCallMap
}

var loopCount = 0
Expand Down

0 comments on commit b757f62

Please sign in to comment.