Skip to content

Commit 0d1476f

Browse files
committed
compiler/natives/src/reflect: Implement throw.
It's being used in a few places, and previously had no implementation in GopherJS. (In upstream Go, it's being provided by runtime via go:linkname directive.) This restores more helpful error messages as in GopherJS 1.9. Before: runtime error: native function not implemented: sync.throw After: runtime error: sync: inconsistent mutex state
1 parent d05d986 commit 0d1476f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/natives/src/sync/sync.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ func runtime_nanotime() int64 {
5353
const millisecond = 1000000
5454
return js.Global.Get("Date").New().Call("getTime").Int64() * millisecond
5555
}
56+
57+
// Implemented in runtime.
58+
func throw(s string) {
59+
js.Global.Call("$throwRuntimeError", s)
60+
}

0 commit comments

Comments
 (0)