Restores ability to define host functions w/o context via reflection (#832)
This restores the ability to leave out the initial context parameter
when defining functions with reflection. This is important because some
projects are porting from a different library to wazero, and all the
alternatives are not contextualized.
For example, this project is porting envoy host functions, and the
original definitions (in mosn) don't have a context parameter. By being
lenient, they can migrate easier.
See 6b813482b6/pkg/proxywasm/wazero/imports_v1.go
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package wasm
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/tetratelabs/wazero/api"
|
||||
@@ -10,7 +9,7 @@ import (
|
||||
|
||||
func TestModule_BuildFunctionDefinitions(t *testing.T) {
|
||||
nopCode := &Code{Body: []byte{OpcodeEnd}}
|
||||
fn := func(context.Context) {}
|
||||
fn := func() {}
|
||||
tests := []struct {
|
||||
name string
|
||||
m *Module
|
||||
|
||||
Reference in New Issue
Block a user