+
+ # Is this classed marked `serialize`? in part or fully?
+ #
+ # This method returns 3 possible values:
+ # * `null`, this class is not to be serialized.
+ # * `true`, the attributes of this class are to be serialized by default.
+ # * `false`, the attributes of this class are to be serialized on demand only.
+ fun how_serialize: nullable Bool
+ do
+ # Is there a declaration on the classdef or the module?
+ var serialize = is_serialize
+
+ if not serialize and not is_noserialize then
+ # Is the module marked serialize?
+ serialize = parent.as(AModule).is_serialize
+ end
+
+ if serialize then return true
+
+ if not serialize then
+ # Is there an attribute marked serialize?
+ for npropdef in n_propdefs do
+ if npropdef.is_serialize then
+ return false
+ end
+ end
+ end
+
+ return null
+ end