ni_nitdoc: added fast copy past utility to signatures.
[nit.git] / src / metamodel / abstractmetamodel.nit
index 32af390..37f9472 100644 (file)
@@ -20,9 +20,10 @@ package abstractmetamodel
 
 import partial_order
 import location
+import symbol
 
 # The main singleton which knows everything
-class MMContext
+abstract class MMContext
 
        init do end
 
@@ -107,7 +108,7 @@ class MMDirectory
 end
 
 # A module is a Nit file
-class MMModule
+abstract class MMModule
        # Global context
        readable var _context: MMContext 
 
@@ -153,6 +154,14 @@ class MMModule
        # 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
@@ -302,6 +311,9 @@ class MMGlobalClass
        # 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
@@ -322,7 +334,7 @@ class MMGlobalClass
 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
 
@@ -492,7 +504,7 @@ class MMLocalClass
                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]
@@ -586,7 +598,7 @@ class MMGlobalProperty
 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
 
@@ -648,12 +660,17 @@ class MMLocalProperty
 end
 
 # Attribute local properties
-class MMAttribute
+abstract class MMAttribute
        super MMLocalProperty
 end
 
+class MMExplicitImport
+       var local_class : MMLocalClass
+       var method : MMMethod
+end
+
 # Method local properties
-class MMMethod
+abstract class MMMethod
        super MMLocalProperty
        # Is the method defined with intern
        fun is_intern: Bool is abstract
@@ -661,12 +678,18 @@ class MMMethod
        # 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
+abstract class MMConcreteClass
        super MMLocalClass
 end