Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Enable contextual variable definitions and dynamic lookups.
  • Loading branch information
pmichaud committed Sep 5, 2009
1 parent 2276af9 commit 7734f9b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build/PARROT_REVISION
@@ -1 +1 @@
40984
40987
3 changes: 3 additions & 0 deletions src/builtins/globals.pir
Expand Up @@ -97,6 +97,9 @@ src/builtins/globals.pir - initialize miscellaneous global variables
.sub '!find_contextual'
.param string name

$P0 = find_dynamic_lex name
unless null $P0 goto done

.local string pkgname
pkgname = clone name
substr pkgname, 1, 1, ''
Expand Down
6 changes: 4 additions & 2 deletions src/parser/actions.pm
Expand Up @@ -2124,13 +2124,15 @@ method variable($/, $key) {
$var<sigil> := ~$<sigil>;
if $twigil { $var<twigil> := $twigil; }

# Variables with '*' twigils are contextual.
# Variables with '*' twigils are contextual. Normally
# this is handled by a call to !find_contextual, but
# we also create a PAST::Var in case it's a variable
# declaration.
if $twigil eq '*' {
my $vardecl := $var;
$var := PAST::Op.new( $varname,
:name('!find_contextual'),
:lvalue(0) );
$varname := $sigil ~ $name;
$vardecl.name($varname);
$vardecl.namespace(@ns);
$vardecl.scope('package');
Expand Down

0 comments on commit 7734f9b

Please sign in to comment.