]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: clean up C->Go translation artifacts in badtype
authorAlberto Donizetti <alb.donizetti@gmail.com>
Thu, 15 Oct 2020 12:48:26 +0000 (14:48 +0200)
committerAlberto Donizetti <alb.donizetti@gmail.com>
Thu, 15 Oct 2020 18:07:26 +0000 (18:07 +0000)
Change-Id: I576a596ed8e9ce14e3750031d0e338e9276eff1e
Reviewed-on: https://go-review.googlesource.com/c/go/+/262537
Trust: Alberto Donizetti <alb.donizetti@gmail.com>
Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/subr.go

index 02428323223852c8fcc7426a3d62b6ee498d3543..c5ef707cb79f32225df4cea01874ef6420e24462 100644 (file)
@@ -1040,25 +1040,24 @@ func calcHasCall(n *Node) bool {
        return false
 }
 
-func badtype(op Op, tl *types.Type, tr *types.Type) {
-       fmt_ := ""
+func badtype(op Op, tl, tr *types.Type) {
+       var s string
        if tl != nil {
-               fmt_ += fmt.Sprintf("\n\t%v", tl)
+               s += fmt.Sprintf("\n\t%v", tl)
        }
        if tr != nil {
-               fmt_ += fmt.Sprintf("\n\t%v", tr)
+               s += fmt.Sprintf("\n\t%v", tr)
        }
 
        // common mistake: *struct and *interface.
        if tl != nil && tr != nil && tl.IsPtr() && tr.IsPtr() {
                if tl.Elem().IsStruct() && tr.Elem().IsInterface() {
-                       fmt_ += "\n\t(*struct vs *interface)"
+                       s += "\n\t(*struct vs *interface)"
                } else if tl.Elem().IsInterface() && tr.Elem().IsStruct() {
-                       fmt_ += "\n\t(*interface vs *struct)"
+                       s += "\n\t(*interface vs *struct)"
                }
        }
 
-       s := fmt_
        yyerror("illegal types for operand: %v%s", op, s)
 }