From 2f65380c0648a03e9db7c34be3a12fdb720162b2 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Wed, 10 Oct 2018 06:12:21 +0000 Subject: [PATCH] put the method modifiers information into the preamble field of the method signature object from interface definition --- moo/lib/comp.c | 17 ++++++++--------- moo/lib/moo.c | 2 -- moo/lib/moo.h | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/moo/lib/comp.c b/moo/lib/comp.c index 5885cee..9e08487 100644 --- a/moo/lib/comp.c +++ b/moo/lib/comp.c @@ -6604,8 +6604,7 @@ static int add_compiled_method (moo_t* moo) preamble_index = 0; } - /*if (cc->mth.variadic) */ - preamble_flags |= cc->mth.variadic; + preamble_flags |= cc->mth.variadic; /* MOO_METHOD_PREAMBLE_FLAG_VARIADIC or MOO_METHOD_PREAMBLE_FLAG_LIBERAL */ if (cc->mth.type == MOO_METHOD_DUAL) preamble_flags |= MOO_METHOD_PREAMBLE_FLAG_DUAL; if (cc->mth.lenient) preamble_flags |= MOO_METHOD_PREAMBLE_FLAG_LENIENT; @@ -8126,8 +8125,9 @@ static int add_method_signature (moo_t* moo) moo_cunit_interface_t* ifce = (moo_cunit_interface_t*)moo->c->cunit; moo_oop_char_t name; /* selector */ moo_oop_methsig_t mth; /* method signature */ + moo_ooi_t preamble_flags = 0; moo_oow_t tmp_count = 0; - + name = (moo_oop_char_t)moo_makesymbol(moo, ifce->mth.name.ptr, ifce->mth.name.len); if (!name) goto oops; moo_pushtmp (moo, (moo_oop_t*)&name); tmp_count++; @@ -8139,12 +8139,11 @@ static int add_method_signature (moo_t* moo) mth->owner = ifce->self_oop; mth->name = name; -/* -ifce->mth.variadic? -ifce->mth.lenient? -ifce->meth.type == DUAL? CLASS? INST? -*/ - mth->modifiers = MOO_SMOOI_TO_OOP(0); + preamble_flags |= ifce->mth.variadic; /* MOO_METHOD_PREAMBLE_FLAG_VARIADIC or MOO_METHOD_PREAMBLE_FLAG_LIBERAL */ + if (ifce->mth.lenient) preamble_flags |= MOO_METHOD_PREAMBLE_FLAG_LENIENT; + if (ifce->mth.type == MOO_METHOD_DUAL) preamble_flags |= MOO_METHOD_PREAMBLE_FLAG_DUAL; + + mth->preamble = MOO_SMOOI_TO_OOP(MOO_METHOD_MAKE_PREAMBLE(0,0,preamble_flags)); mth->tmpr_nargs = MOO_SMOOI_TO_OOP(ifce->mth.tmpr_nargs); if (ifce->mth.type == MOO_METHOD_DUAL) diff --git a/moo/lib/moo.c b/moo/lib/moo.c index 2ddaeb4..14f88b1 100644 --- a/moo/lib/moo.c +++ b/moo/lib/moo.c @@ -872,8 +872,6 @@ int moo_genpfmethod (moo_t* moo, moo_mod_t* mod, moo_oop_class_t _class, moo_met mth->name = mnsym; if (variadic) preamble_flags |= MOO_METHOD_PREAMBLE_FLAG_VARIADIC; mth->preamble = MOO_SMOOI_TO_OOP(MOO_METHOD_MAKE_PREAMBLE(MOO_METHOD_PREAMBLE_NAMED_PRIMITIVE, 0, preamble_flags)); - /*mth->preamble_data[0] = MOO_SMOOI_TO_OOP(0); - mth->preamble_data[1] = MOO_SMOOI_TO_OOP(0);*/ mth->preamble_data[0] = MOO_SMPTR_TO_OOP(0); mth->preamble_data[1] = MOO_SMPTR_TO_OOP(0); mth->tmpr_count = MOO_SMOOI_TO_OOP(arg_count); diff --git a/moo/lib/moo.h b/moo/lib/moo.h index bf2bc7d..8b8ad56 100644 --- a/moo/lib/moo.h +++ b/moo/lib/moo.h @@ -606,7 +606,7 @@ struct moo_methsig_t moo_oop_interface_t owner; /* Interface */ moo_oop_char_t name; /* Symbol, method name */ - moo_oop_t modifiers; /* SmallInteger, modifiers specified */ + moo_oop_t preamble; /* SmallInteger, includes only preamble flags based on modifiers specified */ moo_oop_t tmpr_nargs; /* SmallInteger */ };