From: Austin Clements Date: Fri, 25 Sep 2009 16:37:35 +0000 (-0700) Subject: s/switch _ :=/switch/ X-Git-Tag: weekly.2009-11-06~481 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=cbcd146f5d6c00284613a228626f3c446474d9f9;p=gostls13.git s/switch _ :=/switch/ R=rsc APPROVED=rsc DELTA=36 (0 added, 0 deleted, 36 changed) OCL=34971 CL=35006 --- diff --git a/usr/austin/eval/expr.go b/usr/austin/eval/expr.go index 5c4e792491..e8ca933146 100644 --- a/usr/austin/eval/expr.go +++ b/usr/austin/eval/expr.go @@ -153,7 +153,7 @@ func (a *expr) convertTo(t Type) *expr { // exceeds max. If negErr is not "", produces an error if possible if // the value is negative. func (a *expr) convertToInt(max int64, negErr string, errOp string) *expr { - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { case *idealIntType: val := a.asIdealInt()(); if negErr != "" && val.IsNeg() { @@ -1773,7 +1773,7 @@ func (a *compiler) compileArrayLen(b *block, expr ast.Expr) (int64, bool) { return 0, false; } - switch _ := lenExpr.t.lit().(type) { + switch lenExpr.t.lit().(type) { case *intType: return lenExpr.asInt()(nil), true; case *uintType: diff --git a/usr/austin/eval/expr1.go b/usr/austin/eval/expr1.go index 9e297e4697..d337ea1770 100644 --- a/usr/austin/eval/expr1.go +++ b/usr/austin/eval/expr1.go @@ -95,7 +95,7 @@ func (a *expr) asInterface() (func(*Thread) interface{}) { */ func (a *expr) genConstant(v Value) { - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { case *boolType: a.eval = func(t *Thread) bool { return v.(BoolValue).Get(t) } case *uintType: @@ -131,7 +131,7 @@ func (a *expr) genConstant(v Value) { func (a *expr) genIdentOp(level, index int) { a.evalAddr = func(t *Thread) Value { return t.f.Get(level, index) }; - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { case *boolType: a.eval = func(t *Thread) bool { return t.f.Get(level, index).(BoolValue).Get(t) } case *uintType: @@ -161,7 +161,7 @@ func (a *expr) genIdentOp(level, index int) { func (a *expr) genFuncCall(call func(t *Thread) []Value) { a.exec = func(t *Thread) { call(t)}; - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { case *boolType: a.eval = func(t *Thread) bool { return call(t)[0].(BoolValue).Get(t) } case *uintType: @@ -193,7 +193,7 @@ func (a *expr) genFuncCall(call func(t *Thread) []Value) { func (a *expr) genValue(vf func(*Thread) Value) { a.evalAddr = vf; - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { case *boolType: a.eval = func(t *Thread) bool { return vf(t).(BoolValue).Get(t) } case *uintType: @@ -222,7 +222,7 @@ func (a *expr) genValue(vf func(*Thread) Value) { } func (a *expr) genUnaryOpNeg(v *expr) { - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { case *uintType: vf := v.asUint(); a.eval = func(t *Thread) uint64 { v := vf(t); return -v } @@ -246,7 +246,7 @@ func (a *expr) genUnaryOpNeg(v *expr) { } func (a *expr) genUnaryOpNot(v *expr) { - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { case *boolType: vf := v.asBool(); a.eval = func(t *Thread) bool { v := vf(t); return !v } @@ -256,7 +256,7 @@ func (a *expr) genUnaryOpNot(v *expr) { } func (a *expr) genUnaryOpXor(v *expr) { - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { case *uintType: vf := v.asUint(); a.eval = func(t *Thread) uint64 { v := vf(t); return ^v } @@ -273,7 +273,7 @@ func (a *expr) genUnaryOpXor(v *expr) { } func (a *expr) genBinOpAdd(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -306,7 +306,7 @@ func (a *expr) genBinOpAdd(l, r *expr) { } func (a *expr) genBinOpSub(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -335,7 +335,7 @@ func (a *expr) genBinOpSub(l, r *expr) { } func (a *expr) genBinOpMul(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -364,7 +364,7 @@ func (a *expr) genBinOpMul(l, r *expr) { } func (a *expr) genBinOpQuo(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -393,7 +393,7 @@ func (a *expr) genBinOpQuo(l, r *expr) { } func (a *expr) genBinOpRem(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -413,7 +413,7 @@ func (a *expr) genBinOpRem(l, r *expr) { } func (a *expr) genBinOpAnd(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -433,7 +433,7 @@ func (a *expr) genBinOpAnd(l, r *expr) { } func (a *expr) genBinOpOr(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -453,7 +453,7 @@ func (a *expr) genBinOpOr(l, r *expr) { } func (a *expr) genBinOpXor(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -473,7 +473,7 @@ func (a *expr) genBinOpXor(l, r *expr) { } func (a *expr) genBinOpAndNot(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -493,7 +493,7 @@ func (a *expr) genBinOpAndNot(l, r *expr) { } func (a *expr) genBinOpShl(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -508,7 +508,7 @@ func (a *expr) genBinOpShl(l, r *expr) { } func (a *expr) genBinOpShr(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -523,7 +523,7 @@ func (a *expr) genBinOpShr(l, r *expr) { } func (a *expr) genBinOpLss(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -556,7 +556,7 @@ func (a *expr) genBinOpLss(l, r *expr) { } func (a *expr) genBinOpGtr(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -589,7 +589,7 @@ func (a *expr) genBinOpGtr(l, r *expr) { } func (a *expr) genBinOpLeq(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -622,7 +622,7 @@ func (a *expr) genBinOpLeq(l, r *expr) { } func (a *expr) genBinOpGeq(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *uintType: lf := l.asUint(); rf := r.asUint(); @@ -655,7 +655,7 @@ func (a *expr) genBinOpGeq(l, r *expr) { } func (a *expr) genBinOpEql(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *boolType: lf := l.asBool(); rf := r.asBool(); @@ -704,7 +704,7 @@ func (a *expr) genBinOpEql(l, r *expr) { } func (a *expr) genBinOpNeq(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { case *boolType: lf := l.asBool(); rf := r.asBool(); @@ -753,7 +753,7 @@ func (a *expr) genBinOpNeq(l, r *expr) { } func genAssign(lt Type, r *expr) (func(lv Value, t *Thread)) { - switch _ := lt.lit().(type) { + switch lt.lit().(type) { case *boolType: rf := r.asBool(); return func(lv Value, t *Thread) { lv.(BoolValue).Set(t, rf(t)) } diff --git a/usr/austin/eval/gen.go b/usr/austin/eval/gen.go index cbb8fd27b3..5e7465e3d7 100644 --- a/usr/austin/eval/gen.go +++ b/usr/austin/eval/gen.go @@ -181,7 +181,7 @@ func (a *expr) asInterface() (func(*Thread) interface{}) { */ func (a *expr) genConstant(v Value) { - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { «.repeated section Types» case «Repr»: «.section IsIdeal» @@ -198,7 +198,7 @@ func (a *expr) genConstant(v Value) { func (a *expr) genIdentOp(level, index int) { a.evalAddr = func(t *Thread) Value { return t.f.Get(level, index) }; - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { «.repeated section Types» «.section IsIdeal» «.or» @@ -213,7 +213,7 @@ func (a *expr) genIdentOp(level, index int) { func (a *expr) genFuncCall(call func(t *Thread) []Value) { a.exec = func(t *Thread) { call(t)}; - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { «.repeated section Types» «.section IsIdeal» «.or» @@ -230,7 +230,7 @@ func (a *expr) genFuncCall(call func(t *Thread) []Value) { func (a *expr) genValue(vf func(*Thread) Value) { a.evalAddr = vf; - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { «.repeated section Types» «.section IsIdeal» «.or» @@ -245,7 +245,7 @@ func (a *expr) genValue(vf func(*Thread) Value) { «.repeated section UnaryOps» func (a *expr) genUnaryOp«Name»(v *expr) { - switch _ := a.t.lit().(type) { + switch a.t.lit().(type) { «.repeated section Types» case «Repr»: «.section IsIdeal» @@ -265,7 +265,7 @@ func (a *expr) genUnaryOp«Name»(v *expr) { «.end» «.repeated section BinaryOps» func (a *expr) genBinOp«Name»(l, r *expr) { - switch _ := l.t.lit().(type) { + switch l.t.lit().(type) { «.repeated section Types» case «Repr»: «.section IsIdeal» @@ -290,7 +290,7 @@ func (a *expr) genBinOp«Name»(l, r *expr) { «.end» func genAssign(lt Type, r *expr) (func(lv Value, t *Thread)) { - switch _ := lt.lit().(type) { + switch lt.lit().(type) { «.repeated section Types» «.section IsIdeal» «.or» diff --git a/usr/austin/eval/typec.go b/usr/austin/eval/typec.go index dcff93ccb4..bdbe98c4c4 100644 --- a/usr/austin/eval/typec.go +++ b/usr/austin/eval/typec.go @@ -241,7 +241,7 @@ func (a *typeCompiler) compileMapType(x *ast.MapType) Type { } // XXX(Spec) The Map types section explicitly lists all types // that can be map keys except for function types. - switch _ := key.lit().(type) { + switch key.lit().(type) { case *StructType: a.diagAt(x, "map key cannot be a struct type"); return nil; diff --git a/usr/austin/eval/world.go b/usr/austin/eval/world.go index 4eba216bb9..397da097a8 100644 --- a/usr/austin/eval/world.go +++ b/usr/austin/eval/world.go @@ -129,7 +129,7 @@ func (e *exprCode) Type() Type { func (e *exprCode) Run() (Value, os.Error) { t := new(Thread); t.f = e.w.scope.NewFrame(nil); - switch _ := e.e.t.(type) { + switch e.e.t.(type) { case *idealIntType: return &idealIntV{e.e.asIdealInt()()}, nil; case *idealFloatType: