mirror of
https://github.com/janet-lang/janet
synced 2024-12-01 04:19:55 +00:00
Fix some symbol mapping inside nested functions.
This commit is contained in:
parent
4f8f7f66ee
commit
77189b6e66
@ -170,6 +170,7 @@ void janet_bytecode_remove_noops(JanetFuncDef *def) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def->bytecode_length = new_bytecode_length;
|
def->bytecode_length = new_bytecode_length;
|
||||||
|
def->bytecode = janet_realloc(def->bytecode, def->bytecode_length * sizeof(uint32_t));
|
||||||
janet_sfree(pc_map);
|
janet_sfree(pc_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -971,12 +971,13 @@ JanetFuncDef *janetc_pop_funcdef(JanetCompiler *c) {
|
|||||||
for (int32_t i = 0; i < janet_v_count(scope->syms); i++) {
|
for (int32_t i = 0; i < janet_v_count(scope->syms); i++) {
|
||||||
SymPair pair = scope->syms[i];
|
SymPair pair = scope->syms[i];
|
||||||
if (pair.sym2) {
|
if (pair.sym2) {
|
||||||
if (pair.death_pc == UINT32_MAX) {
|
|
||||||
pair.death_pc = def->bytecode_length;
|
|
||||||
}
|
|
||||||
JanetSymbolMap jsm;
|
JanetSymbolMap jsm;
|
||||||
jsm.birth_pc = pair.birth_pc;
|
if (pair.death_pc == UINT32_MAX) {
|
||||||
jsm.death_pc = pair.death_pc;
|
jsm.death_pc = def->bytecode_length;
|
||||||
|
} else {
|
||||||
|
jsm.death_pc = pair.death_pc - scope->bytecode_start;
|
||||||
|
}
|
||||||
|
jsm.birth_pc = pair.birth_pc - scope->bytecode_start;
|
||||||
jsm.slot_index = pair.slot.index;
|
jsm.slot_index = pair.slot.index;
|
||||||
jsm.symbol = pair.sym2;
|
jsm.symbol = pair.sym2;
|
||||||
janet_v_push(locals, jsm);
|
janet_v_push(locals, jsm);
|
||||||
|
Loading…
Reference in New Issue
Block a user