chore: change interface{} to any (#2818)
* chore: change interface{} to any
* chore: update goctl version to 1.5.0
* chore: update goctl deps
This commit is contained in:
@@ -29,7 +29,7 @@ type Api struct {
|
||||
}
|
||||
|
||||
// VisitApi implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitApi(ctx *api.ApiContext) interface{} {
|
||||
func (v *ApiVisitor) VisitApi(ctx *api.ApiContext) any {
|
||||
var final Api
|
||||
final.importM = map[string]PlaceHolder{}
|
||||
final.typeM = map[string]PlaceHolder{}
|
||||
@@ -176,7 +176,7 @@ func (v *ApiVisitor) acceptSyntax(root, final *Api) {
|
||||
}
|
||||
|
||||
// VisitSpec implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitSpec(ctx *api.SpecContext) interface{} {
|
||||
func (v *ApiVisitor) VisitSpec(ctx *api.SpecContext) any {
|
||||
var root Api
|
||||
if ctx.SyntaxLit() != nil {
|
||||
root.Syntax = ctx.SyntaxLit().Accept(v).(*SyntaxExpr)
|
||||
@@ -209,7 +209,7 @@ func (a *Api) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two Api are equal
|
||||
func (a *Api) Equal(v interface{}) bool {
|
||||
func (a *Api) Equal(v any) bool {
|
||||
if v == nil || a == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ func NewParser(options ...ParserOption) *Parser {
|
||||
|
||||
// Accept can parse any terminalNode of api tree by fn.
|
||||
// -- for debug
|
||||
func (p *Parser) Accept(fn func(p *api.ApiParserParser, visitor *ApiVisitor) interface{}, content string) (v interface{}, err error) {
|
||||
func (p *Parser) Accept(fn func(p *api.ApiParserParser, visitor *ApiVisitor) any, content string) (v any, err error) {
|
||||
defer func() {
|
||||
p := recover()
|
||||
if p != nil {
|
||||
@@ -507,7 +507,7 @@ func (p *Parser) readContent(filename string) (string, error) {
|
||||
}
|
||||
|
||||
// SyntaxError accepts errors and panic it
|
||||
func (p *Parser) SyntaxError(_ antlr.Recognizer, _ interface{}, line, column int, msg string, _ antlr.RecognitionException) {
|
||||
func (p *Parser) SyntaxError(_ antlr.Recognizer, _ any, line, column int, msg string, _ antlr.RecognitionException) {
|
||||
str := fmt.Sprintf(`%s line %d:%d %s`, p.linePrefix, line, column, msg)
|
||||
if p.debug {
|
||||
p.log.Error(str)
|
||||
|
||||
@@ -36,7 +36,7 @@ type (
|
||||
Doc() []Expr
|
||||
Comment() Expr
|
||||
Format() error
|
||||
Equal(v interface{}) bool
|
||||
Equal(v any) bool
|
||||
}
|
||||
|
||||
// Expr describes ast expression
|
||||
|
||||
@@ -13,7 +13,7 @@ type ImportExpr struct {
|
||||
}
|
||||
|
||||
// VisitImportSpec implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitImportSpec(ctx *api.ImportSpecContext) interface{} {
|
||||
func (v *ApiVisitor) VisitImportSpec(ctx *api.ImportSpecContext) any {
|
||||
var list []*ImportExpr
|
||||
if ctx.ImportLit() != nil {
|
||||
lits := ctx.ImportLit().Accept(v).([]*ImportExpr)
|
||||
@@ -28,7 +28,7 @@ func (v *ApiVisitor) VisitImportSpec(ctx *api.ImportSpecContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitImportLit implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitImportLit(ctx *api.ImportLitContext) interface{} {
|
||||
func (v *ApiVisitor) VisitImportLit(ctx *api.ImportLitContext) any {
|
||||
importToken := v.newExprWithToken(ctx.GetImportToken())
|
||||
valueExpr := ctx.ImportValue().Accept(v).(Expr)
|
||||
return []*ImportExpr{
|
||||
@@ -42,7 +42,7 @@ func (v *ApiVisitor) VisitImportLit(ctx *api.ImportLitContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitImportBlock implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitImportBlock(ctx *api.ImportBlockContext) interface{} {
|
||||
func (v *ApiVisitor) VisitImportBlock(ctx *api.ImportBlockContext) any {
|
||||
importToken := v.newExprWithToken(ctx.GetImportToken())
|
||||
values := ctx.AllImportBlockValue()
|
||||
var list []*ImportExpr
|
||||
@@ -57,7 +57,7 @@ func (v *ApiVisitor) VisitImportBlock(ctx *api.ImportBlockContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitImportBlockValue implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitImportBlockValue(ctx *api.ImportBlockValueContext) interface{} {
|
||||
func (v *ApiVisitor) VisitImportBlockValue(ctx *api.ImportBlockValueContext) any {
|
||||
value := ctx.ImportValue().Accept(v).(Expr)
|
||||
return &ImportExpr{
|
||||
Value: value,
|
||||
@@ -67,7 +67,7 @@ func (v *ApiVisitor) VisitImportBlockValue(ctx *api.ImportBlockValueContext) int
|
||||
}
|
||||
|
||||
// VisitImportValue implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitImportValue(ctx *api.ImportValueContext) interface{} {
|
||||
func (v *ApiVisitor) VisitImportValue(ctx *api.ImportValueContext) any {
|
||||
return v.newExprWithTerminalNode(ctx.STRING())
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ func (i *ImportExpr) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two ImportExpr are equal
|
||||
func (i *ImportExpr) Equal(v interface{}) bool {
|
||||
func (i *ImportExpr) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ type InfoExpr struct {
|
||||
}
|
||||
|
||||
// VisitInfoSpec implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitInfoSpec(ctx *api.InfoSpecContext) interface{} {
|
||||
func (v *ApiVisitor) VisitInfoSpec(ctx *api.InfoSpecContext) any {
|
||||
var expr InfoExpr
|
||||
expr.Info = v.newExprWithToken(ctx.GetInfoToken())
|
||||
expr.Lp = v.newExprWithToken(ctx.GetLp())
|
||||
@@ -38,7 +38,7 @@ func (i *InfoExpr) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two InfoExpr are equal
|
||||
func (i *InfoExpr) Equal(v interface{}) bool {
|
||||
func (i *InfoExpr) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ type KvExpr struct {
|
||||
}
|
||||
|
||||
// VisitKvLit implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitKvLit(ctx *api.KvLitContext) interface{} {
|
||||
func (v *ApiVisitor) VisitKvLit(ctx *api.KvLitContext) any {
|
||||
var kvExpr KvExpr
|
||||
kvExpr.Key = v.newExprWithToken(ctx.GetKey())
|
||||
commentExpr := v.getComment(ctx)
|
||||
@@ -57,7 +57,7 @@ func (k *KvExpr) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two KvExpr are equal
|
||||
func (k *KvExpr) Equal(v interface{}) bool {
|
||||
func (k *KvExpr) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ type Body struct {
|
||||
}
|
||||
|
||||
// VisitServiceSpec implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitServiceSpec(ctx *api.ServiceSpecContext) interface{} {
|
||||
func (v *ApiVisitor) VisitServiceSpec(ctx *api.ServiceSpecContext) any {
|
||||
var serviceSpec Service
|
||||
if ctx.AtServer() != nil {
|
||||
serviceSpec.AtServer = ctx.AtServer().Accept(v).(*AtServer)
|
||||
@@ -89,7 +89,7 @@ func (v *ApiVisitor) VisitServiceSpec(ctx *api.ServiceSpecContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitAtServer implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitAtServer(ctx *api.AtServerContext) interface{} {
|
||||
func (v *ApiVisitor) VisitAtServer(ctx *api.AtServerContext) any {
|
||||
var atServer AtServer
|
||||
atServer.AtServerToken = v.newExprWithTerminalNode(ctx.ATSERVER())
|
||||
atServer.Lp = v.newExprWithToken(ctx.GetLp())
|
||||
@@ -103,7 +103,7 @@ func (v *ApiVisitor) VisitAtServer(ctx *api.AtServerContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitServiceApi implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitServiceApi(ctx *api.ServiceApiContext) interface{} {
|
||||
func (v *ApiVisitor) VisitServiceApi(ctx *api.ServiceApiContext) any {
|
||||
var serviceApi ServiceApi
|
||||
serviceApi.ServiceToken = v.newExprWithToken(ctx.GetServiceToken())
|
||||
serviceName := ctx.ServiceName()
|
||||
@@ -119,7 +119,7 @@ func (v *ApiVisitor) VisitServiceApi(ctx *api.ServiceApiContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitServiceRoute implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitServiceRoute(ctx *api.ServiceRouteContext) interface{} {
|
||||
func (v *ApiVisitor) VisitServiceRoute(ctx *api.ServiceRouteContext) any {
|
||||
var serviceRoute ServiceRoute
|
||||
if ctx.AtDoc() != nil {
|
||||
serviceRoute.AtDoc = ctx.AtDoc().Accept(v).(*AtDoc)
|
||||
@@ -136,7 +136,7 @@ func (v *ApiVisitor) VisitServiceRoute(ctx *api.ServiceRouteContext) interface{}
|
||||
}
|
||||
|
||||
// VisitAtDoc implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitAtDoc(ctx *api.AtDocContext) interface{} {
|
||||
func (v *ApiVisitor) VisitAtDoc(ctx *api.AtDocContext) any {
|
||||
var atDoc AtDoc
|
||||
atDoc.AtDocToken = v.newExprWithTerminalNode(ctx.ATDOC())
|
||||
|
||||
@@ -166,7 +166,7 @@ func (v *ApiVisitor) VisitAtDoc(ctx *api.AtDocContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitAtHandler implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitAtHandler(ctx *api.AtHandlerContext) interface{} {
|
||||
func (v *ApiVisitor) VisitAtHandler(ctx *api.AtHandlerContext) any {
|
||||
var atHandler AtHandler
|
||||
astHandlerExpr := v.newExprWithTerminalNode(ctx.ATHANDLER())
|
||||
atHandler.AtHandlerToken = astHandlerExpr
|
||||
@@ -177,7 +177,7 @@ func (v *ApiVisitor) VisitAtHandler(ctx *api.AtHandlerContext) interface{} {
|
||||
}
|
||||
|
||||
// serVisitRoute implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitRoute(ctx *api.RouteContext) interface{} {
|
||||
func (v *ApiVisitor) VisitRoute(ctx *api.RouteContext) any {
|
||||
var route Route
|
||||
path := ctx.Path()
|
||||
methodExpr := v.newExprWithToken(ctx.GetHttpMethod())
|
||||
@@ -207,7 +207,7 @@ func (v *ApiVisitor) VisitRoute(ctx *api.RouteContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitBody implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitBody(ctx *api.BodyContext) interface{} {
|
||||
func (v *ApiVisitor) VisitBody(ctx *api.BodyContext) any {
|
||||
if ctx.ID() == nil {
|
||||
if v.debug {
|
||||
msg := fmt.Sprintf(
|
||||
@@ -233,7 +233,7 @@ func (v *ApiVisitor) VisitBody(ctx *api.BodyContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitReplybody implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitReplybody(ctx *api.ReplybodyContext) interface{} {
|
||||
func (v *ApiVisitor) VisitReplybody(ctx *api.ReplybodyContext) any {
|
||||
if ctx.DataType() == nil {
|
||||
if v.debug {
|
||||
msg := fmt.Sprintf(
|
||||
@@ -294,7 +294,7 @@ func (b *Body) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two Body are equal
|
||||
func (b *Body) Equal(v interface{}) bool {
|
||||
func (b *Body) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
@@ -332,7 +332,7 @@ func (r *Route) Comment() Expr {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two Route are equal
|
||||
func (r *Route) Equal(v interface{}) bool {
|
||||
func (r *Route) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
@@ -388,7 +388,7 @@ func (a *AtHandler) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two AtHandler are equal
|
||||
func (a *AtHandler) Equal(v interface{}) bool {
|
||||
func (a *AtHandler) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
@@ -416,7 +416,7 @@ func (a *AtDoc) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two AtDoc are equal
|
||||
func (a *AtDoc) Equal(v interface{}) bool {
|
||||
func (a *AtDoc) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
@@ -473,7 +473,7 @@ func (a *AtServer) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two AtServer are equal
|
||||
func (a *AtServer) Equal(v interface{}) bool {
|
||||
func (a *AtServer) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
@@ -521,7 +521,7 @@ func (a *AtServer) Equal(v interface{}) bool {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two ServiceRoute are equal
|
||||
func (s *ServiceRoute) Equal(v interface{}) bool {
|
||||
func (s *ServiceRoute) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
@@ -572,7 +572,7 @@ func (a *ServiceApi) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two ServiceApi are equal
|
||||
func (a *ServiceApi) Equal(v interface{}) bool {
|
||||
func (a *ServiceApi) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
@@ -630,7 +630,7 @@ func (s *Service) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two Service are equal
|
||||
func (s *Service) Equal(v interface{}) bool {
|
||||
func (s *Service) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ type SyntaxExpr struct {
|
||||
}
|
||||
|
||||
// VisitSyntaxLit implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitSyntaxLit(ctx *api.SyntaxLitContext) interface{} {
|
||||
func (v *ApiVisitor) VisitSyntaxLit(ctx *api.SyntaxLitContext) any {
|
||||
syntax := v.newExprWithToken(ctx.GetSyntaxToken())
|
||||
assign := v.newExprWithToken(ctx.GetAssign())
|
||||
version := v.newExprWithToken(ctx.GetVersion())
|
||||
@@ -34,7 +34,7 @@ func (s *SyntaxExpr) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two SyntaxExpr are equal
|
||||
func (s *SyntaxExpr) Equal(v interface{}) bool {
|
||||
func (s *SyntaxExpr) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ type (
|
||||
TypeExpr interface {
|
||||
Doc() []Expr
|
||||
Format() error
|
||||
Equal(v interface{}) bool
|
||||
Equal(v any) bool
|
||||
NameExpr() Expr
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ type (
|
||||
)
|
||||
|
||||
// VisitTypeSpec implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitTypeSpec(ctx *api.TypeSpecContext) interface{} {
|
||||
func (v *ApiVisitor) VisitTypeSpec(ctx *api.TypeSpecContext) any {
|
||||
if ctx.TypeLit() != nil {
|
||||
return []TypeExpr{ctx.TypeLit().Accept(v).(TypeExpr)}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ func (v *ApiVisitor) VisitTypeSpec(ctx *api.TypeSpecContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitTypeLit implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitTypeLit(ctx *api.TypeLitContext) interface{} {
|
||||
func (v *ApiVisitor) VisitTypeLit(ctx *api.TypeLitContext) any {
|
||||
typeLit := ctx.TypeLitBody().Accept(v)
|
||||
alias, ok := typeLit.(*TypeAlias)
|
||||
if ok {
|
||||
@@ -124,7 +124,7 @@ func (v *ApiVisitor) VisitTypeLit(ctx *api.TypeLitContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitTypeBlock implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitTypeBlock(ctx *api.TypeBlockContext) interface{} {
|
||||
func (v *ApiVisitor) VisitTypeBlock(ctx *api.TypeBlockContext) any {
|
||||
list := ctx.AllTypeBlockBody()
|
||||
var types []TypeExpr
|
||||
for _, each := range list {
|
||||
@@ -134,7 +134,7 @@ func (v *ApiVisitor) VisitTypeBlock(ctx *api.TypeBlockContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitTypeLitBody implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitTypeLitBody(ctx *api.TypeLitBodyContext) interface{} {
|
||||
func (v *ApiVisitor) VisitTypeLitBody(ctx *api.TypeLitBodyContext) any {
|
||||
if ctx.TypeAlias() != nil {
|
||||
return ctx.TypeAlias().Accept(v)
|
||||
}
|
||||
@@ -142,7 +142,7 @@ func (v *ApiVisitor) VisitTypeLitBody(ctx *api.TypeLitBodyContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitTypeBlockBody implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitTypeBlockBody(ctx *api.TypeBlockBodyContext) interface{} {
|
||||
func (v *ApiVisitor) VisitTypeBlockBody(ctx *api.TypeBlockBodyContext) any {
|
||||
if ctx.TypeBlockAlias() != nil {
|
||||
return ctx.TypeBlockAlias().Accept(v).(*TypeAlias)
|
||||
}
|
||||
@@ -150,7 +150,7 @@ func (v *ApiVisitor) VisitTypeBlockBody(ctx *api.TypeBlockBodyContext) interface
|
||||
}
|
||||
|
||||
// VisitTypeStruct implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitTypeStruct(ctx *api.TypeStructContext) interface{} {
|
||||
func (v *ApiVisitor) VisitTypeStruct(ctx *api.TypeStructContext) any {
|
||||
var st TypeStruct
|
||||
st.Name = v.newExprWithToken(ctx.GetStructName())
|
||||
|
||||
@@ -182,7 +182,7 @@ func (v *ApiVisitor) VisitTypeStruct(ctx *api.TypeStructContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitTypeBlockStruct implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitTypeBlockStruct(ctx *api.TypeBlockStructContext) interface{} {
|
||||
func (v *ApiVisitor) VisitTypeBlockStruct(ctx *api.TypeBlockStructContext) any {
|
||||
var st TypeStruct
|
||||
st.Name = v.newExprWithToken(ctx.GetStructName())
|
||||
|
||||
@@ -214,7 +214,7 @@ func (v *ApiVisitor) VisitTypeBlockStruct(ctx *api.TypeBlockStructContext) inter
|
||||
}
|
||||
|
||||
// VisitTypeBlockAlias implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitTypeBlockAlias(ctx *api.TypeBlockAliasContext) interface{} {
|
||||
func (v *ApiVisitor) VisitTypeBlockAlias(ctx *api.TypeBlockAliasContext) any {
|
||||
var alias TypeAlias
|
||||
alias.Name = v.newExprWithToken(ctx.GetAlias())
|
||||
alias.Assign = v.newExprWithToken(ctx.GetAssign())
|
||||
@@ -227,7 +227,7 @@ func (v *ApiVisitor) VisitTypeBlockAlias(ctx *api.TypeBlockAliasContext) interfa
|
||||
}
|
||||
|
||||
// VisitTypeAlias implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitTypeAlias(ctx *api.TypeAliasContext) interface{} {
|
||||
func (v *ApiVisitor) VisitTypeAlias(ctx *api.TypeAliasContext) any {
|
||||
var alias TypeAlias
|
||||
alias.Name = v.newExprWithToken(ctx.GetAlias())
|
||||
alias.Assign = v.newExprWithToken(ctx.GetAssign())
|
||||
@@ -240,7 +240,7 @@ func (v *ApiVisitor) VisitTypeAlias(ctx *api.TypeAliasContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitField implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitField(ctx *api.FieldContext) interface{} {
|
||||
func (v *ApiVisitor) VisitField(ctx *api.FieldContext) any {
|
||||
iAnonymousFiled := ctx.AnonymousFiled()
|
||||
iNormalFieldContext := ctx.NormalField()
|
||||
if iAnonymousFiled != nil {
|
||||
@@ -253,7 +253,7 @@ func (v *ApiVisitor) VisitField(ctx *api.FieldContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitNormalField implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitNormalField(ctx *api.NormalFieldContext) interface{} {
|
||||
func (v *ApiVisitor) VisitNormalField(ctx *api.NormalFieldContext) any {
|
||||
var field TypeField
|
||||
field.Name = v.newExprWithToken(ctx.GetFieldName())
|
||||
|
||||
@@ -276,7 +276,7 @@ func (v *ApiVisitor) VisitNormalField(ctx *api.NormalFieldContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitAnonymousFiled implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitAnonymousFiled(ctx *api.AnonymousFiledContext) interface{} {
|
||||
func (v *ApiVisitor) VisitAnonymousFiled(ctx *api.AnonymousFiledContext) any {
|
||||
start := ctx.GetStart()
|
||||
stop := ctx.GetStop()
|
||||
var field TypeField
|
||||
@@ -298,7 +298,7 @@ func (v *ApiVisitor) VisitAnonymousFiled(ctx *api.AnonymousFiledContext) interfa
|
||||
}
|
||||
|
||||
// VisitDataType implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitDataType(ctx *api.DataTypeContext) interface{} {
|
||||
func (v *ApiVisitor) VisitDataType(ctx *api.DataTypeContext) any {
|
||||
if ctx.ID() != nil {
|
||||
idExpr := v.newExprWithTerminalNode(ctx.ID())
|
||||
return &Literal{Literal: idExpr}
|
||||
@@ -326,7 +326,7 @@ func (v *ApiVisitor) VisitDataType(ctx *api.DataTypeContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitPointerType implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitPointerType(ctx *api.PointerTypeContext) interface{} {
|
||||
func (v *ApiVisitor) VisitPointerType(ctx *api.PointerTypeContext) any {
|
||||
nameExpr := v.newExprWithTerminalNode(ctx.ID())
|
||||
return &Pointer{
|
||||
PointerExpr: v.newExprWithText(ctx.GetText(), ctx.GetStar().GetLine(), ctx.GetStar().GetColumn(), ctx.GetStar().GetStart(), ctx.ID().GetSymbol().GetStop()),
|
||||
@@ -336,7 +336,7 @@ func (v *ApiVisitor) VisitPointerType(ctx *api.PointerTypeContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitMapType implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitMapType(ctx *api.MapTypeContext) interface{} {
|
||||
func (v *ApiVisitor) VisitMapType(ctx *api.MapTypeContext) any {
|
||||
return &Map{
|
||||
MapExpr: v.newExprWithText(ctx.GetText(), ctx.GetMapToken().GetLine(), ctx.GetMapToken().GetColumn(),
|
||||
ctx.GetMapToken().GetStart(), ctx.GetValue().GetStop().GetStop()),
|
||||
@@ -349,7 +349,7 @@ func (v *ApiVisitor) VisitMapType(ctx *api.MapTypeContext) interface{} {
|
||||
}
|
||||
|
||||
// VisitArrayType implements from api.BaseApiParserVisitor
|
||||
func (v *ApiVisitor) VisitArrayType(ctx *api.ArrayTypeContext) interface{} {
|
||||
func (v *ApiVisitor) VisitArrayType(ctx *api.ArrayTypeContext) any {
|
||||
return &Array{
|
||||
ArrayExpr: v.newExprWithText(ctx.GetText(), ctx.GetLbrack().GetLine(), ctx.GetLbrack().GetColumn(), ctx.GetLbrack().GetStart(), ctx.DataType().GetStop().GetStop()),
|
||||
LBrack: v.newExprWithToken(ctx.GetLbrack()),
|
||||
@@ -379,7 +379,7 @@ func (a *TypeAlias) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two TypeAlias are equal
|
||||
func (a *TypeAlias) Equal(v interface{}) bool {
|
||||
func (a *TypeAlias) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
@@ -609,7 +609,7 @@ func (s *TypeStruct) NameExpr() Expr {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two TypeStruct are equal
|
||||
func (s *TypeStruct) Equal(dt interface{}) bool {
|
||||
func (s *TypeStruct) Equal(dt any) bool {
|
||||
if dt == nil {
|
||||
return false
|
||||
}
|
||||
@@ -681,7 +681,7 @@ func (s *TypeStruct) Format() error {
|
||||
}
|
||||
|
||||
// Equal compares whether the element literals in two TypeField are equal
|
||||
func (t *TypeField) Equal(v interface{}) bool {
|
||||
func (t *TypeField) Equal(v any) bool {
|
||||
if v == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user