Skip to content
Browse files

Detect and carp at circular module loading

  • Loading branch information...
1 parent fefacce commit 78c5c179c0a9f4d5fa704cf83de2c21e64d138b7 @moritz moritz committed Aug 7, 2012
Showing with 7 additions and 0 deletions.
  1. +1 −0 docs/ChangeLog
  2. +6 −0 src/Perl6/ModuleLoader.pm
View
1 docs/ChangeLog
@@ -13,6 +13,7 @@ New in 2012.08
+ simple implementation of the 'soft' pragma
+ fixed over-eager treatment of numeric literals as int rather than Int in cases
where they appeared each side of an infix operator
++ detect circularities in module loading
New in 2012.07
+ Deprecated SAFE.setting in favor of RESTRICTED.setting
View
6 src/Perl6/ModuleLoader.pm
@@ -111,6 +111,12 @@ class Perl6::ModuleLoader {
my %chosen := @candidates[0];
my @MODULES := nqp::clone(@*MODULES);
+ for @MODULES -> $m {
+ if $m<module> eq $module_name {
+ nqp::die("Circular module loading detected involving module '$module_name'");
+ }
+ }
+
# If we didn't already do so, load the module and capture
# its mainline. Otherwise, we already loaded it so go on
# with what we already have.

0 comments on commit 78c5c17

Please sign in to comment.
Something went wrong with that request. Please try again.