mirror of
https://github.com/janet-lang/janet
synced 2025-11-23 18:54:50 +00:00
Fix some code style, add tuple/type function.
We need to be able to detect tuple type from janet code, otherwise tuples will contain hidden state. The tuple/type function is able to detect the flags in the tuple so the programmer can access them if needed.
This commit is contained in:
@@ -446,7 +446,6 @@ static JanetSlot janetc_tuple(JanetFopts opts, Janet x) {
|
||||
JOP_MAKE_TUPLE);
|
||||
}
|
||||
|
||||
|
||||
static JanetSlot janetc_tablector(JanetFopts opts, Janet x, int op) {
|
||||
JanetCompiler *c = opts.compiler;
|
||||
return janetc_maker(opts,
|
||||
@@ -556,8 +555,8 @@ JanetSlot janetc_value(JanetFopts opts, Janet x) {
|
||||
/* Empty tuple is tuple literal */
|
||||
if (janet_tuple_length(tup) == 0) {
|
||||
ret = janetc_cslot(x);
|
||||
} else if (janet_tuple_flag(tup) & JANET_TUPLE_FLAG_BRACKETCTOR) { // [] tuples are not function call
|
||||
ret = janetc_tuple(opts, x);
|
||||
} else if (janet_tuple_flag(tup) & JANET_TUPLE_FLAG_BRACKETCTOR) { /* [] tuples are not function call */
|
||||
ret = janetc_tuple(opts, x);
|
||||
} else {
|
||||
JanetSlot head = janetc_value(subopts, tup[0]);
|
||||
subopts.flags = JANET_FUNCTION | JANET_CFUNCTION;
|
||||
|
||||
Reference in New Issue
Block a user