From b471726e0d96e5bd853aff092b5be9128c562c7f Mon Sep 17 00:00:00 2001 From: Andre Wagner Date: Wed, 29 Apr 2026 15:57:39 -0500 Subject: [PATCH] . --- src/vm/stack.cc | 4 ++++ src/vm/value.hh | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/vm/stack.cc b/src/vm/stack.cc index eee209a..1a298f0 100644 --- a/src/vm/stack.cc +++ b/src/vm/stack.cc @@ -51,7 +51,11 @@ void Stack::push_fp() void Stack::pop_fp() { + if (fps_.size() == 1) + throw VMStackUnderflow(); + stack_.resize(fps_.top()); + fps_.pop(); } } // tyche diff --git a/src/vm/value.hh b/src/vm/value.hh index 9009c4d..8039233 100644 --- a/src/vm/value.hh +++ b/src/vm/value.hh @@ -13,6 +13,8 @@ enum class Type : uint8_t class Value { public: + Value() : value_(std::monostate()) {} + static Value CreateNil() { return Value(std::monostate()); } static Value CreateInteger(int32_t v) { return Value(v); } static Value CreateFloat(float f) { return Value(f); }