self.add("{res} = {recv}->attrs[{a.const_color}] != NULL; /* {a} on {recv.inspect}*/")
else
- if not mtype.is_c_primitive then
+ if not mtype.is_c_primitive and not mtype.is_tagged then
self.add("{res} = {recv}->attrs[{a.const_color}].val != NULL; /* {a} on {recv.inspect} */")
else
self.add("{res} = 1; /* NOT YET IMPLEMENTED: isset of primitives: {a} on {recv.inspect} */")
end
end
+ redef fun native_array_get(nat, i)
+ do
+ var nclass = mmodule.native_array_class
+ var recv = "((struct instance_{nclass.c_name}*){nat})->values"
+ # Because the objects are boxed, return the box to avoid unnecessary (or broken) unboxing/reboxing
+ var res = self.new_expr("{recv}[{i}]", compiler.mainmodule.object_type)
+ return res
+ end
+
+ redef fun native_array_set(nat, i, val)
+ do
+ var nclass = mmodule.native_array_class
+ var recv = "((struct instance_{nclass.c_name}*){nat})->values"
+ self.add("{recv}[{i}]={val};")
+ end
+
fun link_unresolved_type(mclassdef: MClassDef, mtype: MType) do
assert mtype.need_anchor
var compiler = self.compiler
return super
end
end
+
+redef class AAttrPropdef
+ redef fun init_expr(v, recv)
+ do
+ super
+ if is_lazy and v.compiler.modelbuilder.toolcontext.opt_no_union_attribute.value then
+ var guard = self.mlazypropdef.mproperty
+ v.write_attribute(guard, recv, v.bool_instance(false))
+ end
+ end
+end