-
-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/ir: don't treat _ specially in Prog.{Func,Const,Var}Value
Because of a (long-since fixed) bug in go/types, the Program accessors that accept types.Objects didn't work for blank-named objects. This created an edge case that needed to be skipped in client code: FuncValue("_") would return nil, for example, even thought there's no reason clients shouldn't be able to analyze the bodies of blank functions. This change inserts all objects, regardless of name, into the Package.objects map to eliminate this edge case. (Of course, declarations must still have non-blank names to appear in the Members mapping.) (cherry picked from commit 942d9acc1ecb8b0ec51d6660adb17ee80ec47090 in x/tools) Co-authored-by: Dominik Honnef <dominik@honnef.co>
- Loading branch information
Showing
4 changed files
with
22 additions
and
20 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,7 @@ func (T) fib(x int) int { return Fib(x) } | |
func _() { | ||
print("hi") | ||
} | ||
|
||
func _() { | ||
print("hi") | ||
} |