go/types, types2: factor out endPos call

Preparation for generation of function literal type checking code
from types2 source.

Change-Id: I6b3029c34c2507d356ac8874154537bc6c38a715
Reviewed-on: https://go-review.googlesource.com/c/go/+/610995
Reviewed-by: Tim King <taking@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Robert Griesemer 2024-09-04 17:19:14 -07:00 committed by Gopher Robot
parent e3f3083113
commit 829d1b346f
2 changed files with 2 additions and 2 deletions

View File

@ -1127,7 +1127,7 @@ func (check *Checker) exprInternal(T *target, x *operand, e syntax.Expr, hint Ty
// Set the Scope's extent to the complete "func (...) {...}" // Set the Scope's extent to the complete "func (...) {...}"
// so that Scope.Innermost works correctly. // so that Scope.Innermost works correctly.
sig.scope.pos = e.Pos() sig.scope.pos = e.Pos()
sig.scope.end = syntax.EndPos(e) sig.scope.end = endPos(e)
if !check.conf.IgnoreFuncBodies && e.Body != nil { if !check.conf.IgnoreFuncBodies && e.Body != nil {
// Anonymous functions are considered part of the // Anonymous functions are considered part of the
// init expression/func declaration which contains // init expression/func declaration which contains

View File

@ -1105,7 +1105,7 @@ func (check *Checker) exprInternal(T *target, x *operand, e ast.Expr, hint Type)
// Set the Scope's extent to the complete "func (...) {...}" // Set the Scope's extent to the complete "func (...) {...}"
// so that Scope.Innermost works correctly. // so that Scope.Innermost works correctly.
sig.scope.pos = e.Pos() sig.scope.pos = e.Pos()
sig.scope.end = e.End() sig.scope.end = endPos(e)
if !check.conf.IgnoreFuncBodies && e.Body != nil { if !check.conf.IgnoreFuncBodies && e.Body != nil {
// Anonymous functions are considered part of the // Anonymous functions are considered part of the
// init expression/func declaration which contains // init expression/func declaration which contains