Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
23df72af
C
Coca
项目概览
Phodal
/
Coca
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Coca
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
23df72af
编写于
12月 30, 2019
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: move build method map to jclass nod
上级
1bb86731
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
21 addition
and
9 deletion
+21
-9
core/context/count/count_app.go
core/context/count/count_app.go
+5
-6
core/context/evaluate/evaluator/service.go
core/context/evaluate/evaluator/service.go
+2
-3
core/domain/jclass_node.go
core/domain/jclass_node.go
+6
-0
core/domain/jmethod.go
core/domain/jmethod.go
+4
-0
core/domain/jmethod_call.go
core/domain/jmethod_call.go
+4
-0
未找到文件。
core/context/count/count_app.go
浏览文件 @
23df72af
...
...
@@ -3,11 +3,9 @@ package count
import
"github.com/phodal/coca/core/domain"
func
BuildCallMap
(
parserDeps
[]
domain
.
JClassNode
)
map
[
string
]
int
{
var
projectMethods
=
make
(
map
[
string
]
bool
)
var
projectMethods
=
make
(
map
[
string
]
string
)
for
_
,
clz
:=
range
parserDeps
{
for
_
,
method
:=
range
clz
.
Methods
{
projectMethods
[
clz
.
Package
+
"."
+
clz
.
Class
+
"."
+
method
.
Name
]
=
true
}
clz
.
BuildStringMethodMap
(
projectMethods
)
}
// TODO: support identify data class
...
...
@@ -15,8 +13,8 @@ func BuildCallMap(parserDeps []domain.JClassNode) map[string]int {
for
_
,
clz
:=
range
parserDeps
{
for
_
,
method
:=
range
clz
.
Methods
{
for
_
,
call
:=
range
method
.
MethodCalls
{
callMethod
:=
call
.
Package
+
"."
+
call
.
Class
+
"."
+
call
.
MethodName
if
projectMethods
[
callMethod
]
{
callMethod
:=
call
.
GetFullMethodName
()
if
_
,
ok
:=
projectMethods
[
callMethod
];
ok
{
if
callMap
[
callMethod
]
==
0
{
callMap
[
callMethod
]
=
1
}
else
{
...
...
@@ -29,3 +27,4 @@ func BuildCallMap(parserDeps []domain.JClassNode) map[string]int {
return
callMap
}
core/context/evaluate/evaluator/service.go
浏览文件 @
23df72af
...
...
@@ -2,8 +2,8 @@ package evaluator
import
(
"github.com/phodal/coca/config"
"github.com/phodal/coca/core/infrastructure/apriori"
"github.com/phodal/coca/core/domain"
"github.com/phodal/coca/core/infrastructure/apriori"
"strings"
)
...
...
@@ -83,8 +83,7 @@ func (s Service) Evaluate(result *EvaluateModel, node domain.JClassNode) {
methodType
:=
method
.
Type
if
_
,
ok
:=
serviceNodeMap
[
methodType
];
ok
{
fullMethodName
:=
node
.
Package
+
"."
+
node
.
Class
+
"."
+
method
.
Name
returnTypeMap
[
methodType
]
=
append
(
returnTypeMap
[
methodType
],
fullMethodName
)
returnTypeMap
[
methodType
]
=
append
(
returnTypeMap
[
methodType
],
method
.
GetFullMethodName
(
node
))
}
}
}
...
...
core/domain/jclass_node.go
浏览文件 @
23df72af
...
...
@@ -40,3 +40,9 @@ func (j *JClassNode) SetMethodFromMap(methodMap map[string]JMethod) {
j
.
Methods
=
methodsArray
}
func
(
j
*
JClassNode
)
BuildStringMethodMap
(
projectMethods
map
[
string
]
string
)
{
for
_
,
method
:=
range
j
.
Methods
{
projectMethods
[
method
.
GetFullMethodName
(
*
j
)]
=
method
.
GetFullMethodName
(
*
j
)
}
}
core/domain/jmethod.go
浏览文件 @
23df72af
...
...
@@ -49,6 +49,10 @@ func (m *JMethod) IsGetterSetter() bool {
return
strings
.
HasPrefix
(
m
.
Name
,
"set"
)
||
strings
.
HasPrefix
(
m
.
Name
,
"get"
)
}
func
(
m
*
JMethod
)
GetFullMethodName
(
node
JClassNode
)
string
{
return
node
.
Package
+
"."
+
node
.
Class
+
"."
+
m
.
Name
}
type
JMethodInfo
struct
{
Name
string
Type
string
...
...
core/domain/jmethod_call.go
浏览文件 @
23df72af
...
...
@@ -25,3 +25,7 @@ func NewJMethodCall() JMethodCall {
StopLinePosition
:
0
,
}
}
func
(
c
*
JMethodCall
)
GetFullMethodName
()
string
{
return
c
.
Package
+
"."
+
c
.
Class
+
"."
+
c
.
MethodName
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录