1
0
Fork 0
forked from fun/fun

Fixed the code style in *.c files to two spaces indentation and add a linter named funstx to Fun. (0.39.0)

This commit is contained in:
Johannes Findeisen 2026-03-18 20:52:00 +01:00
commit 03b2532474
237 changed files with 17550 additions and 13911 deletions

View file

@ -1,5 +1,5 @@
/**
* This file is part of the Fun programming language.
* This file is part of the Fun programming language.
* https://fun-lang.xyz/
*
* Copyright 2025 Johannes Findeisen <you@hanez.org>
@ -8,21 +8,39 @@
*/
case OP_TYPEOF: {
Value v = pop_value(vm);
const char *tname = "Unknown";
switch (v.type) {
case VAL_INT: tname = "Number"; break;
case VAL_FLOAT: tname = "Float"; break;
case VAL_BOOL: tname = "Boolean"; break;
case VAL_STRING: tname = "String"; break;
case VAL_FUNCTION: tname = "Function"; break;
case VAL_ARRAY: tname = "Array"; break;
case VAL_MAP: tname = "Map"; break;
case VAL_NIL: tname = "Nil"; break;
default: tname = "Unknown"; break;
}
/* push a new string value; make_string duplicates the C string */
push_value(vm, make_string(tname));
free_value(v);
Value v = pop_value(vm);
const char *tname = "Unknown";
switch (v.type) {
case VAL_INT:
tname = "Number";
break;
case VAL_FLOAT:
tname = "Float";
break;
case VAL_BOOL:
tname = "Boolean";
break;
case VAL_STRING:
tname = "String";
break;
case VAL_FUNCTION:
tname = "Function";
break;
case VAL_ARRAY:
tname = "Array";
break;
case VAL_MAP:
tname = "Map";
break;
case VAL_NIL:
tname = "Nil";
break;
default:
tname = "Unknown";
break;
}
/* push a new string value; make_string duplicates the C string */
push_value(vm, make_string(tname));
free_value(v);
break;
}