refactor: remove JImport

上级 71ca983b
......@@ -2,6 +2,7 @@ package deps
import (
"github.com/phodal/coca/pkg/adapter/cocafile"
"github.com/phodal/coca/pkg/domain/core_domain"
"github.com/phodal/coca/pkg/domain/jdomain"
"github.com/phodal/coca/pkg/domain/support_domain"
"path/filepath"
......@@ -15,8 +16,8 @@ func NewDepApp() *DepAnalysisApp {
return &DepAnalysisApp{}
}
func (d *DepAnalysisApp) BuildImportMap(deps []jdomain.JClassNode) map[string]jdomain.JImport {
var impMap = make(map[string]jdomain.JImport)
func (d *DepAnalysisApp) BuildImportMap(deps []jdomain.JClassNode) map[string]core_domain.CodeImport {
var impMap = make(map[string]core_domain.CodeImport)
for _, clz := range deps {
for _, imp := range clz.Imports {
impMap[imp.Source] = imp
......
package core_domain
import (
"github.com/phodal/coca/pkg/domain/jdomain"
)
type CodeMember struct {
ID string
Name string
Type string
ClassNodes []jdomain.JClassNode
Structures []CodeDataStruct
FunctionNodes []CodeFunction
Namespace []string
FileID string
......
package jdomain
import "strings"
import (
"github.com/phodal/coca/pkg/domain/core_domain"
"strings"
)
type JClassNode struct {
Package string
......@@ -14,7 +17,7 @@ type JClassNode struct {
Implements []string
Annotations []Annotation
InnerClass []JClassNode
Imports []JImport
Imports []core_domain.CodeImport
}
type JField struct {
......
package jdomain
type JImport struct {
Source string
}
import "github.com/phodal/coca/pkg/domain/core_domain"
func NewJImport(str string) JImport {
return JImport{
func NewJImport(str string) core_domain.CodeImport {
return core_domain.CodeImport{
Source: str,
}
}
......@@ -112,7 +112,6 @@
"Imports": null,
"Members": [
{
"ClassNodes": null,
"DataStructID": "Shape",
"FileID": "",
"FunctionNodes": null,
......@@ -125,10 +124,10 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "interface"
},
{
"ClassNodes": null,
"DataStructID": "Object",
"FileID": "",
"FunctionNodes": null,
......@@ -141,10 +140,10 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "interface"
},
{
"ClassNodes": null,
"DataStructID": "Material",
"FileID": "",
"FunctionNodes": null,
......@@ -157,6 +156,7 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "interface"
}
],
......
......@@ -69,7 +69,6 @@
],
"Members": [
{
"ClassNodes": null,
"DataStructID": "CodeFile",
"FileID": "testdata/node_infos/data_struct_property.code",
"FunctionNodes": null,
......@@ -82,6 +81,7 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "struct"
}
],
......
......@@ -12,7 +12,6 @@
],
"Members": [
{
"ClassNodes": null,
"DataStructID": "default",
"FileID": "",
"FunctionNodes": [
......@@ -67,6 +66,7 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "method"
}
],
......
......@@ -12,7 +12,6 @@
],
"Members": [
{
"ClassNodes": null,
"DataStructID": "default",
"FileID": "",
"FunctionNodes": [
......@@ -67,6 +66,7 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "method"
}
],
......
......@@ -19,7 +19,6 @@
],
"Members": [
{
"ClassNodes": null,
"DataStructID": "default",
"FileID": "",
"FunctionNodes": [
......@@ -121,10 +120,10 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "method"
},
{
"ClassNodes": null,
"DataStructID": "default",
"FileID": "",
"FunctionNodes": [
......@@ -226,6 +225,7 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "method"
}
],
......
......@@ -20,7 +20,6 @@
"Imports": null,
"Members": [
{
"ClassNodes": null,
"DataStructID": "O",
"FileID": "",
"FunctionNodes": [
......@@ -52,6 +51,7 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "struct"
}
],
......
......@@ -45,7 +45,6 @@
"Imports": null,
"Members": [
{
"ClassNodes": null,
"DataStructID": "Person",
"FileID": "testdata/node_infos/struct_with_func.code",
"FunctionNodes": null,
......@@ -58,6 +57,7 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "struct"
}
],
......
......@@ -53,7 +53,6 @@
],
"Members": [
{
"ClassNodes": null,
"DataStructID": "person",
"FileID": "testdata/node_infos/struct_with_func_decl.code",
"FunctionNodes": [
......@@ -108,6 +107,7 @@
"StopLine": 0,
"StopLinePosition": 0
},
"Structures": null,
"Type": "struct"
}
],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册