# 1 -> public
# 3 -> private
readable writable attr _visibility_level: Int
+
+ # Is the global class a mixin class?
+ # A mixin class inherits all constructors from a superclass
+ meth is_mixin: Bool
+ do
+ return _mixin_of != self
+ end
+
+ # Indicate the superclass the class is a mixin of.
+ # If mixin_of == self then the class is not a mixin
+ # Is two classes have the same mixin_of value, then they both belong to the same mixing group
+ readable writable attr _mixin_of: MMGlobalClass = self
+
end
# Local classes are classes defined, refined or imported in a module
# Is the global property a constructor (thus also a method)?
readable writable attr _is_init: Bool
+ # Is the global property a constructor for a given class?
+ meth is_init_for(c: MMLocalClass): Bool
+ do
+ if not is_init then return false
+ var sc = intro.local_class
+ var res = c.che <= sc and c.global.mixin_of == sc.global.mixin_of
+ return res
+ end
+
# Visibility of the property
# 1 -> public
# 2 -> protected
end
end
- # A mixin class can be build the same way that one of its superclasses
- readable attr _is_mixin: Bool = false
-
# Introduce or inherit default constructors
private meth process_default_constructors(v: PropertyBuilderVisitor)
do
for gp in super_constructors do
var sc = gp.local_class
if supers.has(sc) then continue
- assert sc isa MMSrcLocalClass
- if not sc.is_mixin then
+ if not sc.global.is_mixin then
supers.add(sc)
end
end
make_visible_an_inherited_global_property(gp)
end
end
- _is_mixin = true
+ global.mixin_of = superclass.global
else
# v.error(nodes.first, "Error, constructor required in {self} since no anonimous init found in {sc}.")