.
This commit is contained in:
@@ -31,6 +31,8 @@ ByteArray Assembler::assemble()
|
||||
} else if (std::get<std::string>(t.token) == ".func") {
|
||||
section = Section::Function;
|
||||
function_id = std::get<int>(expect_token(TokenType::Integer));
|
||||
if (function_id >= bp.functions.size())
|
||||
bp.functions.resize(function_id + 1, { 0, 0 });
|
||||
expect_token(TokenType::Enter);
|
||||
} else {
|
||||
throw AssemblyError("Invalid directive " + std::get<std::string>(t.token), t.line, t.column);
|
||||
|
||||
@@ -14,7 +14,7 @@ struct BytecodePrototype {
|
||||
struct Function {
|
||||
uint16_t n_pars;
|
||||
uint16_t n_locals;
|
||||
ByteArray code;
|
||||
ByteArray code {};
|
||||
|
||||
Function(uint16_t n_pars_, uint16_t n_locals_) : n_pars(n_pars_), n_locals(n_locals_), code(ByteArray {}) {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user