You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// TODO(grootguo): Currently, only references to the symbol within the package are found (i.e., only Idents in this package's Go files are searched).
74
75
// It is still necessary to implement cross-package reference lookup: that is, to find all references to this symbol in other packages that import the current package.
75
76
// Refer to the global search logic in golang.References, and add corresponding test cases for verification.
This test validates the References request functionality in Go assembly files.
2
+
3
+
It ensures that references to both exported (`Add`) and unexported (`sub`) functions are correctly identified across Go and assembly files. The test covers:
4
+
- Locating the definition of functions in both Go and assembly files.
5
+
- Identifying all references to the functions (`Add` and `sub`) within the Go and assembly files.
6
+
7
+
The test includes:
8
+
- `Add`: An exported function with references in both Go and assembly files.
9
+
- `sub`: An unexported function with references in both Go and assembly files, including a usage in Go code (`var _ = sub`).
10
+
11
+
The assembly file demonstrates portable assembly syntax and verifies cross-file reference handling.
12
+
13
+
-- go.mod --
14
+
module example.com
15
+
go 1.24
16
+
17
+
-- foo/foo.go --
18
+
package foo
19
+
20
+
func Add(a, b int) int //@ loc(use, "Add"), refs("Add", use, def)
21
+
func sub(a, b int) int //@ loc(useSub, "sub"), refs("sub", useSub, defSub, refSub)
22
+
var _ = sub //@loc(refSub, "sub"), refs("sub", useSub, defSub, refSub)
23
+
24
+
-- foo/foo.s --
25
+
// portable assembly
26
+
#include "textflag.h"
27
+
28
+
TEXT ·Add(SB), NOSPLIT, $0-24 //@ loc(def, "Add"), refs("Add", def, use)
0 commit comments