bug.go 726 字节
Newer Older
P
Phodal Huang 已提交
1 2 3 4 5 6 7
package main

import (
	"encoding/json"
	"fmt"
	"github.com/phodal/coca/core/adapter/call"
	"github.com/phodal/coca/core/adapter/identifier"
P
Phodal Huang 已提交
8
	"github.com/pkg/profile"
P
Phodal Huang 已提交
9 10 11
)

func main()  {
P
Phodal Huang 已提交
12 13
	defer profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook)

P
Phodal Huang 已提交
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
	path := "_fixtures/abug"

	identifierApp := identifier.NewJavaIdentifierApp()
	iNodes := identifierApp.AnalysisPath(path)

	fmt.Println(iNodes)

	var classes []string = nil

	for _, node := range iNodes {
		classes = append(classes, node.Package+"."+node.ClassName)
	}

	callApp := new(call.JavaCallApp)

	callNodes := callApp.AnalysisPath(path, classes, iNodes)
	cModel, _ := json.MarshalIndent(callNodes, "", "\t")

	fmt.Println(string(cModel))
}