Skip to content

Commit 9d5176b

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 8b2ca4b commit 9d5176b

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
@@ -73,3 +73,8 @@ func runtime_nanotime() int64 {
7373
const millisecond = 1000000
7474
return js.Global.Get("Date").New().Call("getTime").Int64() * millisecond
7575
}
76+
77+
// Implemented in runtime.
78+
func throw(s string) {
79+
js.Global.Call("$throwRuntimeError", s)
80+
}

0 commit comments

Comments
 (0)