# The class refinement and specialization hierarchy
# It is not the real hierarchy since non concrete classes can only be leaves
# The class refinement and specialization hierarchy
# It is not the real hierarchy since non concrete classes can only be leaves
- attr _local_class_by_global: Map[MMGlobalClass, MMLocalClass] = new HashMap[MMGlobalClass, MMLocalClass]
+ var _local_class_by_global: Map[MMGlobalClass, MMLocalClass] = new HashMap[MMGlobalClass, MMLocalClass]
protected init(name: Symbol, dir: MMDirectory, context: MMContext, filename: String)
do
protected init(name: Symbol, dir: MMDirectory, context: MMContext, filename: String)
do
# 2 -> public => see public and protected
# 1 -> private => see public and protected
# 0 -> nothing => see nothing
# 2 -> public => see public and protected
# 1 -> private => see public and protected
# 0 -> nothing => see nothing
do
return _global_class_by_name.has_key(n)
end
# Get a global class by its name.
# Return null if not class match this name
do
return _global_class_by_name.has_key(n)
end
# Get a global class by its name.
# Return null if not class match this name
do
var tab = _class_specialization_hierarchy.select_smallests(supers)
c._cshe = _class_specialization_hierarchy.add(c,tab)
do
var tab = _class_specialization_hierarchy.select_smallests(supers)
c._cshe = _class_specialization_hierarchy.add(c,tab)
# Class refinement hierarchy
# It is not the real hierarchy since non concrete classes can only be leaves
# Class refinement hierarchy
# It is not the real hierarchy since non concrete classes can only be leaves
# 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
# 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
end
# Local classes are classes defined, refined or imported in a module
class MMLocalClass
# The name of the local class
end
# Local classes are classes defined, refined or imported in a module
class MMLocalClass
# The name of the local class
# Arity of the local class (if generic)
# FIXME: How to move this into the generic module in a sane way?
# Arity of the local class (if generic)
# FIXME: How to move this into the generic module in a sane way?
- meth crhe: PartialOrderElement[MMLocalClass] do return _crhe.as(not null)
- attr _crhe: nullable PartialOrderElement[MMLocalClass]
+ fun crhe: PartialOrderElement[MMLocalClass] do return _crhe.as(not null)
+ var _crhe: nullable PartialOrderElement[MMLocalClass]
- meth cshe: PartialOrderElement[MMLocalClass] do return _cshe.as(not null)
- attr _cshe: nullable PartialOrderElement[MMLocalClass]
+ fun cshe: PartialOrderElement[MMLocalClass] do return _cshe.as(not null)
+ var _cshe: nullable PartialOrderElement[MMLocalClass]
- meth che: PartialOrderElement[MMLocalClass] do return _che.as(not null)
- attr _che: nullable PartialOrderElement[MMLocalClass]
+ fun che: PartialOrderElement[MMLocalClass] do return _che.as(not null)
+ var _che: nullable PartialOrderElement[MMLocalClass]
- attr _local_property_by_global: Map[MMGlobalProperty, MMLocalProperty] = new HashMap[MMGlobalProperty, MMLocalProperty]
+ var _local_property_by_global: Map[MMGlobalProperty, MMLocalProperty] = new HashMap[MMGlobalProperty, MMLocalProperty]
- attr _properties_by_name: Map[Symbol, Array[MMGlobalProperty]] = new HashMap[Symbol, Array[MMGlobalProperty]]
+ var _properties_by_name: Map[Symbol, Array[MMGlobalProperty]] = new HashMap[Symbol, Array[MMGlobalProperty]]
# Create a new class with a given name and arity
protected init(mod: MMModule, name: Symbol, arity: Int)
# Create a new class with a given name and arity
protected init(mod: MMModule, name: Symbol, arity: Int)
# Associate this local class to a global one and register to hierarchy
# the global class for this class
# refined classes for this class
# Associate this local class to a global one and register to hierarchy
# the global class for this class
# refined classes for this class
# Is there a global propery with a given name
# TODO: Will disapear when qualified names will be available
# Is there a global propery with a given name
# TODO: Will disapear when qualified names will be available
do
return _properties_by_name.has_key(n) and _properties_by_name[n].length == 1
end
# Get a global property by its name
# TODO: Will disapear when qualified names will be available
do
return _properties_by_name.has_key(n) and _properties_by_name[n].length == 1
end
# Get a global property by its name
# TODO: Will disapear when qualified names will be available
do
return get_property_by_name(a)
end
# Get a method by its name
# TODO: Will disapear when qualified names will be available
do
return get_property_by_name(a)
end
# Get a method by its name
# TODO: Will disapear when qualified names will be available
do
return _properties_by_name[na].first
end
# Select a method from its name
# TODO: Will disapear when qualified names will be available
do
return _properties_by_name[na].first
end
# Select a method from its name
# TODO: Will disapear when qualified names will be available
# Look in super-classes (by specialization) and return properties with name
# Beware, global property of results is not intended to be the same
# Look in super-classes (by specialization) and return properties with name
# Beware, global property of results is not intended to be the same
do
i._prhe = _property_hierarchy.add(i,sup)
end
# Is the global property an attribute ?
do
i._prhe = _property_hierarchy.add(i,sup)
end
# Is the global property an attribute ?
end
# Local properties are properties defined (explicitely or not) in a local class
class MMLocalProperty
# The name of the property
end
# Local properties are properties defined (explicitely or not) in a local class
class MMLocalProperty
# The name of the property
- meth global: MMGlobalProperty do return _global.as(not null)
- meth is_global_set: Bool do return _global != null
+ fun global: MMGlobalProperty do return _global.as(not null)
+ fun is_global_set: Bool do return _global != null