Skip to content

Commit

Permalink
Detect and carp at circular module loading
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed Aug 7, 2012
1 parent fefacce commit 78c5c17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/ChangeLog
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/Perl6/ModuleLoader.pm
Expand Up @@ -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.
Expand Down

0 comments on commit 78c5c17

Please sign in to comment.