added make_association, pop_into_association_key, pop_into_association_value byte codes to support assocation expressions

This commit is contained in:
hyunghwan.chung
2017-02-05 15:05:25 +00:00
parent eb83c8d83a
commit 60c38a1ecb
5 changed files with 77 additions and 5 deletions

View File

@ -3795,6 +3795,45 @@ int moo_execute (moo_t* moo)
break;
/* -------------------------------------------------------- */
case BCODE_MAKE_ASSOCIATION:
{
moo_oop_t t;
LOG_INST_0 (moo, "make_association");
t = moo_instantiate (moo, moo->_association, MOO_NULL, 0);
if (!t) goto oops;
MOO_STACK_PUSH (moo, t); /* push the association created */
break;
}
case BCODE_POP_INTO_ASSOCIATION_KEY:
{
moo_oop_t t1, t2;
LOG_INST_0 (moo, "pop_into_association_key");
t1 = MOO_STACK_GETTOP(moo);
MOO_STACK_POP (moo);
t2 = MOO_STACK_GETTOP(moo);
((moo_oop_association_t)t2)->key = t1;
break;
}
case BCODE_POP_INTO_ASSOCIATION_VALUE:
{
moo_oop_t t1, t2;
LOG_INST_0 (moo, "pop_into_association_value");
t1 = MOO_STACK_GETTOP(moo);
MOO_STACK_POP (moo);
t2 = MOO_STACK_GETTOP(moo);
((moo_oop_association_t)t2)->value = t1;
break;
}
case BCODE_MAKE_ARRAY:
{
moo_oop_t t;