Skip to content

Instantly share code, notes, and snippets.

@moritz
Created September 9, 2012 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moritz/3685011 to your computer and use it in GitHub Desktop.
Save moritz/3685011 to your computer and use it in GitHub Desktop.
export variables
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm
index 6bd91e9..ad542e9 100644
--- a/src/Perl6/Actions.pm
+++ b/src/Perl6/Actions.pm
@@ -1679,9 +1679,14 @@ class Perl6::Actions is HLL::Actions {
my $descriptor := $*W.create_container_descriptor(%cont_info<value_type>, 1, $name);
# Install the container.
- $*W.install_lexical_container($BLOCK, $name, %cont_info, $descriptor,
+ my $cont := $*W.install_lexical_container($BLOCK, $name, %cont_info, $descriptor,
:state($*SCOPE eq 'state'));
+ # apply traits
+ for $<trait> -> $t {
+ $*W.ex-handle($t, { ($t.ast)($cont, :SYMBOL($name)) });
+ }
+
# Set scope and type on container, and if needed emit code to
# reify a generic type.
if $past.isa(QAST::Var) {
diff --git a/src/Perl6/World.pm b/src/Perl6/World.pm
index 1176b91..dfe17c1 100644
--- a/src/Perl6/World.pm
+++ b/src/Perl6/World.pm
@@ -444,7 +444,7 @@ class Perl6::World is HLL::World {
my $slp := self.get_static_lexpad($block);
$slp.add_static_value(~$name, $cont, 1, ($state ?? 1 !! 0));
- 1;
+ $cont;
}
# Builds PAST that constructs a container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment