Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
declare sigilless variables in method defterm, jnthn++
  • Loading branch information
moritz committed Aug 13, 2012
1 parent 6f4df39 commit 5533f75
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/Perl6/Actions.pm
Expand Up @@ -2870,9 +2870,25 @@ class Perl6::Actions is HLL::Actions {
}

method defterm($/) {
%*PARAM_INFO<variable_name> := ~$<identifier>;
%*PARAM_INFO<desigilname> := ~$<identifier>;
my $name := ~$<identifier>;
%*PARAM_INFO<variable_name> := $name;
%*PARAM_INFO<desigilname> := $name;
%*PARAM_INFO<sigil> := '';
my $cur_pad := $*W.cur_lexpad();
if $cur_pad.symbol($name) {
$*W.throw($/, ['X', 'Redeclaration'], symbol => $name);
}
if nqp::existskey(%*PARAM_INFO, 'nominal_type') {
$cur_pad[0].push(QAST::Var.new( :$name, :scope('lexical'),
:decl('var'), :returns(%*PARAM_INFO<nominal_type>) ));
%*PARAM_INFO<container_descriptor> := $*W.create_container_descriptor(
%*PARAM_INFO<nominal_type>, 0, %*PARAM_INFO<variable_name>);
$cur_pad.symbol(%*PARAM_INFO<variable_name>, :descriptor(%*PARAM_INFO<container_descriptor>),
:type(%*PARAM_INFO<nominal_type>));
} else {
$cur_pad[0].push(QAST::Var.new( :name(~$/), :scope('lexical'), :decl('var') ));
}
$cur_pad.symbol(~$/, :scope('lexical'));
}

method default_value($/) {
Expand Down

0 comments on commit 5533f75

Please sign in to comment.