Skip to content

Commit

Permalink
cmd/compile: remove go:wasmimport restriction
Browse files Browse the repository at this point in the history
Removes the package restriction on go:wasmimport, allowing the
use of it globally and in user code.

Fixes #59149

Change-Id: Ib26f628dc8dafb31388005b50449e91b47dab447
Reviewed-on: https://go-review.googlesource.com/c/go/+/489255
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Eli Bendersky <eliben@google.com>
Auto-Submit: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
  • Loading branch information
johanbrandhorst committed May 11, 2023
1 parent bc9e213 commit aff2f4a
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/cmd/compile/internal/noder/noder.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,6 @@ func (p *noder) pragma(pos syntax.Pos, blankLine bool, text string, old syntax.P
p.error(syntax.Error{Pos: pos, Msg: "usage: //go:wasmimport importmodule importname"})
break
}
if !base.Flag.CompilingRuntime && base.Ctxt.Pkgpath != "syscall/js" && base.Ctxt.Pkgpath != "syscall/js_test" && base.Ctxt.Pkgpath != "syscall" {
p.error(syntax.Error{Pos: pos, Msg: "//go:wasmimport directive cannot be used outside of runtime or syscall/js"})
break
}

if buildcfg.GOARCH == "wasm" {
// Only actually use them if we're compiling to WASM though.
Expand Down

0 comments on commit aff2f4a

Please sign in to comment.