File tree Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Expand file tree Collapse file tree 3 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 11* Added ` Struct ` support for ` Variant ` in ` ydb.ParamsBuilder() `
2+ * Added ` go ` with anonymous function case in ` gstack `
23
34## v3.61.2
45* Changed default transaction control to ` NoTx ` for execute query through query service client
Original file line number Diff line number Diff line change @@ -79,6 +79,12 @@ func getCallExpressionsFromStmt(statement ast.Stmt) (listOfCallExpressions []*as
7979 body = stmt .Body
8080 case * ast.ForStmt :
8181 body = stmt .Body
82+ case * ast.GoStmt :
83+ if fun , ok := stmt .Call .Fun .(* ast.FuncLit ); ok {
84+ listOfCallExpressions = append (listOfCallExpressions , getListOfCallExpressionsFromBlockStmt (fun .Body )... )
85+ } else {
86+ listOfCallExpressions = append (listOfCallExpressions , stmt .Call )
87+ }
8288 case * ast.RangeStmt :
8389 body = stmt .Body
8490 case * ast.DeclStmt :
Original file line number Diff line number Diff line change 11package stack
22
33import (
4+ "sync"
45 "testing"
6+ "time"
57
68 "github.com/stretchr/testify/require"
79)
@@ -22,6 +24,22 @@ func (e *starType) starredCall() string {
2224 return FunctionID ("" ).FunctionID ()
2325}
2426
27+ func anonymousFunctionCall () string {
28+ var result string
29+ var mu sync.Mutex
30+ go func () {
31+ mu .Lock ()
32+ defer mu .Unlock ()
33+ result = FunctionID ("" ).FunctionID ()
34+ }()
35+ time .Sleep (time .Second )
36+
37+ mu .Lock ()
38+ defer mu .Unlock ()
39+
40+ return result
41+ }
42+
2543func TestFunctionIDForGenericType (t * testing.T ) {
2644 t .Run ("StaticFunc" , func (t * testing.T ) {
2745 require .Equal (t ,
@@ -42,4 +60,10 @@ func TestFunctionIDForGenericType(t *testing.T) {
4260 x .starredCall (),
4361 )
4462 })
63+ t .Run ("AnonymousFunctionCall" , func (t * testing.T ) {
64+ require .Equal (t ,
65+ "github.com/ydb-platform/ydb-go-sdk/v3/internal/stack.anonymousFunctionCall" ,
66+ anonymousFunctionCall (),
67+ )
68+ })
4569}
You can’t perform that action at this time.
0 commit comments