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:
parent
33001a7ad2
commit
03b2532474
237 changed files with 17550 additions and 13911 deletions
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* @file arr_set.c
|
||||
* @file arr_set.c
|
||||
* @brief Implements the OP_ARR_SET opcode for setting elements in arrays in the VM.
|
||||
*
|
||||
* This file handles the OP_ARR_SET instruction, which sets a value at a specified index in an array.
|
||||
|
|
@ -33,21 +33,21 @@
|
|||
*/
|
||||
|
||||
case OP_SET: {
|
||||
Value v = pop_value(vm);
|
||||
Value idx = pop_value(vm);
|
||||
Value arr = pop_value(vm);
|
||||
if (arr.type != VAL_ARRAY || idx.type != VAL_INT) {
|
||||
fprintf(stderr, "Runtime type error: ARR_SET expects (array, int, value)\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!array_set(&arr, (int)idx.i, v)) {
|
||||
fprintf(stderr, "Runtime error: set index out of range\n");
|
||||
exit(1);
|
||||
}
|
||||
free_value(arr);
|
||||
free_value(idx);
|
||||
/* v already owned by array; push copy for return value */
|
||||
push_value(vm, copy_value(&v));
|
||||
free_value(v);
|
||||
break;
|
||||
Value v = pop_value(vm);
|
||||
Value idx = pop_value(vm);
|
||||
Value arr = pop_value(vm);
|
||||
if (arr.type != VAL_ARRAY || idx.type != VAL_INT) {
|
||||
fprintf(stderr, "Runtime type error: ARR_SET expects (array, int, value)\n");
|
||||
exit(1);
|
||||
}
|
||||
if (!array_set(&arr, (int)idx.i, v)) {
|
||||
fprintf(stderr, "Runtime error: set index out of range\n");
|
||||
exit(1);
|
||||
}
|
||||
free_value(arr);
|
||||
free_value(idx);
|
||||
/* v already owned by array; push copy for return value */
|
||||
push_value(vm, copy_value(&v));
|
||||
free_value(v);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue