added default hash for nil, true, false

This commit is contained in:
hyunghwan.chung 2018-03-25 16:29:09 +00:00
parent 6a5ff66580
commit d08370f73f

View File

@ -1913,6 +1913,11 @@ static moo_pfrc_t pf_hash (moo_t* moo, moo_ooi_t nargs)
break; break;
default: default:
{
if (rcv == moo->_nil) hv = 0;
else if (rcv == moo->_true) hv = 1;
else if (rcv == moo->_false) hv = 2;
else
{ {
int type; int type;
@ -1941,6 +1946,7 @@ static moo_pfrc_t pf_hash (moo_t* moo, moo_ooi_t nargs)
moo_seterrbfmt(moo, MOO_ENOIMPL, "no builtin hash implemented for %O", rcv); /* TODO: better error code? */ moo_seterrbfmt(moo, MOO_ENOIMPL, "no builtin hash implemented for %O", rcv); /* TODO: better error code? */
return MOO_PF_FAILURE; return MOO_PF_FAILURE;
} }
}
break; break;
} }
} }