Browse files

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.


	runtime error: native function not implemented: sync.throw


	runtime error: sync: inconsistent mutex state
  • Loading branch information...
dmitshur committed Jan 9, 2018
1 parent d05d986 commit 0d1476f7bf4c5be46a3068206254ca93bb0f4b1b
Showing with 5 additions and 0 deletions.
  1. +5 −0 compiler/natives/src/sync/sync.go
@@ -53,3 +53,8 @@ func runtime_nanotime() int64 {
const millisecond = 1000000
return js.Global.Get("Date").New().Call("getTime").Int64() * millisecond
// Implemented in runtime.
func throw(s string) {
js.Global.Call("$throwRuntimeError", s)

0 comments on commit 0d1476f

Please sign in to comment.