mirror of
https://github.com/janet-lang/janet
synced 2024-11-18 06:34:48 +00:00
Fix asm roundtrip issue.
This commit is contained in:
parent
6032a6d658
commit
9e6abbf4d4
@ -560,6 +560,9 @@ static JanetAssembleResult janet_asm1(JanetAssembler *parent, Janet source, int
|
||||
x = janet_get1(s, janet_ckeywordv("vararg"));
|
||||
if (janet_truthy(x)) def->flags |= JANET_FUNCDEF_FLAG_VARARG;
|
||||
|
||||
/* Initialize slotcount */
|
||||
def->slotcount = !!(def->flags & JANET_FUNCDEF_FLAG_VARARG) + def->arity;
|
||||
|
||||
/* Check structarg */
|
||||
x = janet_get1(s, janet_ckeywordv("structarg"));
|
||||
if (janet_truthy(x)) def->flags |= JANET_FUNCDEF_FLAG_STRUCTARG;
|
||||
@ -784,8 +787,9 @@ static JanetAssembleResult janet_asm1(JanetAssembler *parent, Janet source, int
|
||||
}
|
||||
|
||||
/* Verify the func def */
|
||||
if (janet_verify(def)) {
|
||||
janet_asm_error(&a, "invalid assembly");
|
||||
int verify_status = janet_verify(def);
|
||||
if (verify_status) {
|
||||
janet_asm_errorv(&a, janet_formatc("invalid assembly (%d)", verify_status));
|
||||
}
|
||||
|
||||
/* Add final flags */
|
||||
|
@ -51,5 +51,13 @@
|
||||
(def f (asm (disasm (fn [x] (fn [y] (+ x y))))))
|
||||
(assert (= ((f 10) 37) 47) "asm environment tables")
|
||||
|
||||
# issue #1424
|
||||
(assert-no-error "arity > used slots (issue #1424)"
|
||||
(asm
|
||||
(disasm
|
||||
(fn []
|
||||
(def foo (fn [one two] one))
|
||||
(foo 100 200)))))
|
||||
|
||||
(end-suite)
|
||||
|
||||
|
@ -955,6 +955,10 @@
|
||||
(defn case-4 [&]
|
||||
(def x (break (break (break)))))
|
||||
(bytecode-roundtrip case-4)
|
||||
(defn case-5 []
|
||||
(def foo (fn [one two] one))
|
||||
(foo 100 200))
|
||||
(bytecode-roundtrip case-5)
|
||||
|
||||
# Debug bytecode of these functions
|
||||
# (pp (disasm case-1))
|
||||
|
Loading…
Reference in New Issue
Block a user