aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Wang <wangdeyu0907@gmail.com>2021-08-05 23:04:16 +0800
committerRobert Griesemer <gri@golang.org>2021-08-05 18:01:57 +0000
commit6dadee759c812961300c8d1a44959d14299fd9f8 (patch)
treec75fbc3d6aab629f883176bb8f5fa87364330ded
parent5dcb5e2cea883b1bd69b543841b137a287aa7037 (diff)
downloadgo-6dadee759c812961300c8d1a44959d14299fd9f8.tar.gz
go-6dadee759c812961300c8d1a44959d14299fd9f8.zip
[dev.typeparams] cmd/compile: unified importReader receiver name to r
Change-Id: Iaf8ec7665282f4f8c0cb09a652e78aa97959274b Reviewed-on: https://go-review.googlesource.com/c/go/+/340150 Reviewed-by: Robert Griesemer <gri@golang.org> Trust: Robert Griesemer <gri@golang.org> Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org>
-rw-r--r--src/cmd/compile/internal/typecheck/iimport.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/cmd/compile/internal/typecheck/iimport.go b/src/cmd/compile/internal/typecheck/iimport.go
index b389c7fcb0..8d960e5808 100644
--- a/src/cmd/compile/internal/typecheck/iimport.go
+++ b/src/cmd/compile/internal/typecheck/iimport.go
@@ -412,14 +412,14 @@ func (r *importReader) doDecl(sym *types.Sym) *ir.Name {
}
}
-func (p *importReader) value(typ *types.Type) constant.Value {
+func (r *importReader) value(typ *types.Type) constant.Value {
var kind constant.Kind
var valType *types.Type
if typ.IsTypeParam() {
// If a constant had a typeparam type, then we wrote out its
// actual constant kind as well.
- kind = constant.Kind(p.int64())
+ kind = constant.Kind(r.int64())
switch kind {
case constant.Int:
valType = types.Types[types.TINT64]
@@ -435,24 +435,24 @@ func (p *importReader) value(typ *types.Type) constant.Value {
switch kind {
case constant.Bool:
- return constant.MakeBool(p.bool())
+ return constant.MakeBool(r.bool())
case constant.String:
- return constant.MakeString(p.string())
+ return constant.MakeString(r.string())
case constant.Int:
var i big.Int
- p.mpint(&i, valType)
+ r.mpint(&i, valType)
return constant.Make(&i)
case constant.Float:
- return p.float(valType)
+ return r.float(valType)
case constant.Complex:
- return makeComplex(p.float(valType), p.float(valType))
+ return makeComplex(r.float(valType), r.float(valType))
}
base.Fatalf("unexpected value type: %v", typ)
panic("unreachable")
}
-func (p *importReader) mpint(x *big.Int, typ *types.Type) {
+func (r *importReader) mpint(x *big.Int, typ *types.Type) {
signed, maxBytes := intSize(typ)
maxSmall := 256 - maxBytes
@@ -463,7 +463,7 @@ func (p *importReader) mpint(x *big.Int, typ *types.Type) {
maxSmall = 256
}
- n, _ := p.ReadByte()
+ n, _ := r.ReadByte()
if uint(n) < maxSmall {
v := int64(n)
if signed {
@@ -484,30 +484,30 @@ func (p *importReader) mpint(x *big.Int, typ *types.Type) {
base.Fatalf("weird decoding: %v, %v => %v", n, signed, v)
}
b := make([]byte, v)
- p.Read(b)
+ r.Read(b)
x.SetBytes(b)
if signed && n&1 != 0 {
x.Neg(x)
}
}
-func (p *importReader) float(typ *types.Type) constant.Value {
+func (r *importReader) float(typ *types.Type) constant.Value {
var mant big.Int
- p.mpint(&mant, typ)
+ r.mpint(&mant, typ)
var f big.Float
f.SetInt(&mant)
if f.Sign() != 0 {
- f.SetMantExp(&f, int(p.int64()))
+ f.SetMantExp(&f, int(r.int64()))
}
return constant.Make(&f)
}
-func (p *importReader) mprat(orig constant.Value) constant.Value {
- if !p.bool() {
+func (r *importReader) mprat(orig constant.Value) constant.Value {
+ if !r.bool() {
return orig
}
var rat big.Rat
- rat.SetString(p.string())
+ rat.SetString(r.string())
return constant.Make(&rat)
}