1
0
forked from aniani/vim

patch 9.0.1134: comparing objects uses identity instead of equality

Problem:    Comparing objects uses identity instead of equality.
Solution:   Compare the object values.
This commit is contained in:
Bram Moolenaar
2023-01-02 20:32:24 +00:00
parent a9fa8c58fb
commit bcf31ec36b
8 changed files with 178 additions and 10 deletions

View File

@@ -4697,6 +4697,8 @@ exec_instructions(ectx_T *ectx)
case ISN_COMPAREFUNC:
case ISN_COMPARESTRING:
case ISN_COMPAREBLOB:
case ISN_COMPARECLASS:
case ISN_COMPAREOBJECT:
{
typval_T *tv1 = STACK_TV_BOT(-2);
typval_T *tv2 = STACK_TV_BOT(-1);
@@ -4726,10 +4728,19 @@ exec_instructions(ectx_T *ectx)
status = typval_compare_string(tv1, tv2,
exprtype, ic, &res);
}
else
else if (iptr->isn_type == ISN_COMPAREBLOB)
{
status = typval_compare_blob(tv1, tv2, exprtype, &res);
}
else if (iptr->isn_type == ISN_COMPARECLASS)
{
status = typval_compare_class(tv1, tv2, exprtype, &res);
}
else // ISN_COMPAREOBJECT
{
status = typval_compare_object(tv1, tv2,
exprtype, &res);
}
--ectx->ec_stack.ga_len;
clear_tv(tv1);
clear_tv(tv2);
@@ -6807,6 +6818,8 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
case ISN_COMPARELIST:
case ISN_COMPAREDICT:
case ISN_COMPAREFUNC:
case ISN_COMPARECLASS:
case ISN_COMPAREOBJECT:
case ISN_COMPAREANY:
{
char *p;
@@ -6844,6 +6857,9 @@ list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc)
case ISN_COMPARELIST: type = "COMPARELIST"; break;
case ISN_COMPAREDICT: type = "COMPAREDICT"; break;
case ISN_COMPAREFUNC: type = "COMPAREFUNC"; break;
case ISN_COMPARECLASS: type = "COMPARECLASS"; break;
case ISN_COMPAREOBJECT:
type = "COMPAREOBJECT"; break;
case ISN_COMPAREANY: type = "COMPAREANY"; break;
default: type = "???"; break;
}