refactor: refactor type

上级 457f5778
...@@ -597,13 +597,13 @@ func isChainCall(targetType string) bool { ...@@ -597,13 +597,13 @@ func isChainCall(targetType string) bool {
} }
func buildMethodNameForBuilder(ctx *parser.MethodCallContext, targetType string) string { func buildMethodNameForBuilder(ctx *parser.MethodCallContext, targetType string) string {
// TODO: refactor switch parentCtx := ctx.GetParent().(type) {
if reflect.TypeOf(ctx.GetParent()).String() == "*parser.ExpressionContext" { case *parser.ExpressionContext:
parentCtx := ctx.GetParent().(*parser.ExpressionContext) switch parentParentCtx := parentCtx.GetParent().(type) {
if reflect.TypeOf(parentCtx.GetParent()).String() == "*parser.VariableInitializerContext" { case *parser.VariableInitializerContext:
varParent := parentCtx.GetParent().(*parser.VariableInitializerContext).GetParent() switch varDeclCtx := parentParentCtx.GetParent().(type) {
if reflect.TypeOf(varParent).String() == "*parser.VariableDeclaratorContext" { case *parser.VariableDeclaratorContext:
targetType = getTargetFromVarDecl(varParent, targetType) targetType = getTargetFromVarDecl(varDeclCtx, targetType)
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册