Skip to content

Commit

Permalink
Fix state at top level
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Jul 12, 2011
1 parent 8545ad6 commit 08c4185
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/CLRBackend.cs
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Metamodel.pm6
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 08c4185

Please sign in to comment.