Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
f23c6721
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,发现更多精彩内容 >>
未验证
提交
f23c6721
编写于
1月 16, 2020
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: remove jparameter
上级
c593b191
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
42 addition
and
39 deletion
+42
-39
_fixtures/evaluate/service_long_parameters.json
_fixtures/evaluate/service_long_parameters.json
+21
-22
pkg/application/evaluate/evaluator/service.go
pkg/application/evaluate/evaluator/service.go
+5
-5
pkg/domain/core_domain/code_property.go
pkg/domain/core_domain/code_property.go
+8
-0
pkg/domain/jdomain/jmethod.go
pkg/domain/jdomain/jmethod.go
+3
-2
pkg/domain/jdomain/jparameter.go
pkg/domain/jdomain/jparameter.go
+0
-7
pkg/infrastructure/ast/full/java_full_converter.go
pkg/infrastructure/ast/full/java_full_converter.go
+5
-3
未找到文件。
_fixtures/evaluate/service_long_parameters.json
浏览文件 @
f23c6721
...
...
@@ -24,24 +24,24 @@
"StopLinePosition"
:
40
,
"Parameters"
:
[
{
"
Nam
e"
:
"String"
,
"Type"
:
"firstname"
"
TypeTyp
e"
:
"String"
,
"Type
Name
"
:
"firstname"
},
{
"
Nam
e"
:
"String"
,
"Type"
:
"lastname"
"
TypeTyp
e"
:
"String"
,
"Type
Name
"
:
"lastname"
},
{
"
Nam
e"
:
"String"
,
"Type"
:
"address"
"
TypeTyp
e"
:
"String"
,
"Type
Name
"
:
"address"
},
{
"
Nam
e"
:
"String"
,
"Type"
:
"age"
"
TypeTyp
e"
:
"String"
,
"Type
Name
"
:
"age"
},
{
"
Nam
e"
:
"String"
,
"Type"
:
"id"
"
TypeTyp
e"
:
"String"
,
"Type
Name
"
:
"id"
}
],
"MethodCalls"
:
[],
...
...
@@ -50,7 +50,6 @@
}
],
"MethodCalls"
:
[
],
"Extend"
:
""
,
"Implements"
:
[
...
...
@@ -82,24 +81,24 @@
"StopLinePosition"
:
40
,
"Parameters"
:
[
{
"
Nam
e"
:
"String"
,
"Type"
:
"name"
"
TypeTyp
e"
:
"String"
,
"Type
Name
"
:
"name"
},
{
"
Nam
e"
:
"String"
,
"Type"
:
"firstname"
"
TypeTyp
e"
:
"String"
,
"Type
Name
"
:
"firstname"
},
{
"
Nam
e"
:
"String"
,
"Type"
:
"lastname"
"
TypeTyp
e"
:
"String"
,
"Type
Name
"
:
"lastname"
},
{
"
Nam
e"
:
"String"
,
"Type"
:
"address"
"
TypeTyp
e"
:
"String"
,
"Type
Name
"
:
"address"
},
{
"
Nam
e"
:
"String"
,
"Type"
:
"age"
"
TypeTyp
e"
:
"String"
,
"Type
Name
"
:
"age"
}
],
"MethodCalls"
:
[],
...
...
@@ -136,7 +135,7 @@
"StopLinePosition"
:
40
,
"Parameters"
:
[
{
"
Nam
e"
:
"String"
,
"
TypeTyp
e"
:
"String"
,
"Type"
:
"age"
}
],
...
...
pkg/application/evaluate/evaluator/service.go
浏览文件 @
f23c6721
...
...
@@ -24,17 +24,17 @@ func (s Service) EvaluateList(evaluateModel *EvaluateModel, nodes []jdomain.JCla
}
evaluateModel
.
ServiceSummary
.
ReturnTypeMap
=
returnTypeMap
findRelatedMethodParameter
(
evaluateModel
,
longParameterList
)
findRelatedMethodParameter
s
(
evaluateModel
,
longParameterList
)
}
func
findRelatedMethodParameter
(
model
*
EvaluateModel
,
list
[]
jdomain
.
JMethod
)
{
func
findRelatedMethodParameter
s
(
model
*
EvaluateModel
,
list
[]
jdomain
.
JMethod
)
{
var
dataset
[][]
string
for
_
,
method
:=
range
list
{
var
methodl
ist
[]
string
var
paramTypeL
ist
[]
string
for
_
,
param
:=
range
method
.
Parameters
{
methodlist
=
append
(
methodlist
,
param
.
Typ
e
)
paramTypeList
=
append
(
paramTypeList
,
param
.
TypeNam
e
)
}
dataset
=
append
(
dataset
,
methodl
ist
)
dataset
=
append
(
dataset
,
paramTypeL
ist
)
}
var
newOptions
=
apriori
.
NewOptions
(
0.8
,
0.8
,
0
,
0
)
...
...
pkg/domain/core_domain/code_property.go
浏览文件 @
f23c6721
...
...
@@ -8,3 +8,11 @@ type CodeProperty struct {
ReturnTypes
[]
CodeProperty
Parameters
[]
CodeProperty
}
func
NewCodeParameter
(
typeName
string
,
typeType
string
)
CodeProperty
{
return
CodeProperty
{
TypeName
:
typeName
,
TypeType
:
typeType
,
}
}
pkg/domain/jdomain/jmethod.go
浏览文件 @
f23c6721
package
jdomain
import
(
"github.com/phodal/coca/pkg/domain/core_domain"
"github.com/phodal/coca/pkg/infrastructure/string_helper"
"strings"
)
...
...
@@ -12,7 +13,7 @@ type JMethod struct {
StartLinePosition
int
StopLine
int
StopLinePosition
int
Parameters
[]
JParameter
Parameters
[]
core_domain
.
CodeProperty
MethodCalls
[]
JMethodCall
Override
bool
Annotations
[]
Annotation
...
...
@@ -29,7 +30,7 @@ func NewJMethod() JMethod {
type
JMethodInfo
struct
{
Name
string
Type
string
Parameters
[]
JParameter
Parameters
[]
core_domain
.
CodeProperty
Length
string
}
...
...
pkg/domain/jdomain/jparameter.go
已删除
100644 → 0
浏览文件 @
c593b191
package
jdomain
type
JParameter
struct
{
Name
string
Type
string
}
pkg/infrastructure/ast/full/java_full_converter.go
浏览文件 @
f23c6721
...
...
@@ -2,12 +2,13 @@ package full
import
(
"github.com/phodal/coca/languages/java"
"github.com/phodal/coca/pkg/domain/core_domain"
"github.com/phodal/coca/pkg/domain/jdomain"
"strings"
)
func
BuildMethodParameters
(
parameters
parser
.
IFormalParametersContext
)
[]
jdomain
.
JParameter
{
var
methodParams
[]
jdomain
.
JParameter
=
nil
func
BuildMethodParameters
(
parameters
parser
.
IFormalParametersContext
)
[]
core_domain
.
CodeProperty
{
var
methodParams
[]
core_domain
.
CodeProperty
=
nil
parameterList
:=
parameters
.
GetChild
(
1
)
.
(
*
parser
.
FormalParameterListContext
)
formalParameter
:=
parameterList
.
AllFormalParameter
()
for
_
,
param
:=
range
formalParameter
{
...
...
@@ -16,7 +17,8 @@ func BuildMethodParameters(parameters parser.IFormalParametersContext) []jdomain
paramValue
:=
paramContext
.
VariableDeclaratorId
()
.
(
*
parser
.
VariableDeclaratorIdContext
)
.
IDENTIFIER
()
.
GetText
()
localVars
[
paramValue
]
=
paramType
methodParams
=
append
(
methodParams
,
jdomain
.
JParameter
{
Name
:
paramValue
,
Type
:
paramType
})
parameter
:=
core_domain
.
NewCodeParameter
(
paramValue
,
paramType
)
methodParams
=
append
(
methodParams
,
parameter
)
}
return
methodParams
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录