Update asm.c

This commit is contained in:
Calvin Rose 2023-02-05 23:49:18 -06:00
parent 7a1c9c7798
commit 9476016741
1 changed files with 5 additions and 2 deletions

View File

@ -739,8 +739,12 @@ static JanetAssembleResult janet_asm1(JanetAssembler *parent, Janet source, int
janet_asm_error(&a, "expected tuple"); janet_asm_error(&a, "expected tuple");
} }
tup = janet_unwrap_tuple(entry); tup = janet_unwrap_tuple(entry);
if (!janet_checkint(tup[0])) { if (janet_keyeq(tup[0], "upvalue")) {
ss.birth_pc = UINT32_MAX;
} else if (!janet_checkint(tup[0])) {
janet_asm_error(&a, "expected integer"); janet_asm_error(&a, "expected integer");
} else {
ss.birth_pc = janet_unwrap_integer(tup[0]);
} }
if (!janet_checkint(tup[1])) { if (!janet_checkint(tup[1])) {
janet_asm_error(&a, "expected integer"); janet_asm_error(&a, "expected integer");
@ -751,7 +755,6 @@ static JanetAssembleResult janet_asm1(JanetAssembler *parent, Janet source, int
if (!janet_checktype(tup[3], JANET_SYMBOL)) { if (!janet_checktype(tup[3], JANET_SYMBOL)) {
janet_asm_error(&a, "expected symbol"); janet_asm_error(&a, "expected symbol");
} }
ss.birth_pc = janet_unwrap_integer(tup[0]);
ss.death_pc = janet_unwrap_integer(tup[1]); ss.death_pc = janet_unwrap_integer(tup[1]);
ss.slot_index = janet_unwrap_integer(tup[2]); ss.slot_index = janet_unwrap_integer(tup[2]);
ss.symbol = janet_unwrap_symbol(tup[3]); ss.symbol = janet_unwrap_symbol(tup[3]);