🐛 fix line numbers.

main
bog 2023-12-15 19:45:47 +01:00
parent 076fd79ff1
commit bd84f3bb3d
2 changed files with 1 additions and 35 deletions

View File

@ -98,16 +98,6 @@ size_t mod_push_new_value(mod_t* mod, value_t* value)
assert(mod);
assert(value);
for (size_t i=0; i<mod->values.size; i++)
{
if (value_eq(value, mod->values.data[i]))
{
value_free(value);
free(value);
return i;
}
}
if (mod->values.size == 0)
{
mod->values.cap = 2;

View File

@ -142,31 +142,7 @@ int vm_exec_instr(vm_t* vm, mod_t* mod, Opcode op, param_t param)
value_t* lhs = mod->values.data[r];
int same_type = lhs->type->kind == rhs->type->kind;
int type = lhs->type->kind;
int eq = 0;
if (same_type)
{
if (type == TYPE_NUM)
{
eq = lhs->value.num == rhs->value.num;
}
else if (type == TYPE_BOOL)
{
eq = lhs->value.bool == rhs->value.bool;
}
else if (type == TYPE_STR)
{
eq = strcmp(lhs->value.str, rhs->value.str) == 0;
}
else
{
fprintf(stderr, "Cannot test equality on unknown type '%s'.\n",
TypeKindStr[type]);
abort();
}
}
int eq = value_eq(lhs, rhs);
value_t* res = tysy_new_bool(vm->tysy,
(op == OP_EQ