From: Robert Griesemer Date: Thu, 5 Sep 2024 00:19:14 +0000 (-0700) Subject: go/types, types2: factor out endPos call X-Git-Tag: go1.24rc1~983 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=829d1b346f768f0e87a3c93e571be3de5bc7ab83;p=gostls13.git 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 Auto-Submit: Robert Griesemer Reviewed-by: Robert Griesemer LUCI-TryBot-Result: Go LUCI --- diff --git a/src/cmd/compile/internal/types2/expr.go b/src/cmd/compile/internal/types2/expr.go index 1afdee2d4d..30fa05673c 100644 --- a/src/cmd/compile/internal/types2/expr.go +++ b/src/cmd/compile/internal/types2/expr.go @@ -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 (...) {...}" // so that Scope.Innermost works correctly. sig.scope.pos = e.Pos() - sig.scope.end = syntax.EndPos(e) + sig.scope.end = endPos(e) if !check.conf.IgnoreFuncBodies && e.Body != nil { // Anonymous functions are considered part of the // init expression/func declaration which contains diff --git a/src/go/types/expr.go b/src/go/types/expr.go index 55d3860996..ebc662e966 100644 --- a/src/go/types/expr.go +++ b/src/go/types/expr.go @@ -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 (...) {...}" // so that Scope.Innermost works correctly. sig.scope.pos = e.Pos() - sig.scope.end = e.End() + sig.scope.end = endPos(e) if !check.conf.IgnoreFuncBodies && e.Body != nil { // Anonymous functions are considered part of the // init expression/func declaration which contains