mmbv.visit(node)
if tc.error_count > 0 then exit(1)
+ if mhe.direct_greaters.is_empty then
+ process_default_classes(tc)
+ end
+
# Import unrefined local classes and attach them to global classes
import_local_classes
if tc.error_count > 0 then exit(1)
end
+
+ # Create some primitive default classes if they do not exists
+ fun process_default_classes(tc: ToolContext)
+ do
+ var name = once ("Object".to_symbol)
+ if not has_global_class_named(name) then
+ var c = new MMSrcLocalClass(self, name, null, 0)
+ c.new_global
+ src_local_classes[name] = c
+ end
+ name = once ("Bool".to_symbol)
+ if not has_global_class_named(name) then
+ var c = new MMSrcLocalClass(self, name, null, 0)
+ c.new_global
+ src_local_classes[name] = c
+ end
+ end
end
redef class MMLocalClass
# Concrete NIT source properties by name
readable var _src_local_properties: Map[Symbol, MMLocalProperty]
- init(mod: MMSrcModule, n: Symbol, cla: PClassdef, a: Int)
+ init(mod: MMSrcModule, n: Symbol, cla: nullable PClassdef, a: Int)
do
super(mod, n, a)
- _nodes = [cla]
+ if cla == null then
+ _nodes = new Array[PClassdef]
+ else
+ _nodes = [cla]
+ end
_src_local_properties = new HashMap[Symbol, MMLocalProperty]
end
end