# We have to work on ALL the classes of the module
var classes = new Array[MMLocalClass]
- for c in module.local_classes do
- c.compute_super_classes
- classes.add(c)
- end
+ for c in module.local_classes do classes.add(c)
classes.sort !cmp(x,y) = x.total_order_compare(y)
for c in classes do
- # Finish processing the class (if invisible)
- c.compute_ancestors
- c.inherit_global_properties
-
# Associate a CompiledClass to the class
var cc = new CompiledClass(c)
compiled_classes[c.global] = cc
# of _sep files so that we do not corrupt separate compilation
fun get_file_ending: String do return if tc.global then "_glob" else "_sep"
+ # This method will ensure that all the metamodel is computed before we
+ # start using all the classes
+ private fun finish_processing_classes do
+ var classes = new Array[MMLocalClass]
+ for c in module.local_classes do
+ c.compute_super_classes
+ classes.add(c)
+ end
+
+ for c in classes do
+ c.compute_ancestors
+ c.inherit_global_properties
+ end
+ end
+
fun compute_main_method do
# Check for the 'Sys' class
var sysname = once "Sys".to_symbol
init(m: MMModule, toolcontext: ToolContext) do
_module = m
_tc = toolcontext
+ finish_processing_classes
end
end