未验证 提交 e9029075 编写于 作者: P Phodal Huang

fix: add lost field usage

上级 32cf6858
......@@ -52,6 +52,7 @@ func initClass() {
currentClz = ""
currentClzExtend = ""
currentMethod = models.NewJMethod()
currentNode.MethodCalls = nil
methodMap = make(map[string]models.JMethod)
methodCalls = nil
......@@ -168,6 +169,8 @@ func (s *JavaCallListener) EnterFieldDeclaration(ctx *parser.FieldDeclarationCon
value := declarator.(*parser.VariableDeclaratorContext).VariableDeclaratorId().(*parser.VariableDeclaratorIdContext).IDENTIFIER().GetText()
mapFields[value] = typeType
fields = append(fields, *&models.JAppField{Type: typeType, Value: value})
buildFieldCall(typeType, ctx)
}
}
......@@ -569,3 +572,21 @@ func buildExtend(ctx *parser.ClassDeclarationContext) {
currentNode.Extend = target
}
}
func buildFieldCall(typeType string, ctx *parser.FieldDeclarationContext) {
target, _ := warpTargetFullType(typeType)
if target != "" {
jMethodCall := &models.JMethodCall{
Package: removeTarget(target),
Type: "field",
Class: "typeType",
MethodName: "",
StartLine: ctx.GetStart().GetLine(),
StartLinePosition: ctx.GetStart().GetColumn(),
StopLine: ctx.GetStop().GetLine(),
StopLinePosition: ctx.GetStop().GetColumn(),
}
currentNode.MethodCalls = append(currentNode.MethodCalls, *jMethodCall)
}
}
......@@ -7,6 +7,7 @@ type JClassNode struct {
Path string
Fields []JAppField
Methods []JMethod
MethodCalls []JMethodCall
Extend string
Implements []string
}
......@@ -17,5 +18,5 @@ type JAppField struct {
}
func NewClassNode() JClassNode {
return *&JClassNode{"", "", "", "", nil, nil, "", nil}
return *&JClassNode{"", "", "", "", nil, nil, nil, "", nil}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册