Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7470df5

Browse files
Fixing a merge conflict
1 parent c1962ab commit 7470df5

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

compiler/linkname/linkname.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,20 +139,14 @@ func ParseGoLinknames(fset *token.FileSet, pkgPath string, file *ast.File) ([]Go
139139

140140
decl, isFunc := node.(*ast.FuncDecl)
141141
if !isFunc {
142-
if pkgPath == "math/bits" || pkgPath == "reflect" {
143-
// These standard library packages are known to use go:linkname with
144-
// variables, which GopherJS doesn't support. We silently ignore such
145-
// directives, since it doesn't seem to cause any problems.
142+
if isMitigatedVarLinkname(link.Reference) {
146143
return nil
147144
}
148145
return fmt.Errorf("gopherjs: //go:linkname is only supported for functions, got %T", node)
149146
}
150147

151148
if decl.Body != nil {
152-
if pkgPath == "runtime" || pkgPath == "internal/bytealg" || pkgPath == "internal/fuzz" {
153-
// These standard library packages are known to use unsupported
154-
// "insert"-style go:linkname directives, which we ignore here and handle
155-
// case-by-case in native overrides.
149+
if isMitigatedInsertLinkname(link.Reference) {
156150
return nil
157151
}
158152
return fmt.Errorf("gopherjs: //go:linkname can not insert local implementation into an external package %q", link.Implementation.PkgPath)

0 commit comments

Comments
 (0)