Skip to content

Commit

Permalink
Generate lexical accessor after declaring var.
Browse files Browse the repository at this point in the history
Unbusts S12-attributes/class.t.
  • Loading branch information
jnthn committed Jul 1, 2013
1 parent dbc5f1a commit 080a6bb
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/Perl6/Actions.nqp
Expand Up @@ -1925,17 +1925,7 @@ class Perl6::Actions is HLL::Actions does STDActions {
$past<metaattr> := $attr; $past<metaattr> := $attr;
} }
elsif $*SCOPE eq 'my' || $*SCOPE eq 'our' || $*SCOPE eq 'state' { elsif $*SCOPE eq 'my' || $*SCOPE eq 'our' || $*SCOPE eq 'state' {
# Twigil handling. # Some things can't be done to our vars.
if $twigil eq '.' {
add_lexical_accessor($/, $past, $desigilname, $*W.cur_lexpad());
$name := $sigil ~ $desigilname;
}
elsif $twigil eq '!' {
$*W.throw($/, ['X', 'Syntax', 'Variable', 'Twigil'],
twigil => $twigil,
scope => $*SCOPE,
);
}
if $*SCOPE eq 'our' { if $*SCOPE eq 'our' {
if $*OFTYPE { if $*OFTYPE {
$/.CURSOR.panic("Cannot put a type constraint on an 'our'-scoped variable"); $/.CURSOR.panic("Cannot put a type constraint on an 'our'-scoped variable");
Expand Down Expand Up @@ -1981,6 +1971,18 @@ class Perl6::Actions is HLL::Actions does STDActions {
)); ));
} }
} }

# Twigil handling.
if $twigil eq '.' {
add_lexical_accessor($/, $past, $desigilname, $*W.cur_lexpad());
$name := $sigil ~ $desigilname;
}
elsif $twigil eq '!' {
$*W.throw($/, ['X', 'Syntax', 'Variable', 'Twigil'],
twigil => $twigil,
scope => $*SCOPE,
);
}
} }
else { else {
$*W.throw($/, 'X::Comp::NYI', $*W.throw($/, 'X::Comp::NYI',
Expand Down

0 comments on commit 080a6bb

Please sign in to comment.