diff --git a/lib/mod.c b/lib/mod.c index e361e22..f1132aa 100644 --- a/lib/mod.c +++ b/lib/mod.c @@ -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; ivalues.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; diff --git a/lib/vm.c b/lib/vm.c index 56b991b..39d1583 100644 --- a/lib/vm.c +++ b/lib/vm.c @@ -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