imports: add syscall/js API to zstdlib.go
The syscall/js API is not included in the GOROOT/api/go1.*.txt files at this time, and so it needs to be added to mkstdlib.go explicitly. Run the cmd/api command directly in the generator to determine the syscall/js API. Regenerate zstdlib.go with the updated generator, using Go 1.12.1. Fixes golang/go#27590 Change-Id: I541588986d70f67f4917d9b34bdd57ca44f538f7 Reviewed-on: https://go-review.googlesource.com/c/tools/+/170014 Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
a96101f168
commit
1cd2f21070
|
@ -14,6 +14,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
@ -59,6 +60,10 @@ func main() {
|
||||||
mustOpen(api("go1.10.txt")),
|
mustOpen(api("go1.10.txt")),
|
||||||
mustOpen(api("go1.11.txt")),
|
mustOpen(api("go1.11.txt")),
|
||||||
mustOpen(api("go1.12.txt")),
|
mustOpen(api("go1.12.txt")),
|
||||||
|
|
||||||
|
// The API of the syscall/js package needs to be computed explicitly,
|
||||||
|
// because it's not included in the GOROOT/api/go1.*.txt files at this time.
|
||||||
|
syscallJSAPI(),
|
||||||
)
|
)
|
||||||
sc := bufio.NewScanner(f)
|
sc := bufio.NewScanner(f)
|
||||||
|
|
||||||
|
@ -110,3 +115,18 @@ func main() {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// syscallJSAPI returns the API of the syscall/js package.
|
||||||
|
// It's computed from the contents of $(go env GOROOT)/src/syscall/js.
|
||||||
|
func syscallJSAPI() io.Reader {
|
||||||
|
var exeSuffix string
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
exeSuffix = ".exe"
|
||||||
|
}
|
||||||
|
cmd := exec.Command("go"+exeSuffix, "run", "cmd/api", "-contexts", "js-wasm", "syscall/js")
|
||||||
|
out, err := cmd.Output()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln(err)
|
||||||
|
}
|
||||||
|
return bytes.NewReader(out)
|
||||||
|
}
|
||||||
|
|
|
@ -9783,6 +9783,29 @@ var stdlib = map[string]map[string]bool{
|
||||||
"XP1_UNI_RECV": true,
|
"XP1_UNI_RECV": true,
|
||||||
"XP1_UNI_SEND": true,
|
"XP1_UNI_SEND": true,
|
||||||
},
|
},
|
||||||
|
"syscall/js": map[string]bool{
|
||||||
|
"Error": true,
|
||||||
|
"Func": true,
|
||||||
|
"FuncOf": true,
|
||||||
|
"Global": true,
|
||||||
|
"Null": true,
|
||||||
|
"Type": true,
|
||||||
|
"TypeBoolean": true,
|
||||||
|
"TypeFunction": true,
|
||||||
|
"TypeNull": true,
|
||||||
|
"TypeNumber": true,
|
||||||
|
"TypeObject": true,
|
||||||
|
"TypeString": true,
|
||||||
|
"TypeSymbol": true,
|
||||||
|
"TypeUndefined": true,
|
||||||
|
"TypedArray": true,
|
||||||
|
"TypedArrayOf": true,
|
||||||
|
"Undefined": true,
|
||||||
|
"Value": true,
|
||||||
|
"ValueError": true,
|
||||||
|
"ValueOf": true,
|
||||||
|
"Wrapper": true,
|
||||||
|
},
|
||||||
"testing": map[string]bool{
|
"testing": map[string]bool{
|
||||||
"AllocsPerRun": true,
|
"AllocsPerRun": true,
|
||||||
"B": true,
|
"B": true,
|
||||||
|
|
Loading…
Reference in New Issue