# Update the file information
file.mmodule = mmodule
+ # Load imported module
+ build_module_importation(nmodule)
+
return nmodule
end
end
# Visit the AST and create the `MModule` object
- # Then, recursively load imported modules
private fun build_a_mmodule(mgroup: nullable MGroup, mod_name: String, nmodule: AModule): nullable MModule
do
# Check the module name
nmodules.add(nmodule)
self.mmodule2nmodule[mmodule] = nmodule
- build_module_importation(nmodule)
-
return mmodule
end
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
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import error_req_loop0
--- /dev/null
+error_req_loop0.nit:15,8--22: Error: Dependency loop in module error_req_loop0.
-Error: Dependency loop for module ./error_req_loop1
+error_req_loop1.nit:17,8--22: Error: Dependency loop between modules error_req_loop1 and error_req_loop2.
-Error: Dependency loop for module ./error_req_loop2
+error_req_loop2.nit:17,8--22: Error: Dependency loop between modules error_req_loop2 and error_req_loop1.