mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 19:19:53 +00:00
Add -env- to repl.
This commit is contained in:
parent
53cead0bab
commit
6a8ec0c895
@ -171,6 +171,7 @@ static int debug_repl(Gst *vm, uint64_t flags) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
gst_env_putc(vm, vm->env, "_", vm->ret);
|
gst_env_putc(vm, vm->env, "_", vm->ret);
|
||||||
|
gst_env_putc(vm, vm->env, "-env-", gst_wrap_table(vm->env));
|
||||||
if (!debug_compile_and_run(vm, gst_parse_consume(&p), flags)) {
|
if (!debug_compile_and_run(vm, gst_parse_consume(&p), flags)) {
|
||||||
printf_flags(flags, "36", "%s\n", (const char *) gst_description(vm, vm->ret));
|
printf_flags(flags, "36", "%s\n", (const char *) gst_description(vm, vm->ret));
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ static int symbol_resolve(GstCompiler *c, GstValue x, uint16_t *level, uint16_t
|
|||||||
GstTable *metas = gst_env_meta(c->vm, c->env);
|
GstTable *metas = gst_env_meta(c->vm, c->env);
|
||||||
GstValue maybeMeta = gst_table_get(metas, x);
|
GstValue maybeMeta = gst_table_get(metas, x);
|
||||||
if (maybeMeta.type == GST_TABLE) {
|
if (maybeMeta.type == GST_TABLE) {
|
||||||
GstValue isMutable = gst_table_get(maybeMeta.data.table, gst_string_cvs(c->vm, "mutable"));
|
GstValue isMutable = gst_table_get(maybeMeta.data.table, gst_string_cv(c->vm, "mutable"));
|
||||||
if (gst_truthy(isMutable)) {
|
if (gst_truthy(isMutable)) {
|
||||||
if (flags) *flags = GST_LOCAL_FLAG_MUTABLE;
|
if (flags) *flags = GST_LOCAL_FLAG_MUTABLE;
|
||||||
*out = check;
|
*out = check;
|
||||||
|
@ -296,4 +296,3 @@ GstValue gst_table_next(GstTable *t, GstValue key) {
|
|||||||
}
|
}
|
||||||
return gst_wrap_nil();
|
return gst_wrap_nil();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@ void gst_env_putvar(Gst *vm, GstTable *env, GstValue key, GstValue value) {
|
|||||||
ref->count = 1;
|
ref->count = 1;
|
||||||
ref->data[0] = value;
|
ref->data[0] = value;
|
||||||
gst_table_put(vm, env, key, gst_wrap_array(ref));
|
gst_table_put(vm, env, key, gst_wrap_array(ref));
|
||||||
gst_table_put(vm, newmeta, gst_string_cvs(vm, "mutable"), gst_wrap_boolean(1));
|
gst_table_put(vm, newmeta, gst_string_cv(vm, "mutable"), gst_wrap_boolean(1));
|
||||||
gst_table_put(vm, meta, key, gst_wrap_table(newmeta));
|
gst_table_put(vm, meta, key, gst_wrap_table(newmeta));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user