Permalink
Browse files

Fix state at top level

  • Loading branch information...
1 parent 8545ad6 commit 08c41854c359a79983c1f4254069d34cabfd827d @sorear committed Jul 12, 2011
Showing with 3 additions and 2 deletions.
  1. +1 −0 lib/CLRBackend.cs
  2. +2 −2 src/Metamodel.pm6
View
@@ -3183,6 +3183,7 @@ class NamProcessor {
csr.l_lexicals.TryGetValue(name, out r)) {
if (r is LexAlias) {
name = (r as LexAlias).to;
+ continue;
} else {
return r;
}
View
@@ -634,7 +634,7 @@ class StaticSub is RefTarget {
if $l.^isa(Metamodel::Lexical::Alias) { self.delete_lex($l.to) }
else { %!lexicals{$name}:delete }
} else {
- $.outer && $.outer.delete_lex($name);
+ $.outer && $.outer.unit === $.unit && $.outer.delete_lex($name);
}
}
@@ -694,7 +694,7 @@ class StaticSub is RefTarget {
method add_state_name($slot, $back, *%param) {
# outermost sub isn't cloned so a fallback to my is safe
- my $up = $.outer // self;
+ my $up = (self === self.to_unit) ?? self !! self.outer;
$up.lexicals{$back} = Metamodel::Lexical::Simple.new(|%param);
if defined($slot) {
self.add_lex($slot, Metamodel::Lexical::Alias.new(to => $back,

0 comments on commit 08c4185

Please sign in to comment.