From 7162ceba41a27e9ee7ccce5ba3a58f3ac66b7087 Mon Sep 17 00:00:00 2001 From: Randy Reddig Date: Fri, 27 Dec 2024 10:56:35 +1300 Subject: [PATCH] cm: follow pattern of generated wasmimport calls --- cm/error.go | 12 ++---------- cm/error.wasm.go | 13 +++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 cm/error.wasm.go diff --git a/cm/error.go b/cm/error.go index 77b5bfd6..857d5ce7 100644 --- a/cm/error.go +++ b/cm/error.go @@ -28,21 +28,13 @@ func (err errorContext) String() string { // [error-context.debug-message]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#error-contextdebug-message func (err errorContext) DebugMessage() string { var s string - errorContextDebugMessage(err, unsafe.Pointer(&s)) + wasmimport_errorContextDebugMessage(err, unsafe.Pointer(&s)) return s } -//go:wasmimport canon error-context.debug-message -//go:noescape -func errorContextDebugMessage(err errorContext, msg unsafe.Pointer) - // Drop represents the Canonical ABI [error-context.drop] function. // // [error-context.drop]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/Explainer.md#error-contextdrop func (err errorContext) Drop() { - errorContextDrop(err) + wasmimport_errorContextDrop(err) } - -//go:wasmimport canon error-context.drop -//go:noescape -func errorContextDrop(err errorContext) diff --git a/cm/error.wasm.go b/cm/error.wasm.go new file mode 100644 index 00000000..112eb6d8 --- /dev/null +++ b/cm/error.wasm.go @@ -0,0 +1,13 @@ +package cm + +import "unsafe" + +// msg uses unsafe.Pointer for compatibility with go1.23 and lower. +// +//go:wasmimport canon error-context.debug-message +//go:noescape +func wasmimport_errorContextDebugMessage(err errorContext, msg unsafe.Pointer) + +//go:wasmimport canon error-context.drop +//go:noescape +func wasmimport_errorContextDrop(err errorContext)