mirror of
https://github.com/janet-lang/janet
synced 2025-02-02 10:19:10 +00:00
Address #24
This commit is contained in:
parent
38a7e4faf1
commit
f284776490
@ -101,8 +101,15 @@ static JanetSlot do_get(JanetFopts opts, JanetSlot *args) {
|
|||||||
return opreduce(opts, args, JOP_GET, janet_wrap_nil());
|
return opreduce(opts, args, JOP_GET, janet_wrap_nil());
|
||||||
}
|
}
|
||||||
static JanetSlot do_put(JanetFopts opts, JanetSlot *args) {
|
static JanetSlot do_put(JanetFopts opts, JanetSlot *args) {
|
||||||
|
if (opts.flags & JANET_FOPTS_DROP) {
|
||||||
janetc_emit_sss(opts.compiler, JOP_PUT, args[0], args[1], args[2], 0);
|
janetc_emit_sss(opts.compiler, JOP_PUT, args[0], args[1], args[2], 0);
|
||||||
return args[0];
|
return janetc_cslot(janet_wrap_nil());
|
||||||
|
} else {
|
||||||
|
JanetSlot t = janetc_gettarget(opts);
|
||||||
|
janetc_copy(opts.compiler, t, args[0]);
|
||||||
|
janetc_emit_sss(opts.compiler, JOP_PUT, t, args[1], args[2], 0);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
static JanetSlot do_length(JanetFopts opts, JanetSlot *args) {
|
static JanetSlot do_length(JanetFopts opts, JanetSlot *args) {
|
||||||
return genericSS(opts, JOP_LENGTH, args[0]);
|
return genericSS(opts, JOP_LENGTH, args[0]);
|
||||||
|
@ -346,4 +346,9 @@
|
|||||||
(check-deep '(drop '"hello") "hello" @[])
|
(check-deep '(drop '"hello") "hello" @[])
|
||||||
(check-deep '(drop "hello") "hello" @[])
|
(check-deep '(drop "hello") "hello" @[])
|
||||||
|
|
||||||
|
# Regression #24
|
||||||
|
|
||||||
|
(def t (put @{} :hi 1))
|
||||||
|
(assert (deep= t @{:hi 1}) "regression #24")
|
||||||
|
|
||||||
(end-suite)
|
(end-suite)
|
||||||
|
Loading…
Reference in New Issue
Block a user