Commits

Anonymous committed 2ba5174

Register function parameters in the function's symbol table as 'lexical' vars

Comments (0)

Files changed (1)

Grammar/Actions.nqp

 method TOP($/) {
     my $block := PAST::Block.new( $( $<file_input> ) );
     $block.hll('pynie');
+    $block.symbol_defaults( :scope('package') );
     make $block;
 }
 
 
     ## handle normal parameters
     for $<defparameter> {
-        $past.push( $($_) );
+        my $param := $( $_ );
+        $past.push( $param );
+        # if we don't do this, the variable name isn't actually recognized later on:
+        $past.symbol( $param.name(), :scope('lexical') );
     }
 
     ## handle '*' <identifier>
     my $past := $( $<parameter> );
     $past.scope('parameter');
     $past.named($past.name());
+    $past.isdecl(1);
 
     ## add the default value for this parameter, if any
     if $<expression> {
 
 method identifier($/) {
     make PAST::Var.new( :name( ~$/ ),
-                        :scope('package'),
                         :node($/) );
 }