model: try_get_primitive_method asks for a MClass (and not a MType)
[nit.git] / src / modelbuilder.nit
index fd13faa..8186969 100644 (file)
@@ -72,6 +72,11 @@ class ModelBuilder
                        nmodules.add(mmodule2nmodule[mm])
                end
                toolcontext.run_phases(nmodules)
+
+               if toolcontext.opt_only_metamodel.value then
+                       self.toolcontext.info("*** ONLY METAMODEL", 1)
+                       exit(0)
+               end
        end
 
        # Instantiate a modelbuilder for a model and a toolcontext
@@ -123,6 +128,12 @@ class ModelBuilder
                self.toolcontext.info("*** END PARSE: {time1-time0} ***", 2)
 
                self.toolcontext.check_errors
+
+               if toolcontext.opt_only_parse.value then
+                       self.toolcontext.info("*** ONLY PARSE...", 1)
+                       exit(0)
+               end
+
                return mmodules
        end
 
@@ -400,6 +411,10 @@ class ModelBuilder
                        if sup == null then continue # Skip error
                        imported_modules.add(sup)
                        var mvisibility = aimport.n_visibility.mvisibility
+                       if mvisibility == protected_visibility then
+                               error(aimport.n_visibility, "Error: only properties can be protected.")
+                               return
+                       end
                        mmodule.set_visibility_for(sup, mvisibility)
                end
                if stdimport then
@@ -436,7 +451,7 @@ class ModelBuilder
        end
 
        # Force to get the primitive method named `name' on the type `recv' or do a fatal error on `n'
-       fun force_get_primitive_method(n: ANode, name: String, recv: MType, mmodule: MModule): MMethod
+       fun force_get_primitive_method(n: ANode, name: String, recv: MClass, mmodule: MModule): MMethod
        do
                var res = mmodule.try_get_primitive_method(name, recv)
                if res == null then