From 784a77bdffea872f7650b755d2909aeb088aa7d7 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Tue, 6 Aug 2024 07:15:03 -0700 Subject: [PATCH] be a bit more forgiving in eval interpreter, to allow for graceful type (and thus empty bytecode) evaluation --- src/eval2/eval2.c | 7 +------ src/mule/mule_module.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/eval2/eval2.c b/src/eval2/eval2.c index f3c22087..0c320211 100644 --- a/src/eval2/eval2.c +++ b/src/eval2/eval2.c @@ -5349,15 +5349,10 @@ e_interpret(String8 bytecode) } done:; - if(stack_count == 1) + if(stack_count >= 1) { result.value = stack[0]; } - else if(result.code == E_InterpretationCode_Good) - { - result.code = E_InterpretationCode_MalformedBytecode; - } - scratch_end(scratch); return result; } diff --git a/src/mule/mule_module.cpp b/src/mule/mule_module.cpp index fcfa305c..acaad465 100644 --- a/src/mule/mule_module.cpp +++ b/src/mule/mule_module.cpp @@ -13,6 +13,15 @@ # define thread_var __thread #endif +typedef struct OnlyInModule OnlyInModule; +struct OnlyInModule +{ + int x; + int y; + int z; + char *name; +}; + typedef struct Basics Basics; struct Basics { @@ -37,6 +46,7 @@ dll_type_eval_tests(void) { Basics basics1 = {1, 2, 3, 4}; Basics basics2 = {4, 5, 6, 7}; + OnlyInModule only_in_module = {123, 456, 789, "this type is only in the module!"}; int x = 0; (void)x; }