-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/refactor/inline: eliminate unnecessary binding decl
In calls from one method to another with a pointer receiver, the inliner was inserting an unnecessary binding decl for the receiver var, because it relied on Selection.Indirect, but no actual indirection through the pointer is going on, so the receiver is pure. Instead, clear the purity flag only if there's a load through an embedded field. Also, fix a latent bug in the BlockStmt brace eliding logic: we forgot to include function params/results in scope when the block is the body of a function. Plus tests for both. Change-Id: I7e149f55fb344e5f733cdd6811d060ef0dc42883 Reviewed-on: https://go-review.googlesource.com/c/tools/+/532177 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Robert Findley <[email protected]>
- Loading branch information
Showing
2 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters