Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Phodal
Coca
提交
22cbd7a8
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,发现更多精彩内容 >>
未验证
提交
22cbd7a8
编写于
1月 16, 2020
作者:
P
Phodal Huang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: [ts] add basic code datasturct
上级
0bf4225d
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
42 addition
and
13 deletion
+42
-13
pkg/domain/jclass_node.go
pkg/domain/jclass_node.go
+1
-1
pkg/domain/trial/code_data_struct.go
pkg/domain/trial/code_data_struct.go
+18
-9
trial/cocago/testdata/node_infos/basic_interface.json
trial/cocago/testdata/node_infos/basic_interface.json
+3
-0
trial/cocago/testdata/node_infos/data_struct_property.json
trial/cocago/testdata/node_infos/data_struct_property.json
+1
-0
trial/cocago/testdata/node_infos/struct_type_zero.json
trial/cocago/testdata/node_infos/struct_type_zero.json
+1
-0
trial/cocago/testdata/node_infos/struct_with_func.json
trial/cocago/testdata/node_infos/struct_with_func.json
+1
-0
trial/cocago/testdata/node_infos/struct_with_func_decl.json
trial/cocago/testdata/node_infos/struct_with_func_decl.json
+1
-0
trial/pkg/ast/ts/typescript_ident_listener.go
trial/pkg/ast/ts/typescript_ident_listener.go
+16
-3
未找到文件。
pkg/domain/jclass_node.go
浏览文件 @
22cbd7a8
...
...
@@ -24,7 +24,7 @@ type JField struct {
}
func
NewClassNode
()
*
JClassNode
{
return
&
JClassNode
{
""
,
""
,
""
,
""
,
nil
,
nil
,
nil
,
""
,
nil
,
nil
,
nil
,
nil
}
return
&
JClassNode
{}
}
func
(
j
*
JClassNode
)
IsUtilClass
()
bool
{
...
...
pkg/domain/trial/code_data_struct.go
浏览文件 @
22cbd7a8
...
...
@@ -9,6 +9,7 @@ type CodeDataStruct struct {
Annotations
interface
{}
Properties
[]
CodeProperty
Functions
[]
CodeFunction
FunctionCalls
[]
CodeCall
Extension
interface
{}
}
...
...
@@ -22,3 +23,11 @@ type PythonAnnotation struct {
Name
string
Properties
[]
CodeProperty
}
func
NewDataStruct
()
*
CodeDataStruct
{
return
&
CodeDataStruct
{}
}
func
(
d
*
CodeDataStruct
)
IsNotEmpty
()
bool
{
return
len
(
d
.
Functions
)
>
0
||
len
(
d
.
FunctionCalls
)
>
0
}
trial/cocago/testdata/node_infos/basic_interface.json
浏览文件 @
22cbd7a8
...
...
@@ -5,6 +5,7 @@
"Annotations"
:
null
,
"Extend"
:
""
,
"Extension"
:
null
,
"FunctionCalls"
:
null
,
"Functions"
:
null
,
"ID"
:
""
,
"Implements"
:
null
,
...
...
@@ -43,6 +44,7 @@
"Annotations"
:
null
,
"Extend"
:
""
,
"Extension"
:
null
,
"FunctionCalls"
:
null
,
"Functions"
:
null
,
"ID"
:
""
,
"Implements"
:
null
,
...
...
@@ -72,6 +74,7 @@
"Annotations"
:
null
,
"Extend"
:
""
,
"Extension"
:
null
,
"FunctionCalls"
:
null
,
"Functions"
:
null
,
"ID"
:
""
,
"Implements"
:
null
,
...
...
trial/cocago/testdata/node_infos/data_struct_property.json
浏览文件 @
22cbd7a8
...
...
@@ -5,6 +5,7 @@
"Annotations"
:
null
,
"Extend"
:
""
,
"Extension"
:
null
,
"FunctionCalls"
:
null
,
"Functions"
:
null
,
"ID"
:
""
,
"Implements"
:
null
,
...
...
trial/cocago/testdata/node_infos/struct_type_zero.json
浏览文件 @
22cbd7a8
...
...
@@ -5,6 +5,7 @@
"Annotations"
:
null
,
"Extend"
:
""
,
"Extension"
:
null
,
"FunctionCalls"
:
null
,
"Functions"
:
null
,
"ID"
:
""
,
"Implements"
:
null
,
...
...
trial/cocago/testdata/node_infos/struct_with_func.json
浏览文件 @
22cbd7a8
...
...
@@ -5,6 +5,7 @@
"Annotations"
:
null
,
"Extend"
:
""
,
"Extension"
:
null
,
"FunctionCalls"
:
null
,
"Functions"
:
null
,
"ID"
:
""
,
"Implements"
:
null
,
...
...
trial/cocago/testdata/node_infos/struct_with_func_decl.json
浏览文件 @
22cbd7a8
...
...
@@ -5,6 +5,7 @@
"Annotations"
:
null
,
"Extend"
:
""
,
"Extension"
:
null
,
"FunctionCalls"
:
null
,
"Functions"
:
null
,
"ID"
:
""
,
"Implements"
:
null
,
...
...
trial/pkg/ast/ts/typescript_ident_listener.go
浏览文件 @
22cbd7a8
...
...
@@ -12,6 +12,10 @@ var currentNode *domain.JClassNode
var
classNodeQueue
[]
domain
.
JClassNode
var
classNodes
[]
domain
.
JClassNode
var
currentDataStruct
*
trial
.
CodeDataStruct
var
dataStructures
[]
trial
.
CodeDataStruct
var
dataStructQueue
[]
domain
.
JClassNode
var
defaultClass
=
"default"
var
filePath
string
var
codeFile
trial
.
CodeFile
...
...
@@ -24,10 +28,12 @@ func NewTypeScriptIdentListener(fileName string) *TypeScriptIdentListener {
classNodes
=
nil
filePath
=
fileName
currentNode
=
domain
.
NewClassNode
()
currentDataStruct
=
trial
.
NewDataStruct
()
codeFile
=
trial
.
CodeFile
{
FullName
:
filePath
,
Imports
:
nil
,
ClassNodes
:
nil
,
DataStructures
:
nil
,
}
return
&
TypeScriptIdentListener
{}
}
...
...
@@ -39,7 +45,14 @@ func (s *TypeScriptIdentListener) GetNodeInfo() trial.CodeFile {
currentNode
=
domain
.
NewClassNode
()
}
if
currentDataStruct
.
IsNotEmpty
()
{
currentDataStruct
.
Name
=
defaultClass
dataStructures
=
append
(
dataStructures
,
*
currentDataStruct
)
currentDataStruct
=
trial
.
NewDataStruct
()
}
codeFile
.
ClassNodes
=
classNodes
codeFile
.
DataStructures
=
dataStructures
return
codeFile
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录