From 8498027da4e078e6babe72f66829b479dd163510 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 8 Apr 2021 18:06:15 -0700 Subject: RefFunc: Validate that the type is non-nullable, and avoid possible bugs in the builder (#3790) The builder can receive a HeapType so that callers don't need to set non-nullability themselves. Not NFC as some of the callers were in fact still making it nullable. --- test/binaryen.js/expressions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/binaryen.js/expressions.js') diff --git a/test/binaryen.js/expressions.js b/test/binaryen.js/expressions.js index 68f5c8cee..b458355cd 100644 --- a/test/binaryen.js/expressions.js +++ b/test/binaryen.js/expressions.js @@ -1448,7 +1448,9 @@ console.log("# RefFunc"); assert(theRefFunc instanceof binaryen.RefFunc); assert(theRefFunc instanceof binaryen.Expression); assert(theRefFunc.func === func); - assert(theRefFunc.type === binaryen.funcref); + // TODO: check the type. the type is (ref func), that is, a non-nullable func, + // which differs from funcref. we don't have the ability to create such + // a type in the C/JS APIs yet. theRefFunc.func = func = "b"; assert(theRefFunc.func === func); -- cgit v1.2.3