mirror of
https://github.com/janet-lang/janet
synced 2024-11-29 03:19:54 +00:00
Update pretty printer to remove values
from seen table.
This commit is contained in:
parent
8520d3f6cb
commit
a7860f1dd1
@ -541,6 +541,10 @@ static JanetAssembleResult janet_asm1(JanetAssembler *parent, Janet source, int
|
|||||||
x = janet_get(s, janet_csymbolv("vararg"));
|
x = janet_get(s, janet_csymbolv("vararg"));
|
||||||
if (janet_truthy(x)) def->flags |= JANET_FUNCDEF_FLAG_VARARG;
|
if (janet_truthy(x)) def->flags |= JANET_FUNCDEF_FLAG_VARARG;
|
||||||
|
|
||||||
|
/* Check strict arity */
|
||||||
|
x = janet_get(s, janet_csymbolv("fix-arity"));
|
||||||
|
if (janet_truthy(x)) def->flags |= JANET_FUNCDEF_FLAG_FIXARITY;
|
||||||
|
|
||||||
/* Check source */
|
/* Check source */
|
||||||
x = janet_get(s, janet_csymbolv("source"));
|
x = janet_get(s, janet_csymbolv("source"));
|
||||||
if (janet_checktype(x, JANET_STRING)) def->source = janet_unwrap_string(x);
|
if (janet_checktype(x, JANET_STRING)) def->source = janet_unwrap_string(x);
|
||||||
@ -836,6 +840,9 @@ Janet janet_disasm(JanetFuncDef *def) {
|
|||||||
if (def->flags & JANET_FUNCDEF_FLAG_VARARG) {
|
if (def->flags & JANET_FUNCDEF_FLAG_VARARG) {
|
||||||
janet_table_put(ret, janet_csymbolv("vararg"), janet_wrap_true());
|
janet_table_put(ret, janet_csymbolv("vararg"), janet_wrap_true());
|
||||||
}
|
}
|
||||||
|
if (def->flags & JANET_FUNCDEF_FLAG_FIXARITY) {
|
||||||
|
janet_table_put(ret, janet_csymbolv("fix-arity"), janet_wrap_true());
|
||||||
|
}
|
||||||
if (NULL != def->name) {
|
if (NULL != def->name) {
|
||||||
janet_table_put(ret, janet_csymbolv("name"), janet_wrap_string(def->name));
|
janet_table_put(ret, janet_csymbolv("name"), janet_wrap_string(def->name));
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,7 @@ static void janet_pretty_one(struct pretty *S, Janet x) {
|
|||||||
switch (janet_type(x)) {
|
switch (janet_type(x)) {
|
||||||
default:
|
default:
|
||||||
janet_description_b(S->buffer, x);
|
janet_description_b(S->buffer, x);
|
||||||
return;
|
break;
|
||||||
case JANET_ARRAY:
|
case JANET_ARRAY:
|
||||||
case JANET_TUPLE:
|
case JANET_TUPLE:
|
||||||
{
|
{
|
||||||
@ -579,6 +579,8 @@ static void janet_pretty_one(struct pretty *S, Janet x) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Remove from seen */
|
||||||
|
janet_table_remove(&S->seen, x);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1094,6 +1094,7 @@ JANET_API int janet_equals(Janet x, Janet y);
|
|||||||
JANET_API int32_t janet_hash(Janet x);
|
JANET_API int32_t janet_hash(Janet x);
|
||||||
JANET_API int janet_compare(Janet x, Janet y);
|
JANET_API int janet_compare(Janet x, Janet y);
|
||||||
JANET_API int janet_cstrcmp(const uint8_t *str, const char *other);
|
JANET_API int janet_cstrcmp(const uint8_t *str, const char *other);
|
||||||
|
JANET_API JanetBuffer *janet_pretty(JanetBuffer *buffer, int depth, Janet x);
|
||||||
|
|
||||||
/* VM functions */
|
/* VM functions */
|
||||||
JANET_API int janet_init(void);
|
JANET_API int janet_init(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user