Documentation
¶
Overview ¶
Package natives holds goesm's target-specific replacements for standard library packages whose Go source depends on the gc runtime's memory layout (runtime, internal/reflectlite, ...). Like GopherJS's natives, but kept as Go source: the replacement is parsed in place of the original package's files, so go/types still type-checks every importer against it, and the rest of the standard library compiles from its ordinary Go source.
The set is fixed and owned by goesm. Nothing outside this directory can add replacements, so importing a dependency never extends the compiler.
Functions declared without a body in a replacement, like the standard library's own assembly and linkname declarations, are implemented by the TypeScript runtime (runtime/src/natives.ts, see runtime.NativeName).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeclNames ¶
DeclNames returns the names a top-level declaration declares: "F" for a function, "T.M" for a method of T or *T, and the names of types, variables and constants. Imports declare none.
func Override ¶
Override reports whether the standard library function with the given types.Func.FullName is implemented natively despite having a Go body.
func Patched ¶
Patched returns the names (as DeclNames reports them) of the declarations that the patches of package importPath replace, or nil.
func PatchedFiles ¶
func PatchedFiles() [][2]string
PatchedFiles lists the standard library files that have patches, each as its package's import path and its base name.
Types ¶
type File ¶
File is the replacement source of one standard library package.
func Patch ¶
Patch returns the patch of the standard library file base (a file name) of package importPath. A patch is Go source: its declarations replace the package's declarations of the same names (see Patched) and are added to that file, together with its imports. Patches change a few functions of a package that is otherwise compiled from its original source.
func Replacement ¶
Replacement returns the replacement of the standard library package importPath, or ok == false if goesm compiles it from its original source. A replacement is one file, so the files of the replaced package can be substituted in any order (go/packages parses them concurrently).