1
0
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:
Calvin Rose
2019-02-09 12:21:11 -05:00
parent 5020a1bae9
commit c6edf03ae8
6 changed files with 46 additions and 29 deletions

View File

@@ -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;