Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoLinkname ¶
GoLinkname describes a go:linkname compiler directive found in the source code.
GopherJS treats these directives in a way that resembles a symbolic link, where for a single given symbol implementation there may be zero or more symbols referencing it. This is subtly different from the upstream Go implementation, which simply overrides symbol name the linker will use.
func ParseGoLinknames ¶
ParseGoLinknames processed comments in a source file and extracts //go:linkname compiler directive from the comments.
The following directive format is supported: //go:linkname <localname> <importpath>.<name> //go:linkname <localname> <importpath>.<type>.<name> //go:linkname <localname> <importpath>.<(*type)>.<name>
GopherJS directive support has the following limitations:
- External linkname must be specified.
- The directive must be applied to a package-level function or method (variables are not supported).
- The local function referenced by the directive must have no body (in other words, it can only "import" an external function implementation into the local scope).
type GoLinknameSet ¶
type GoLinknameSet struct {
// contains filtered or unexported fields
}
GoLinknameSet is a utility that enables quick lookup of whether a decl is affected by any go:linkname directive in the program.
func (*GoLinknameSet) Add ¶
func (gls *GoLinknameSet) Add(entries []GoLinkname) error
Add more GoLinkname directives into the set.
func (*GoLinknameSet) FindImplementation ¶
FindImplementation returns a symbol name, which provides the implementation for the given symbol. The second value indicates whether the implementation was found.
func (*GoLinknameSet) IsImplementation ¶
func (gls *GoLinknameSet) IsImplementation(sym symbol.Name) bool
IsImplementation returns true if there is a directive referencing this symbol as an implementation.