DECL_ON(const Type, t, = check_exp(env, exp_self(bin)));
return t;
}
+
static OP_CHECK(opck_deep_ne_any) {
Exp_Binary *bin = data;
bin->op = insert_symbol(env->gwion->st, "!=");
vector_release(&l);
vector_release(&r);
if(ret) return env->gwion->type[et_bool];
+ const Symbol op = bin->op;
+ bin->op = !strcmp(s_name(bin->op), "?=")
+ ? insert_symbol(env->gwion->st, "==") : insert_symbol(env->gwion->st, "!=");
+ env->context->error = true;
+ const Type ret_type = check_exp(env, exp_self(bin));
+ env->context->error = false;
+ if(ret_type) return env->gwion->type[et_bool];
ERR_N(exp_self(bin)->pos, "no deep operation for: {G+/}%s{0} {+}%s{0} {G+/}%s{0}",
- bin->lhs->type->name, s_name(bin->op), bin->rhs->type->name);
+ bin->lhs->type->name, s_name(op), bin->rhs->type->name);
}
struct DeepEmit {
static OP_CHECK(opck_dict_access) {
const Array_Sub array = (Array_Sub)data;
HMapInfo *const hinfo = (HMapInfo*)array->type->nspc->class_data;
+
+ struct Exp_ func = { .exp_type = ae_exp_primary, .d = { .prim = { .prim_type = ae_prim_id, .d = { .var = insert_symbol("hash") }} }};
+
+ struct Exp_ call = {
+ .exp_type = ae_exp_call,
+ .d = {
+ .exp_call = {
+ .func = &func,
+ .args = array->exp // beware next
+ }
+ }
+};
+struct Exp_ lhs = { .exp_type = ae_exp_primary, .type = hinfo->key, .d = { .prim = { .prim_type = ae_prim_id } }};
+struct Exp_ rhs = { .exp_type = ae_exp_primary, .type = hinfo->key, .d = { .prim = { .prim_type = ae_prim_id } }};
+struct Exp_ bin = { .exp_type = ae_exp_binary, .d = { .exp_binary = { .lhs = &lhs, .rhs = &rhs, .op = insert_symbol("?=") } }};
+struct Op_Import opi = {
+ .lhs = hinfo->key,
+ .rhs = hinfo->key,
+ .op = bin.d.exp_binary.op,
+ .data = (m_uint)&bin
+};
+
+
+ CHECK_BN(traverse_exp(env, &call));
+ CHECK_ON(op_check(env, &opi));
+
if(!array->exp->next) return hinfo->val;
struct Array_Sub_ next = { array->exp->next, hinfo->val,
array->depth - 1};