refactor: change param to node

上级 8502b6f4
......@@ -139,31 +139,27 @@ func handleClassBodyElements(classTailContext *parser.ClassTailContext) {
constructorDeclCtx := elementChild.(*parser.ConstructorDeclarationContext)
currentNode.Methods = append(currentNode.Methods, BuildConstructorMethod(constructorDeclCtx))
case "*parser.PropertyMemberDeclarationContext":
handlePropertyMember(elementChild)
HandlePropertyMember(elementChild.(*parser.PropertyMemberDeclarationContext), currentNode)
}
}
}
func handlePropertyMember(elementChild antlr.Tree) {
propertyMemberCtx := elementChild.(*parser.PropertyMemberDeclarationContext)
func HandlePropertyMember(propertyMemberCtx *parser.PropertyMemberDeclarationContext, node *domain.JClassNode) {
callSignaturePos := 3
if propertyMemberCtx.PropertyName() != nil {
field := domain.JField{
Type: "",
Value: "",
}
field := domain.JField{}
field.Value = propertyMemberCtx.PropertyName().GetText()
field.Modifier = propertyMemberCtx.PropertyMemberBase().GetText()
if propertyMemberCtx.TypeAnnotation() != nil {
field.Type = BuildTypeAnnotation(propertyMemberCtx.TypeAnnotation().(*parser.TypeAnnotationContext))
}
currentNode.Fields = append(currentNode.Fields, field)
node.Fields = append(currentNode.Fields, field)
}
if propertyMemberCtx.GetChildCount() >= callSignaturePos {
if reflect.TypeOf(propertyMemberCtx.GetChild(2)).String() == "*parser.CallSignatureContext" {
method := BuildMemberMethod(propertyMemberCtx)
currentNode.Methods = append(currentNode.Methods, method)
node.Methods = append(currentNode.Methods, method)
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册