]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove some redundant types in decls
authorDaniel Martí <mvdan@mvdan.cc>
Sat, 16 Sep 2017 21:11:43 +0000 (22:11 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Sun, 17 Sep 2017 09:51:38 +0000 (09:51 +0000)
As per golint's suggestions.

Change-Id: Ie0c6ad9aa5dc69966a279562a341c7b095c47ede
Reviewed-on: https://go-review.googlesource.com/64192
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/gc/gsubr.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/gc/walk.go
src/cmd/compile/internal/ssa/likelyadjust.go
src/cmd/compile/internal/ssa/redblack32.go
src/cmd/compile/internal/types/type.go

index b25709b999959a34ff2cc59ee8d57ad70c4899e7..5ec2e02544233e73050c9c823ea520bf9671ef70 100644 (file)
@@ -37,7 +37,7 @@ import (
        "cmd/internal/src"
 )
 
-var sharedProgArray *[10000]obj.Prog = new([10000]obj.Prog) // *T instead of T to work around issue 19839
+var sharedProgArray = new([10000]obj.Prog) // *T instead of T to work around issue 19839
 
 // Progs accumulates Progs for a function and converts them into machine code.
 type Progs struct {
index 3896ed16b1957ab479aa6c97c804be809a9eec01..0ae0c26286a41b5f5ac2f0b617e50bd703f24b3a 100644 (file)
@@ -3775,7 +3775,7 @@ type u642fcvtTab struct {
        one                           func(*state, *types.Type, int64) *ssa.Value
 }
 
-var u64_f64 u642fcvtTab = u642fcvtTab{
+var u64_f64 = u642fcvtTab{
        geq:   ssa.OpGeq64,
        cvt2F: ssa.OpCvt64to64F,
        and:   ssa.OpAnd64,
@@ -3785,7 +3785,7 @@ var u64_f64 u642fcvtTab = u642fcvtTab{
        one:   (*state).constInt64,
 }
 
-var u64_f32 u642fcvtTab = u642fcvtTab{
+var u64_f32 = u642fcvtTab{
        geq:   ssa.OpGeq64,
        cvt2F: ssa.OpCvt64to32F,
        and:   ssa.OpAnd64,
@@ -3866,12 +3866,12 @@ type u322fcvtTab struct {
        cvtI2F, cvtF2F ssa.Op
 }
 
-var u32_f64 u322fcvtTab = u322fcvtTab{
+var u32_f64 = u322fcvtTab{
        cvtI2F: ssa.OpCvt32to64F,
        cvtF2F: ssa.OpCopy,
 }
 
-var u32_f32 u322fcvtTab = u322fcvtTab{
+var u32_f32 = u322fcvtTab{
        cvtI2F: ssa.OpCvt32to32F,
        cvtF2F: ssa.OpCvt64Fto32F,
 }
@@ -3980,7 +3980,7 @@ type f2uCvtTab struct {
        cutoff               uint64
 }
 
-var f32_u64 f2uCvtTab = f2uCvtTab{
+var f32_u64 = f2uCvtTab{
        ltf:        ssa.OpLess32F,
        cvt2U:      ssa.OpCvt32Fto64,
        subf:       ssa.OpSub32F,
@@ -3990,7 +3990,7 @@ var f32_u64 f2uCvtTab = f2uCvtTab{
        cutoff:     9223372036854775808,
 }
 
-var f64_u64 f2uCvtTab = f2uCvtTab{
+var f64_u64 = f2uCvtTab{
        ltf:        ssa.OpLess64F,
        cvt2U:      ssa.OpCvt64Fto64,
        subf:       ssa.OpSub64F,
@@ -4000,7 +4000,7 @@ var f64_u64 f2uCvtTab = f2uCvtTab{
        cutoff:     9223372036854775808,
 }
 
-var f32_u32 f2uCvtTab = f2uCvtTab{
+var f32_u32 = f2uCvtTab{
        ltf:        ssa.OpLess32F,
        cvt2U:      ssa.OpCvt32Fto32,
        subf:       ssa.OpSub32F,
@@ -4010,7 +4010,7 @@ var f32_u32 f2uCvtTab = f2uCvtTab{
        cutoff:     2147483648,
 }
 
-var f64_u32 f2uCvtTab = f2uCvtTab{
+var f64_u32 = f2uCvtTab{
        ltf:        ssa.OpLess64F,
        cvt2U:      ssa.OpCvt64Fto32,
        subf:       ssa.OpSub64F,
index cb00edb39eaf302c592e8d813e071df92597aeee..59dea3a2e1a80f7d2007c0a76dabd29914fdf87a 100644 (file)
@@ -612,7 +612,7 @@ func typecheck1(n *Node, top int) *Node {
                if et == TIDEAL {
                        et = TINT
                }
-               var aop Op = OXXX
+               aop := OXXX
                if iscmp[n.Op] && t.Etype != TIDEAL && !eqtype(l.Type, r.Type) {
                        // comparison is okay as long as one side is
                        // assignable to the other.  convert so they have
index 327ca469c36a30b6ed005c36fbb44df964d04d1e..fba037b164e67e2e24666aac81e06078c9ba3bc6 100644 (file)
@@ -2869,10 +2869,10 @@ func mkmapnames(base string) mapnames {
        return mapnames{base, base + "_fast32", base + "_fast64", base + "_faststr"}
 }
 
-var mapaccess1 mapnames = mkmapnames("mapaccess1")
-var mapaccess2 mapnames = mkmapnames("mapaccess2")
-var mapassign mapnames = mkmapnames("mapassign")
-var mapdelete mapnames = mkmapnames("mapdelete")
+var mapaccess1 = mkmapnames("mapaccess1")
+var mapaccess2 = mkmapnames("mapaccess2")
+var mapassign = mkmapnames("mapassign")
+var mapdelete = mkmapnames("mapdelete")
 
 func mapfast(t *types.Type) int {
        // Check ../../runtime/hashmap.go:maxValueSize before changing.
index 323de3d76bc0d4606fe62633656f72dab927be6f..d15037dd953dd798a0fa5239ae555f95e54c19c0 100644 (file)
@@ -104,7 +104,7 @@ const (
        blEXIT    = 3
 )
 
-var bllikelies [4]string = [4]string{"default", "call", "ret", "exit"}
+var bllikelies = [4]string{"default", "call", "ret", "exit"}
 
 func describePredictionAgrees(b *Block, prediction BranchPrediction) string {
        s := ""
index ae1ec352e782cdada986840a4de3bc798da644d9..fc9cc71ba036bf54596e29a6b24836f9ed293603 100644 (file)
@@ -244,7 +244,7 @@ func (t *node32) max() *node32 {
 }
 
 func (t *node32) glb(key int32, allow_eq bool) *node32 {
-       var best *node32 = nil
+       var best *node32
        for t != nil {
                if key <= t.key {
                        if key == t.key && allow_eq {
@@ -262,7 +262,7 @@ func (t *node32) glb(key int32, allow_eq bool) *node32 {
 }
 
 func (t *node32) lub(key int32, allow_eq bool) *node32 {
-       var best *node32 = nil
+       var best *node32
        for t != nil {
                if key >= t.key {
                        if key == t.key && allow_eq {
index d485e9cab15272a8aa0cb4743231cf89cb323c46..da5b095618174c08a2d2a2f1fccb55f1c7b433ce 100644 (file)
@@ -1429,9 +1429,9 @@ func FakeRecvType() *Type {
 }
 
 var (
-       TypeInvalid *Type = newSSA("invalid")
-       TypeMem     *Type = newSSA("mem")
-       TypeFlags   *Type = newSSA("flags")
-       TypeVoid    *Type = newSSA("void")
-       TypeInt128  *Type = newSSA("int128")
+       TypeInvalid = newSSA("invalid")
+       TypeMem     = newSSA("mem")
+       TypeFlags   = newSSA("flags")
+       TypeVoid    = newSSA("void")
+       TypeInt128  = newSSA("int128")
 )