Skip to content

Commit

Permalink
First simple cut at our-scoped variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jun 25, 2011
1 parent b9b7f54 commit f83b81d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 0 additions & 3 deletions NOMMAP.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ Things that aren't blockers but might be worth knowing about:
## Lexical Multi-Part names
For my X::Base { ... }, my Foo::Bar { ... } etc. The our-scoped ones work.

## our-scoped variables
Still to be implemented

## Object construction
new, bless, CREATE, BUILDALL, BUILD handling. Make use of default value
closure.
Expand Down
9 changes: 9 additions & 0 deletions src/Perl6/Actions.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,15 @@ class Perl6::Actions is HLL::Actions {
$past := box_native_if_needed($past, $descriptor.of);
}
}
elsif $*SCOPE eq 'our' {
if $*TYPENAME {
$/.CURSOR.panic("Cannot put a type constraint on an 'our'-scoped variable");
}
$BLOCK[0].push(PAST::Var.new(
:name($name), :scope('lexical'), :isdecl(1),
:viviself($*ST.symbol_lookup([$name], $/, :package_only(1), :lvalue(1)))));
$BLOCK.symbol($name, :scope('lexical'));
}
else {
$/.CURSOR.panic("$*SCOPE scoped variables not yet implemented");
}
Expand Down

0 comments on commit f83b81d

Please sign in to comment.