- # Add `super Serializable`
- var sc = toolcontext.parse_superclass("Serializable")
- sc.location = nat.location
- nclassdef.n_superclasses.add sc
+ # Check the `serialize` state of the parent
+ if not node isa AModuledecl then
+ var up_serialize = false
+ var up: nullable ANode = node
+ loop
+ up = up.parent
+ if up == null then
+ break
+ else if up.is_serialize then
+ up_serialize = true
+ break
+ else if up.is_noserialize then
+ break
+ end
+ end
+
+ # Check for useless double declarations
+ if serialize and up_serialize then
+ toolcontext.warning(node.location, "useless-serialize",
+ "Warning: superfluous use of `{text}`.")
+ else if noserialize and not up_serialize then
+ toolcontext.warning(node.location, "useless-noserialize",
+ "Warning: superfluous use of `{text}`.")
+ end
+ end
+ end
+
+ redef fun process_nclassdef(nclassdef)
+ do
+ if not nclassdef isa AStdClassdef then return