Skip to content

Commit 1f3fd8f

Browse files
committed
compiler: ignore go:wasmexport directives on non-wasm architectures
1 parent 2b59261 commit 1f3fd8f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

compiler/symbol.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,10 @@ func (c *compilerContext) parsePragmas(info *functionInfo, f *ssa.Function) {
350350
info.wasmModule = parts[1]
351351
info.wasmName = parts[2]
352352
case "//go:wasmexport":
353+
if c.archFamily() != "wasm32" {
354+
// go:wasmimport is ignored on non-wasm architectures
355+
continue
356+
}
353357
if f.Blocks == nil {
354358
c.addError(f.Pos(), "can only use //go:wasmexport on definitions")
355359
continue
@@ -367,9 +371,6 @@ func (c *compilerContext) parsePragmas(info *functionInfo, f *ssa.Function) {
367371
c.addError(f.Pos(), fmt.Sprintf("//go:wasmexport does not allow main.main to be exported with -buildmode=%s", c.BuildMode))
368372
continue
369373
}
370-
if c.archFamily() != "wasm32" {
371-
c.addError(f.Pos(), "//go:wasmexport is only supported on wasm")
372-
}
373374
c.checkWasmImportExport(f, comment.Text)
374375
info.wasmExport = name
375376
info.wasmExportPos = comment.Slash

0 commit comments

Comments
 (0)