forked from TrueCloudLab/frostfs-sdk-go
*: replace interface{} with any keyword
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
This commit is contained in:
parent
54faed8384
commit
38a613fce5
10 changed files with 98 additions and 98 deletions
|
@ -15,7 +15,7 @@ package apistatus
|
|||
// It should be noted that using direct typecasting is not a compatible approach.
|
||||
//
|
||||
// To transport statuses using the NeoFS API V2 protocol, see StatusV2 interface and FromStatusV2 and ToStatusV2 functions.
|
||||
type Status interface{}
|
||||
type Status any
|
||||
|
||||
// ErrFromStatus converts Status instance to error if it is failed. Returns nil on successful Status.
|
||||
//
|
||||
|
|
|
@ -123,7 +123,7 @@ func ToStatusV2(st Status) *status.Status {
|
|||
return internalErrorStatus
|
||||
}
|
||||
|
||||
func errMessageStatusV2(code interface{}, msg string) string {
|
||||
func errMessageStatusV2(code any, msg string) string {
|
||||
const (
|
||||
noMsgFmt = "status: code = %v"
|
||||
msgFmt = noMsgFmt + " message = %s"
|
||||
|
|
|
@ -12,7 +12,7 @@ func TestToStatusV2(t *testing.T) {
|
|||
type statusConstructor func() apistatus.Status
|
||||
|
||||
for _, testItem := range [...]struct {
|
||||
status interface{} // Status or statusConstructor
|
||||
status any // Status or statusConstructor
|
||||
codeV2 uint64
|
||||
messageV2 string
|
||||
}{
|
||||
|
@ -165,7 +165,7 @@ func TestFromStatusV2(t *testing.T) {
|
|||
type statusConstructor func() apistatus.Status
|
||||
|
||||
for _, testItem := range [...]struct {
|
||||
status interface{} // Status or statusConstructor
|
||||
status any // Status or statusConstructor
|
||||
codeV2 uint64
|
||||
messageV2 string
|
||||
}{
|
||||
|
|
|
@ -63,16 +63,16 @@ func TestNetworkInfo_MsPerBlock(t *testing.T) {
|
|||
}
|
||||
|
||||
func testConfigValue(t *testing.T,
|
||||
getter func(x NetworkInfo) interface{},
|
||||
setter func(x *NetworkInfo, val interface{}),
|
||||
val1, val2 interface{},
|
||||
v2Key string, v2Val func(val interface{}) []byte,
|
||||
getter func(x NetworkInfo) any,
|
||||
setter func(x *NetworkInfo, val any),
|
||||
val1, val2 any,
|
||||
v2Key string, v2Val func(val any) []byte,
|
||||
) {
|
||||
var x NetworkInfo
|
||||
|
||||
require.Zero(t, getter(x))
|
||||
|
||||
checkVal := func(exp interface{}) {
|
||||
checkVal := func(exp any) {
|
||||
require.EqualValues(t, exp, getter(x))
|
||||
|
||||
var m netmap.NetworkInfo
|
||||
|
@ -99,10 +99,10 @@ func testConfigValue(t *testing.T,
|
|||
|
||||
func TestNetworkInfo_AuditFee(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.AuditFee() },
|
||||
func(info *NetworkInfo, val interface{}) { info.SetAuditFee(val.(uint64)) },
|
||||
func(x NetworkInfo) any { return x.AuditFee() },
|
||||
func(info *NetworkInfo, val any) { info.SetAuditFee(val.(uint64)) },
|
||||
uint64(1), uint64(2),
|
||||
"AuditFee", func(val interface{}) []byte {
|
||||
"AuditFee", func(val any) []byte {
|
||||
data := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(data, val.(uint64))
|
||||
return data
|
||||
|
@ -112,10 +112,10 @@ func TestNetworkInfo_AuditFee(t *testing.T) {
|
|||
|
||||
func TestNetworkInfo_StoragePrice(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.StoragePrice() },
|
||||
func(info *NetworkInfo, val interface{}) { info.SetStoragePrice(val.(uint64)) },
|
||||
func(x NetworkInfo) any { return x.StoragePrice() },
|
||||
func(info *NetworkInfo, val any) { info.SetStoragePrice(val.(uint64)) },
|
||||
uint64(1), uint64(2),
|
||||
"BasicIncomeRate", func(val interface{}) []byte {
|
||||
"BasicIncomeRate", func(val any) []byte {
|
||||
data := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(data, val.(uint64))
|
||||
return data
|
||||
|
@ -125,10 +125,10 @@ func TestNetworkInfo_StoragePrice(t *testing.T) {
|
|||
|
||||
func TestNetworkInfo_ContainerFee(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.ContainerFee() },
|
||||
func(info *NetworkInfo, val interface{}) { info.SetContainerFee(val.(uint64)) },
|
||||
func(x NetworkInfo) any { return x.ContainerFee() },
|
||||
func(info *NetworkInfo, val any) { info.SetContainerFee(val.(uint64)) },
|
||||
uint64(1), uint64(2),
|
||||
"ContainerFee", func(val interface{}) []byte {
|
||||
"ContainerFee", func(val any) []byte {
|
||||
data := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(data, val.(uint64))
|
||||
return data
|
||||
|
@ -138,10 +138,10 @@ func TestNetworkInfo_ContainerFee(t *testing.T) {
|
|||
|
||||
func TestNetworkInfo_NamedContainerFee(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.NamedContainerFee() },
|
||||
func(info *NetworkInfo, val interface{}) { info.SetNamedContainerFee(val.(uint64)) },
|
||||
func(x NetworkInfo) any { return x.NamedContainerFee() },
|
||||
func(info *NetworkInfo, val any) { info.SetNamedContainerFee(val.(uint64)) },
|
||||
uint64(1), uint64(2),
|
||||
"ContainerAliasFee", func(val interface{}) []byte {
|
||||
"ContainerAliasFee", func(val any) []byte {
|
||||
data := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(data, val.(uint64))
|
||||
return data
|
||||
|
@ -151,10 +151,10 @@ func TestNetworkInfo_NamedContainerFee(t *testing.T) {
|
|||
|
||||
func TestNetworkInfo_EigenTrustAlpha(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.EigenTrustAlpha() },
|
||||
func(info *NetworkInfo, val interface{}) { info.SetEigenTrustAlpha(val.(float64)) },
|
||||
func(x NetworkInfo) any { return x.EigenTrustAlpha() },
|
||||
func(info *NetworkInfo, val any) { info.SetEigenTrustAlpha(val.(float64)) },
|
||||
0.1, 0.2,
|
||||
"EigenTrustAlpha", func(val interface{}) []byte {
|
||||
"EigenTrustAlpha", func(val any) []byte {
|
||||
data := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(data, math.Float64bits(val.(float64)))
|
||||
return data
|
||||
|
@ -164,10 +164,10 @@ func TestNetworkInfo_EigenTrustAlpha(t *testing.T) {
|
|||
|
||||
func TestNetworkInfo_NumberOfEigenTrustIterations(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.NumberOfEigenTrustIterations() },
|
||||
func(info *NetworkInfo, val interface{}) { info.SetNumberOfEigenTrustIterations(val.(uint64)) },
|
||||
func(x NetworkInfo) any { return x.NumberOfEigenTrustIterations() },
|
||||
func(info *NetworkInfo, val any) { info.SetNumberOfEigenTrustIterations(val.(uint64)) },
|
||||
uint64(1), uint64(2),
|
||||
"EigenTrustIterations", func(val interface{}) []byte {
|
||||
"EigenTrustIterations", func(val any) []byte {
|
||||
data := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(data, val.(uint64))
|
||||
return data
|
||||
|
@ -177,10 +177,10 @@ func TestNetworkInfo_NumberOfEigenTrustIterations(t *testing.T) {
|
|||
|
||||
func TestNetworkInfo_IRCandidateFee(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.IRCandidateFee() },
|
||||
func(info *NetworkInfo, val interface{}) { info.SetIRCandidateFee(val.(uint64)) },
|
||||
func(x NetworkInfo) any { return x.IRCandidateFee() },
|
||||
func(info *NetworkInfo, val any) { info.SetIRCandidateFee(val.(uint64)) },
|
||||
uint64(1), uint64(2),
|
||||
"InnerRingCandidateFee", func(val interface{}) []byte {
|
||||
"InnerRingCandidateFee", func(val any) []byte {
|
||||
data := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(data, val.(uint64))
|
||||
return data
|
||||
|
@ -190,10 +190,10 @@ func TestNetworkInfo_IRCandidateFee(t *testing.T) {
|
|||
|
||||
func TestNetworkInfo_MaxObjectSize(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.MaxObjectSize() },
|
||||
func(info *NetworkInfo, val interface{}) { info.SetMaxObjectSize(val.(uint64)) },
|
||||
func(x NetworkInfo) any { return x.MaxObjectSize() },
|
||||
func(info *NetworkInfo, val any) { info.SetMaxObjectSize(val.(uint64)) },
|
||||
uint64(1), uint64(2),
|
||||
"MaxObjectSize", func(val interface{}) []byte {
|
||||
"MaxObjectSize", func(val any) []byte {
|
||||
data := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(data, val.(uint64))
|
||||
return data
|
||||
|
@ -203,10 +203,10 @@ func TestNetworkInfo_MaxObjectSize(t *testing.T) {
|
|||
|
||||
func TestNetworkInfo_WithdrawalFee(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.WithdrawalFee() },
|
||||
func(info *NetworkInfo, val interface{}) { info.SetWithdrawalFee(val.(uint64)) },
|
||||
func(x NetworkInfo) any { return x.WithdrawalFee() },
|
||||
func(info *NetworkInfo, val any) { info.SetWithdrawalFee(val.(uint64)) },
|
||||
uint64(1), uint64(2),
|
||||
"WithdrawFee", func(val interface{}) []byte {
|
||||
"WithdrawFee", func(val any) []byte {
|
||||
data := make([]byte, 8)
|
||||
binary.LittleEndian.PutUint64(data, val.(uint64))
|
||||
return data
|
||||
|
@ -216,14 +216,14 @@ func TestNetworkInfo_WithdrawalFee(t *testing.T) {
|
|||
|
||||
func TestNetworkInfo_HomomorphicHashingDisabled(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.HomomorphicHashingDisabled() },
|
||||
func(info *NetworkInfo, val interface{}) {
|
||||
func(x NetworkInfo) any { return x.HomomorphicHashingDisabled() },
|
||||
func(info *NetworkInfo, val any) {
|
||||
if val.(bool) {
|
||||
info.DisableHomomorphicHashing()
|
||||
}
|
||||
},
|
||||
true, true, // it is impossible to enable hashing
|
||||
"HomomorphicHashingDisabled", func(val interface{}) []byte {
|
||||
"HomomorphicHashingDisabled", func(val any) []byte {
|
||||
data := make([]byte, 1)
|
||||
|
||||
if val.(bool) {
|
||||
|
@ -237,14 +237,14 @@ func TestNetworkInfo_HomomorphicHashingDisabled(t *testing.T) {
|
|||
|
||||
func TestNetworkInfo_MaintenanceModeAllowed(t *testing.T) {
|
||||
testConfigValue(t,
|
||||
func(x NetworkInfo) interface{} { return x.MaintenanceModeAllowed() },
|
||||
func(info *NetworkInfo, val interface{}) {
|
||||
func(x NetworkInfo) any { return x.MaintenanceModeAllowed() },
|
||||
func(info *NetworkInfo, val any) {
|
||||
if val.(bool) {
|
||||
info.AllowMaintenanceMode()
|
||||
}
|
||||
},
|
||||
true, true,
|
||||
"MaintenanceModeAllowed", func(val interface{}) []byte {
|
||||
"MaintenanceModeAllowed", func(val any) []byte {
|
||||
if val.(bool) {
|
||||
return []byte{1}
|
||||
}
|
||||
|
|
|
@ -8,58 +8,58 @@ type BaseQueryVisitor struct {
|
|||
*antlr.BaseParseTreeVisitor
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitPolicy(ctx *PolicyContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitPolicy(ctx *PolicyContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitRepStmt(ctx *RepStmtContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitRepStmt(ctx *RepStmtContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitCbfStmt(ctx *CbfStmtContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitCbfStmt(ctx *CbfStmtContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitSelectStmt(ctx *SelectStmtContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitSelectStmt(ctx *SelectStmtContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitClause(ctx *ClauseContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitClause(ctx *ClauseContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitFilterExpr(ctx *FilterExprContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitFilterExpr(ctx *FilterExprContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitFilterStmt(ctx *FilterStmtContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitFilterStmt(ctx *FilterStmtContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitExpr(ctx *ExprContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitExpr(ctx *ExprContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitFilterKey(ctx *FilterKeyContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitFilterKey(ctx *FilterKeyContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitFilterValue(ctx *FilterValueContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitFilterValue(ctx *FilterValueContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitNumber(ctx *NumberContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitNumber(ctx *NumberContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitKeyword(ctx *KeywordContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitKeyword(ctx *KeywordContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitIdent(ctx *IdentContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitIdent(ctx *IdentContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
||||
func (v *BaseQueryVisitor) VisitIdentWC(ctx *IdentWCContext) interface{} {
|
||||
func (v *BaseQueryVisitor) VisitIdentWC(ctx *IdentWCContext) any {
|
||||
return v.VisitChildren(ctx)
|
||||
}
|
||||
|
|
|
@ -383,7 +383,7 @@ func (s *PolicyContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *PolicyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *PolicyContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitPolicy(s)
|
||||
|
@ -587,7 +587,7 @@ func (s *RepStmtContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *RepStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *RepStmtContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitRepStmt(s)
|
||||
|
@ -732,7 +732,7 @@ func (s *CbfStmtContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *CbfStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *CbfStmtContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitCbfStmt(s)
|
||||
|
@ -976,7 +976,7 @@ func (s *SelectStmtContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *SelectStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *SelectStmtContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitSelectStmt(s)
|
||||
|
@ -1150,7 +1150,7 @@ func (s *ClauseContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *ClauseContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *ClauseContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitClause(s)
|
||||
|
@ -1375,7 +1375,7 @@ func (s *FilterExprContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *FilterExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *FilterExprContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitFilterExpr(s)
|
||||
|
@ -1643,7 +1643,7 @@ func (s *FilterStmtContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *FilterStmtContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *FilterStmtContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitFilterStmt(s)
|
||||
|
@ -1850,7 +1850,7 @@ func (s *ExprContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *ExprContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitExpr(s)
|
||||
|
@ -2007,7 +2007,7 @@ func (s *FilterKeyContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *FilterKeyContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *FilterKeyContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitFilterKey(s)
|
||||
|
@ -2159,7 +2159,7 @@ func (s *FilterValueContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *FilterValueContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *FilterValueContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitFilterValue(s)
|
||||
|
@ -2290,7 +2290,7 @@ func (s *NumberContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *NumberContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *NumberContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitNumber(s)
|
||||
|
@ -2422,7 +2422,7 @@ func (s *KeywordContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *KeywordContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *KeywordContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitKeyword(s)
|
||||
|
@ -2550,7 +2550,7 @@ func (s *IdentContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *IdentContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitIdent(s)
|
||||
|
@ -2686,7 +2686,7 @@ func (s *IdentWCContext) ExitRule(listener antlr.ParseTreeListener) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *IdentWCContext) Accept(visitor antlr.ParseTreeVisitor) interface{} {
|
||||
func (s *IdentWCContext) Accept(visitor antlr.ParseTreeVisitor) any {
|
||||
switch t := visitor.(type) {
|
||||
case QueryVisitor:
|
||||
return t.VisitIdentWC(s)
|
||||
|
|
|
@ -9,44 +9,44 @@ type QueryVisitor interface {
|
|||
antlr.ParseTreeVisitor
|
||||
|
||||
// Visit a parse tree produced by Query#policy.
|
||||
VisitPolicy(ctx *PolicyContext) interface{}
|
||||
VisitPolicy(ctx *PolicyContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#repStmt.
|
||||
VisitRepStmt(ctx *RepStmtContext) interface{}
|
||||
VisitRepStmt(ctx *RepStmtContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#cbfStmt.
|
||||
VisitCbfStmt(ctx *CbfStmtContext) interface{}
|
||||
VisitCbfStmt(ctx *CbfStmtContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#selectStmt.
|
||||
VisitSelectStmt(ctx *SelectStmtContext) interface{}
|
||||
VisitSelectStmt(ctx *SelectStmtContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#clause.
|
||||
VisitClause(ctx *ClauseContext) interface{}
|
||||
VisitClause(ctx *ClauseContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#filterExpr.
|
||||
VisitFilterExpr(ctx *FilterExprContext) interface{}
|
||||
VisitFilterExpr(ctx *FilterExprContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#filterStmt.
|
||||
VisitFilterStmt(ctx *FilterStmtContext) interface{}
|
||||
VisitFilterStmt(ctx *FilterStmtContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#expr.
|
||||
VisitExpr(ctx *ExprContext) interface{}
|
||||
VisitExpr(ctx *ExprContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#filterKey.
|
||||
VisitFilterKey(ctx *FilterKeyContext) interface{}
|
||||
VisitFilterKey(ctx *FilterKeyContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#filterValue.
|
||||
VisitFilterValue(ctx *FilterValueContext) interface{}
|
||||
VisitFilterValue(ctx *FilterValueContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#number.
|
||||
VisitNumber(ctx *NumberContext) interface{}
|
||||
VisitNumber(ctx *NumberContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#keyword.
|
||||
VisitKeyword(ctx *KeywordContext) interface{}
|
||||
VisitKeyword(ctx *KeywordContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#ident.
|
||||
VisitIdent(ctx *IdentContext) interface{}
|
||||
VisitIdent(ctx *IdentContext) any
|
||||
|
||||
// Visit a parse tree produced by Query#identWC.
|
||||
VisitIdentWC(ctx *IdentWCContext) interface{}
|
||||
VisitIdentWC(ctx *IdentWCContext) any
|
||||
}
|
||||
|
|
|
@ -601,17 +601,17 @@ type policyVisitor struct {
|
|||
antlr.DefaultErrorListener
|
||||
}
|
||||
|
||||
func (p *policyVisitor) SyntaxError(_ antlr.Recognizer, _ interface{}, line, column int, msg string, _ antlr.RecognitionException) {
|
||||
func (p *policyVisitor) SyntaxError(_ antlr.Recognizer, _ any, line, column int, msg string, _ antlr.RecognitionException) {
|
||||
p.reportError(fmt.Errorf("%w: line %d:%d %s", errSyntaxError, line, column, msg))
|
||||
}
|
||||
|
||||
func (p *policyVisitor) reportError(err error) interface{} {
|
||||
func (p *policyVisitor) reportError(err error) any {
|
||||
p.errors = append(p.errors, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
// VisitPolicy implements parser.QueryVisitor interface.
|
||||
func (p *policyVisitor) VisitPolicy(ctx *parser.PolicyContext) interface{} {
|
||||
func (p *policyVisitor) VisitPolicy(ctx *parser.PolicyContext) any {
|
||||
if len(p.errors) != 0 {
|
||||
return nil
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ func (p *policyVisitor) VisitPolicy(ctx *parser.PolicyContext) interface{} {
|
|||
return pl
|
||||
}
|
||||
|
||||
func (p *policyVisitor) VisitCbfStmt(ctx *parser.CbfStmtContext) interface{} {
|
||||
func (p *policyVisitor) VisitCbfStmt(ctx *parser.CbfStmtContext) any {
|
||||
cbf, err := strconv.ParseUint(ctx.GetBackupFactor().GetText(), 10, 32)
|
||||
if err != nil {
|
||||
return p.reportError(errInvalidNumber)
|
||||
|
@ -669,7 +669,7 @@ func (p *policyVisitor) VisitCbfStmt(ctx *parser.CbfStmtContext) interface{} {
|
|||
}
|
||||
|
||||
// VisitRepStmt implements parser.QueryVisitor interface.
|
||||
func (p *policyVisitor) VisitRepStmt(ctx *parser.RepStmtContext) interface{} {
|
||||
func (p *policyVisitor) VisitRepStmt(ctx *parser.RepStmtContext) any {
|
||||
num, err := strconv.ParseUint(ctx.GetCount().GetText(), 10, 32)
|
||||
if err != nil {
|
||||
return p.reportError(errInvalidNumber)
|
||||
|
@ -686,7 +686,7 @@ func (p *policyVisitor) VisitRepStmt(ctx *parser.RepStmtContext) interface{} {
|
|||
}
|
||||
|
||||
// VisitSelectStmt implements parser.QueryVisitor interface.
|
||||
func (p *policyVisitor) VisitSelectStmt(ctx *parser.SelectStmtContext) interface{} {
|
||||
func (p *policyVisitor) VisitSelectStmt(ctx *parser.SelectStmtContext) any {
|
||||
res, err := strconv.ParseUint(ctx.GetCount().GetText(), 10, 32)
|
||||
if err != nil {
|
||||
return p.reportError(errInvalidNumber)
|
||||
|
@ -712,13 +712,13 @@ func (p *policyVisitor) VisitSelectStmt(ctx *parser.SelectStmtContext) interface
|
|||
}
|
||||
|
||||
// VisitFilterStmt implements parser.QueryVisitor interface.
|
||||
func (p *policyVisitor) VisitFilterStmt(ctx *parser.FilterStmtContext) interface{} {
|
||||
func (p *policyVisitor) VisitFilterStmt(ctx *parser.FilterStmtContext) any {
|
||||
f := p.VisitFilterExpr(ctx.GetExpr().(*parser.FilterExprContext)).(*netmap.Filter)
|
||||
f.SetName(ctx.GetName().GetText())
|
||||
return f
|
||||
}
|
||||
|
||||
func (p *policyVisitor) VisitFilterExpr(ctx *parser.FilterExprContext) interface{} {
|
||||
func (p *policyVisitor) VisitFilterExpr(ctx *parser.FilterExprContext) any {
|
||||
if eCtx := ctx.Expr(); eCtx != nil {
|
||||
return eCtx.Accept(p)
|
||||
}
|
||||
|
@ -747,7 +747,7 @@ func (p *policyVisitor) VisitFilterExpr(ctx *parser.FilterExprContext) interface
|
|||
}
|
||||
|
||||
// VisitFilterKey implements parser.QueryVisitor interface.
|
||||
func (p *policyVisitor) VisitFilterKey(ctx *parser.FilterKeyContext) interface{} {
|
||||
func (p *policyVisitor) VisitFilterKey(ctx *parser.FilterKeyContext) any {
|
||||
if id := ctx.Ident(); id != nil {
|
||||
return id.GetText()
|
||||
}
|
||||
|
@ -756,7 +756,7 @@ func (p *policyVisitor) VisitFilterKey(ctx *parser.FilterKeyContext) interface{}
|
|||
return str[1 : len(str)-1]
|
||||
}
|
||||
|
||||
func (p *policyVisitor) VisitFilterValue(ctx *parser.FilterValueContext) interface{} {
|
||||
func (p *policyVisitor) VisitFilterValue(ctx *parser.FilterValueContext) any {
|
||||
if id := ctx.Ident(); id != nil {
|
||||
return id.GetText()
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ func (p *policyVisitor) VisitFilterValue(ctx *parser.FilterValueContext) interfa
|
|||
}
|
||||
|
||||
// VisitExpr implements parser.QueryVisitor interface.
|
||||
func (p *policyVisitor) VisitExpr(ctx *parser.ExprContext) interface{} {
|
||||
func (p *policyVisitor) VisitExpr(ctx *parser.ExprContext) any {
|
||||
f := new(netmap.Filter)
|
||||
if flt := ctx.GetFilter(); flt != nil {
|
||||
f.SetName(flt.GetText())
|
||||
|
|
|
@ -26,7 +26,7 @@ type NNS struct {
|
|||
nnsContract util.Uint160
|
||||
|
||||
invoker interface {
|
||||
Call(contract util.Uint160, operation string, params ...interface{}) (*result.Invoke, error)
|
||||
Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ type testNeoClient struct {
|
|||
err error
|
||||
}
|
||||
|
||||
func (x *testNeoClient) Call(contract util.Uint160, operation string, params ...interface{}) (*result.Invoke, error) {
|
||||
func (x *testNeoClient) Call(contract util.Uint160, operation string, params ...any) (*result.Invoke, error) {
|
||||
var domain string
|
||||
|
||||
require.Equal(x.t, x.expectedContract, contract)
|
||||
|
@ -49,7 +49,7 @@ type brokenArrayStackItem struct {
|
|||
stackitem.Item
|
||||
}
|
||||
|
||||
func (x brokenArrayStackItem) Value() interface{} {
|
||||
func (x brokenArrayStackItem) Value() any {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue