aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/noder/reader.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/noder/reader.go')
-rw-r--r--src/cmd/compile/internal/noder/reader.go17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/noder/reader.go b/src/cmd/compile/internal/noder/reader.go
index ff44adedb4..1dd2e09b0d 100644
--- a/src/cmd/compile/internal/noder/reader.go
+++ b/src/cmd/compile/internal/noder/reader.go
@@ -1132,15 +1132,22 @@ func (r *reader) funcExt(name *ir.Name, method *types.Sym) {
r.linkname(name)
if buildcfg.GOARCH == "wasm" {
- xmod := r.String()
- xname := r.String()
+ importmod := r.String()
+ importname := r.String()
+ exportname := r.String()
- if xmod != "" && xname != "" {
+ if importmod != "" && importname != "" {
fn.WasmImport = &ir.WasmImport{
- Module: xmod,
- Name: xname,
+ Module: importmod,
+ Name: importname,
}
}
+ if exportname != "" {
+ if method != nil {
+ base.ErrorfAt(fn.Pos(), 0, "cannot use //go:wasmexport on a method")
+ }
+ fn.WasmExport = &ir.WasmExport{Name: exportname}
+ }
}
if r.Bool() {