Skip to content

Instantly share code, notes, and snippets.

@lizmat
Created October 16, 2018 11:16
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 lizmat/7f82e393e3db53c6b570f3d50f629eae to your computer and use it in GitHub Desktop.
Save lizmat/7f82e393e3db53c6b570f3d50f629eae to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index 44f8b80..b080f99 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -3581,6 +3581,22 @@ class Perl6::Actions is HLL::Actions does STDActions {
elsif $<type_declarator> { make $<type_declarator>.ast }
elsif $<variable_declarator> {
my $past := $<variable_declarator>.ast;
+
+ # got a 'my $*FOO', need to convert back to just a Var
+ if nqp::istype($past,QAST::Op)
+ && $past.op eq 'call'
+ && $past.name eq '&DYNAMIC' {
+ my $name := $past[0][2].value;
+ $past := declare_variable(
+ $/,
+ QAST::Var.new(:$name),
+ nqp::substr($name,0,1), # sigil
+ nqp::substr($name,1,1), # twigil
+ nqp::substr($name,2), # desigilname
+ [], # <-- trait lists ??
+ );
+ }
+
if $<initializer> {
my $orig_past := $past;
my $initast := $<initializer>.ast;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment