import partial_order
import location
+import symbol
# The main singleton which knows everything
-class MMContext
+abstract class MMContext
init do end
end
# A module is a Nit file
-class MMModule
+abstract class MMModule
# Global context
readable var _context: MMContext
# Dictionary of global classes
var _global_class_by_name: Map[Symbol, MMGlobalClass] = new HashMap[Symbol, MMGlobalClass]
+ # Is a hybrid module partially implemented in extern code
+ # It is if it contains a new extern class or an
+ # extern class declaration
+ var is_extern_hybrid : Bool writable = false
+
+ # Uses foreign function interface
+ fun uses_ffi : Bool is abstract
+
protected init(name: Symbol, dir: MMDirectory, context: MMContext, loc: Location)
do
_name = name
# Is the global class a enum class?
readable writable var _is_enum: Bool = false
+ # Is the global class an extern class?
+ readable writable var _is_extern: Bool = false
+
# Visibility of the global class
# 1 -> public
# 3 -> private
end
# Local classes are classes defined, refined or imported in a module
-class MMLocalClass
+abstract class MMLocalClass
# The name of the local class
readable var _name: Symbol
return _global_properties.has(glob)
end
- # Get a local proprty by its global property
+ # Get a local property by its global property
fun [](glob: MMGlobalProperty): MMLocalProperty
do
return _local_property_by_global[glob]
end
# Local properties are properties defined (explicitely or not) in a local class
-class MMLocalProperty
+abstract class MMLocalProperty
# The name of the property
readable var _name: Symbol
end
# Attribute local properties
-class MMAttribute
-special MMLocalProperty
+abstract class MMAttribute
+ super MMLocalProperty
+end
+
+class MMExplicitImport
+ var local_class : MMLocalClass
+ var method : MMMethod
end
# Method local properties
-class MMMethod
-special MMLocalProperty
+abstract class MMMethod
+ super MMLocalProperty
# Is the method defined with intern
fun is_intern: Bool is abstract
# Is the method abstract
fun is_abstract: Bool is abstract
- # Is the method extern, if yes what is the extern_name
+ # Is the method extern
+ fun is_extern: Bool is abstract
+
+ # extern name when specified explicitly in nit code
fun extern_name: nullable String is abstract
+
+ # properties explicitly exported to native code
+ fun explicit_imports : Set[ MMExplicitImport ] is abstract
end
# Concrete local classes
-class MMConcreteClass
-special MMLocalClass
+abstract class MMConcreteClass
+ super MMLocalClass
end