this repo has no description

internal: remove unnecessary Pos methods

adt.BuiltinValidator had a Pos method which was never used.

pkg.CallCtxt had a Pos method which was used within the same package,
so inline the three uses instead, given its simplicity.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I23d1ed9e4daf2a738ebe31d55e8e87ce52e40aed
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1227395
Reviewed-by: Matthew Sackman <matthew@cue.works>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+3 -12
-4
internal/core/adt/expr.go
··· 1711 1711 return x.Src.Source() 1712 1712 } 1713 1713 1714 - func (x *BuiltinValidator) Pos() token.Pos { 1715 - return Pos(x) 1716 - } 1717 - 1718 1714 func (x *BuiltinValidator) Kind() Kind { 1719 1715 return x.Builtin.Params[0].Kind() 1720 1716 }
+2 -2
internal/pkg/builtin.go
··· 241 241 case string, fmt.Stringer: 242 242 // A string or a stringer likely used as a panic value. 243 243 ret = wrapCallErr(call, &adt.Bottom{ 244 - Err: errors.Newf(call.Pos(), "%s", err), 244 + Err: errors.Newf(call.ctx.Pos(), "%s", err), 245 245 }) 246 246 default: 247 247 // Some other value used when panicking; likely a bug. 248 248 ret = wrapCallErr(call, &adt.Bottom{ 249 - Err: errors.Newf(call.Pos(), "BUG: non-stringifiable %T", err), 249 + Err: errors.Newf(call.ctx.Pos(), "BUG: non-stringifiable %T", err), 250 250 }) 251 251 } 252 252 return ret
-5
internal/pkg/context.go
··· 22 22 "github.com/cockroachdb/apd/v3" 23 23 24 24 "cuelang.org/go/cue" 25 - "cuelang.org/go/cue/token" 26 25 "cuelang.org/go/internal/core/adt" 27 26 "cuelang.org/go/internal/value" 28 27 ) ··· 36 35 Ret any 37 36 38 37 args []adt.Value 39 - } 40 - 41 - func (c *CallCtxt) Pos() token.Pos { 42 - return c.ctx.Pos() 43 38 } 44 39 45 40 func (c *CallCtxt) Name() string {
+1 -1
internal/pkg/errors.go
··· 48 48 case error: 49 49 errs = errors.Promote(x, "") 50 50 } 51 - vErr := c.ctx.NewPosf(c.Pos(), format, args...) 51 + vErr := c.ctx.NewPosf(c.ctx.Pos(), format, args...) 52 52 c.Err = &callError{&adt.Bottom{Code: code, Err: errors.Wrap(vErr, errs)}} 53 53 } 54 54