Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions cl/_testgop/overload-conflict/in.xgo

This file was deleted.

9 changes: 0 additions & 9 deletions cl/_testgop/overload-conflict/out.go

This file was deleted.

5 changes: 3 additions & 2 deletions cl/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1229,9 +1229,10 @@ func preloadFile(p *gogen.Package, ctx *blockCtx, f *ast.File, goFile string, ge
}
if d.Recv != nil {
var ok bool
recv, ok = d.Recv.List[0].Type.(*ast.Ident)
var recvType = d.Recv.List[0].Type
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: idiomatic Go (and the style used elsewhere in this file, e.g. line 910) prefers := over var x = expr when no explicit type annotation is needed.

Suggested change
var recvType = d.Recv.List[0].Type
recvType := d.Recv.List[0].Type

recv, ok = recvType.(*ast.Ident)
if !ok {
ctx.handleErrorf(d.Recv.List[0].Type.Pos(), d.Recv.List[0].Type.End(), "invalid recv type %v", ctx.LoadExpr(d.Recv.List[0].Type))
ctx.handleErrorf(recvType.Pos(), recvType.End(), "invalid recv type %v", ctx.LoadExpr(recvType))
break
}
ctx.lbinames = append(ctx.lbinames, recv)
Comment on lines +1232 to 1238
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The variable recvType is introduced to improve readability, but the subsequent logic for recv and ok can be simplified by directly using the type assertion on d.Recv.List[0].Type to reduce unnecessary variable declarations.

Suggested change
var recvType = d.Recv.List[0].Type
recv, ok = recvType.(*ast.Ident)
if !ok {
ctx.handleErrorf(d.Recv.List[0].Type.Pos(), d.Recv.List[0].Type.End(), "invalid recv type %v", ctx.LoadExpr(d.Recv.List[0].Type))
ctx.handleErrorf(recvType.Pos(), recvType.End(), "invalid recv type %v", ctx.LoadExpr(recvType))
break
}
ctx.lbinames = append(ctx.lbinames, recv)
recv, ok = d.Recv.List[0].Type.(*ast.Ident)
if !ok {
ctx.handleErrorf(d.Recv.List[0].Type.Pos(), d.Recv.List[0].Type.End(), "invalid recv type %v", ctx.LoadExpr(d.Recv.List[0].Type))
break
}
ctx.lbinames = append(ctx.lbinames, recv)

Expand Down
26 changes: 0 additions & 26 deletions cl/internal/overload/conflict/overload.go

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/fsnotify/fsnotify v1.9.0
github.com/goccy/go-yaml v1.19.2
github.com/goplus/cobra v1.9.15 //xgo:class
github.com/goplus/gogen v1.21.5
github.com/goplus/gogen v1.22.0
github.com/goplus/lib v0.3.1
github.com/goplus/mod v0.20.0
github.com/qiniu/x v1.16.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/goplus/cobra v1.9.15 h1:KoR19rR22R6Z/P3acdT7lCJLX+k09HV0Qt50U/Kse2c=
github.com/goplus/cobra v1.9.15/go.mod h1:p4LhfNJDKEpiGjGiNn0crUXL5dUPA5DX2ztYpEJR34E=
github.com/goplus/gogen v1.21.5 h1:RRgdN1NV2dw/PRAYMmN9N9r3B999h763pyHJ/7O3D8A=
github.com/goplus/gogen v1.21.5/go.mod h1:Y7ulYW3wonQ3d9er00b0uGFEV/IUZa6okWJZh892ACQ=
github.com/goplus/gogen v1.22.0 h1:clM2eMVWQZz7tYUU/u9xwKFCBLcyVbcstzdiZrgRdfA=
github.com/goplus/gogen v1.22.0/go.mod h1:Y7ulYW3wonQ3d9er00b0uGFEV/IUZa6okWJZh892ACQ=
github.com/goplus/lib v0.3.1 h1:Xws4DBVvgOMu58awqB972wtvTacDbk3nqcbHjdx9KSg=
github.com/goplus/lib v0.3.1/go.mod h1:SgJv3oPqLLHCu0gcL46ejOP3x7/2ry2Jtxu7ta32kp0=
github.com/goplus/mod v0.20.0 h1:vCONoomlfNLwfv5BDxqQTzaat3hHNaHLAovtkhJPwgw=
Expand Down