struct SpecialId_ *spid, const Exp_Primary* prim) {
exp_self(prim)->info->type = spid->type;
if(spid->is_const)
- exp_getmeta(exp_self(prim));
+ exp_setmeta(exp_self(prim), 1);
return spid->ck ? spid->ck(env, prim) : spid->type;
}
#include "operator.h"
#include "import.h"
-static inline m_str get_access(const Exp e) {
- if(exp_getmeta(e))
- return "non-mutable";
- return !exp_getprot(e) ? NULL : "protected";
-}
-
OP_CHECK(opck_basic_cast) {
const Exp_Cast* cast = (Exp_Cast*)data;
return isa(cast->exp->info->type, exp_self(cast)->info->type) > 0 ?
OP_CHECK(opck_const_rhs) {
const Exp_Binary* bin = (Exp_Binary*)data;
- const m_str access = get_access(bin->rhs);
+ const m_str access = exp_access(bin->rhs);
if(access)
ERR_N(bin->rhs->pos, _("cannot assign '%s' on types '%s' and '%s'.\n"
" ... (reason: --- right-side operand is %s.)"),
OP_CHECK(opck_unary) {
const Exp_Unary* unary = (Exp_Unary*)data;
- const m_str access = get_access(unary->exp);
+ const m_str access = exp_access(unary->exp);
if(access)
ERR_N(unary->exp->pos,
_("unary operator '%s' cannot be used on %s data-types."),
OP_CHECK(opck_post) {
const Exp_Postfix* post = (Exp_Postfix*)data;
- const m_str access = get_access(post->exp);
+ const m_str access = exp_access(post->exp);
if(access)
ERR_N(post->exp->pos, _("post operator '%s' cannot be used on %s data-type."),
s_name(post->op), access)
ANN static m_bool scan1_exp_post(const Env env, const Exp_Postfix* post) {
CHECK_BB(scan1_exp(env, post->exp))
const m_str access = exp_access(post->exp);
- if(access)
+ if(!access)
return GW_OK;
ERR_B(post->exp->pos, _("post operator '%s' cannot be used"
- " on %S data-type..."), s_name(post->op), access);
+ " on %s data-type..."), s_name(post->op), access);
}
ANN static m_bool scan1_exp_call(const Env env, const Exp_Call* exp_call) {