This commit is contained in:
2026-04-28 08:04:04 -05:00
parent 960cc76005
commit 8ff66ac1e2
3 changed files with 8 additions and 6 deletions

View File

@@ -39,7 +39,7 @@ public:
[[nodiscard]] size_t size() const { return data_.size(); }
private:
std::vector<uint8_t> data_;
std::vector<uint8_t> data_ {};
};
class BytecodeParsingError : public std::runtime_error {

View File

@@ -13,9 +13,11 @@ struct BytecodePrototype {
using Value = std::variant<int32_t, float>;
struct Function {
uint16_t n_pars = 0;
uint16_t n_locals = 0;
ByteArray code {};
uint16_t n_pars;
uint16_t n_locals;
ByteArray code;
Function(uint16_t n_pars_, uint16_t n_locals_) : n_pars(n_pars_), n_locals(n_locals_), code(ByteArray {}) {}
};
std::vector<ConstantValue> constants {};

View File

@@ -83,8 +83,8 @@ TEST(Bytecode, Code)
f.code.append_byte(0x68);
f.code.append_int(42);
f = bp.functions.emplace_back(2, 1);
f.code.append_byte(0x42);
auto& f2 = bp.functions.emplace_back(2, 1);
f2.code.append_byte(0x42);
std::vector<uint8_t> expected = {
// header