remove leftover junk

master
Daniel Kolesa 2021-04-10 03:01:13 +02:00
parent d2b53b174e
commit 6d6a115d0c
3 changed files with 5 additions and 12 deletions

View File

@ -475,7 +475,7 @@ void gen_state::gen_block() {
}
std::pair<std::size_t, std::string_view> gen_state::gen_block(
std::string_view v, std::size_t line, int ret_type, int term
std::string_view v, std::size_t line, int ltype, int term
) {
auto csz = code.size();
code.push_back(BC_INST_BLOCK);
@ -495,13 +495,13 @@ std::pair<std::size_t, std::string_view> gen_state::gen_block(
ret_line = ps.current_line;
}
if (code.size() > (csz + 2)) {
code.push_back(BC_INST_EXIT | ret_type);
code.push_back(BC_INST_EXIT | ret_code(ltype));
/* encode the block size in BC_INST_BLOCK */
code[csz] |= (std::uint32_t(code.size() - csz - 1) << 8);
} else {
/* empty code */
code.resize(csz);
code.push_back(BC_INST_EMPTY | ret_type);
code.push_back(BC_INST_EMPTY | ret_code(ltype));
}
return std::make_pair(ret_line, v);
}

View File

@ -99,7 +99,7 @@ struct gen_state {
void gen_block();
std::pair<std::size_t, std::string_view> gen_block(
std::string_view v, std::size_t line,
int ret_type = BC_RET_NULL, int term = '\0'
int ltype = VAL_NULL, int term = '\0'
);
private:

View File

@ -396,13 +396,6 @@ std::string_view parser_state::get_word() {
return std::string_view{beg, std::size_t(source - beg)};
}
static inline int ret_code(int type, int def = 0) {
if (type >= VAL_ANY) {
return def;
}
return type << BC_INST_RET;
}
static bool compilearg(
parser_state &gs, int wordtype, charbuf *word = nullptr
);
@ -710,7 +703,7 @@ static void compileblockmain(parser_state &gs, int wordtype) {
case VAL_COND: {
auto ret = gs.gs.gen_block(std::string_view{
start, gs.send
}, curline, BC_RET_NULL, ']');
}, curline, VAL_NULL, ']');
gs.source = ret.second.data();
gs.send = ret.second.data() + ret.second.size();
gs.current_line = ret.first;