Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
6fbed9c5
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
6fbed9c5
编写于
12月 25, 2019
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: [ident] add consturactor support
上级
e4b1c5a5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
35 addition
and
3 deletion
+35
-3
core/adapter/identifier/JavaIdentifierApp_test.go
core/adapter/identifier/JavaIdentifierApp_test.go
+1
-0
core/adapter/identifier/JavaIdentifierListener.go
core/adapter/identifier/JavaIdentifierListener.go
+30
-0
core/domain/refactor/rename/rename_method.go
core/domain/refactor/rename/rename_method.go
+2
-2
core/models/JMethod.go
core/models/JMethod.go
+2
-1
未找到文件。
core/adapter/identifier/JavaIdentifierApp_test.go
浏览文件 @
6fbed9c5
...
...
@@ -37,6 +37,7 @@ func TestPolymorphism_Constructor(t *testing.T) {
identApp
:=
new
(
JavaIdentifierApp
)
identifiers
:=
identApp
.
AnalysisPath
(
"../../../_fixtures/suggest/factory"
)
fmt
.
Println
(
identifiers
)
g
.
Expect
(
len
(
identifiers
))
.
To
(
Equal
(
2
))
g
.
Expect
(
identifiers
[
0
]
.
ClassName
)
.
To
(
Equal
(
"Insect"
))
g
.
Expect
(
identifiers
[
1
]
.
ClassName
)
.
To
(
Equal
(
"Bee"
))
...
...
core/adapter/identifier/JavaIdentifierListener.go
浏览文件 @
6fbed9c5
...
...
@@ -69,6 +69,36 @@ func (s *JavaIdentifierListener) ExitClassBody(ctx *parser.ClassBodyContext) {
currentNode
=
models
.
NewJIdentifier
()
}
func
(
s
*
JavaIdentifierListener
)
EnterConstructorDeclaration
(
ctx
*
parser
.
ConstructorDeclarationContext
)
{
hasEnterMethod
=
true
startLine
:=
ctx
.
GetStart
()
.
GetLine
()
startLinePosition
:=
ctx
.
GetStart
()
.
GetColumn
()
stopLine
:=
ctx
.
GetStop
()
.
GetLine
()
stopLinePosition
:=
ctx
.
GetStop
()
.
GetColumn
()
name
:=
ctx
.
IDENTIFIER
()
.
GetText
()
annotations
:=
currentMethod
.
Annotations
currentMethod
=
*&
models
.
JMethod
{
Name
:
name
,
Type
:
""
,
StartLine
:
startLine
,
StartLinePosition
:
startLinePosition
,
StopLine
:
stopLine
,
StopLinePosition
:
stopLinePosition
,
Override
:
isOverrideMethod
,
Annotations
:
annotations
,
IsConstructor
:
true
,
}
}
func
(
s
*
JavaIdentifierListener
)
ExitConstructorDeclaration
(
ctx
*
parser
.
ConstructorDeclarationContext
)
{
hasEnterMethod
=
false
currentNode
.
AddMethod
(
currentMethod
)
currentMethod
=
models
.
NewJMethod
()
}
func
(
s
*
JavaIdentifierListener
)
EnterInterfaceBodyDeclaration
(
ctx
*
parser
.
InterfaceBodyDeclarationContext
)
{
for
_
,
modifier
:=
range
ctx
.
AllModifier
()
{
modifier
:=
modifier
.
(
*
parser
.
ModifierContext
)
.
GetChild
(
0
)
...
...
core/domain/refactor/rename/rename_method.go
浏览文件 @
6fbed9c5
package
unused
import
(
"encoding/json"
models2
"github.com/phodal/coca/core/domain/refactor/base/models"
support3
"github.com/phodal/coca/core/domain/refactor/rename/support"
.
"github.com/phodal/coca/core/models"
"github.com/phodal/coca/core/support"
"encoding/json"
"io/ioutil"
"log"
"strings"
...
...
@@ -76,7 +76,7 @@ func startParse(nodes []JClassNode, relates []support3.RefactorChangeRelate) {
}
func
methodCallToMethodModel
(
call
JMethodCall
)
JMethod
{
return
*&
JMethod
{
call
.
MethodName
,
call
.
Type
,
call
.
StartLine
,
call
.
StartLinePosition
,
call
.
StopLine
,
call
.
StopLinePosition
,
nil
,
nil
,
false
,
nil
}
return
*&
JMethod
{
call
.
MethodName
,
call
.
Type
,
call
.
StartLine
,
call
.
StartLinePosition
,
call
.
StopLine
,
call
.
StopLinePosition
,
nil
,
nil
,
false
,
nil
,
false
}
}
func
updateSelfRefs
(
node
JClassNode
,
method
JMethod
,
info
*
support3
.
PackageClassInfo
)
{
...
...
core/models/JMethod.go
浏览文件 @
6fbed9c5
...
...
@@ -11,6 +11,7 @@ type JMethod struct {
MethodCalls
[]
JMethodCall
Override
bool
Annotations
[]
Annotation
IsConstructor
bool
}
type
Annotation
struct
{
...
...
@@ -31,7 +32,6 @@ func NewAnnotation() Annotation {
}
// TODO support annnotation
func
NewJMethod
()
JMethod
{
return
*&
JMethod
{
Name
:
""
,
...
...
@@ -43,6 +43,7 @@ func NewJMethod() JMethod {
StopLinePosition
:
0
,
Parameters
:
nil
,
MethodCalls
:
nil
,
IsConstructor
:
false
,
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录