modelbuilder: display error in case of dependency loop
authorJean Privat <jean@pryen.org>
Thu, 6 Mar 2014 13:43:46 +0000 (08:43 -0500)
committerJean Privat <jean@pryen.org>
Thu, 6 Mar 2014 13:43:46 +0000 (08:43 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/modelbuilder.nit

index 58c6296..a97535e 100644 (file)
@@ -555,6 +555,13 @@ class ModelBuilder
                                error(aimport.n_visibility, "Error: only properties can be protected.")
                                return
                        end
+                       if sup == mmodule then
+                               error(aimport.n_name, "Error: Dependency loop in module {mmodule}.")
+                       end
+                       if sup.in_importation < mmodule then
+                               error(aimport.n_name, "Error: Dependency loop between modules {mmodule} and {sup}.")
+                               return
+                       end
                        mmodule.set_visibility_for(sup, mvisibility)
                end
                if stdimport then