ni: adds MMModule::is_extern_hybrid
authorAlexis Laferrière <alexis.laf@xymus.net>
Mon, 15 Aug 2011 15:09:46 +0000 (11:09 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Thu, 9 Feb 2012 21:00:47 +0000 (16:00 -0500)
This information will be used to generate frontier files
with extern if necessary and also by the stub generator.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/metamodel/abstractmetamodel.nit
src/syntax/mmbuilder.nit
src/syntax/syntax_base.nit

index 6edfbd9..111c73d 100644 (file)
@@ -153,6 +153,11 @@ 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
+
        protected init(name: Symbol, dir: MMDirectory, context: MMContext, loc: Location)
        do
                _name = name
index 494d099..a8a1610 100644 (file)
@@ -671,6 +671,9 @@ redef class AStdClassdef
                        if n_kwredef != null then
                                v.error(self, "Redef error: No class {name} is imported. Remove the redef keyword to define a new class.")
                        end
+                       if glob.is_extern then
+                               glob.mmmodule.is_extern_hybrid = true
+                       end
 
                        for c in _local_class.cshe.direct_greaters do
                                var cg = c.global
index 0d9597e..d7da272 100644 (file)
@@ -201,6 +201,10 @@ class MMMethSrcMethod
                _is_extern = node isa AExternPropdef
                _is_abstract = node isa ADeferredMethPropdef
                _extern_name = null
+
+               if is_extern then
+                       mmmodule.is_extern_hybrid = true
+               end
        end
 end