Skip to content

Instantly share code, notes, and snippets.

@MasterDuke17
Created April 13, 2019 21:47
Show Gist options
  • Save MasterDuke17/60a7a8b9f3ee1a5d2ebacaed361de85f to your computer and use it in GitHub Desktop.
Save MasterDuke17/60a7a8b9f3ee1a5d2ebacaed361de85f to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Actions.nqp b/src/Perl6/Actions.nqp
index 17479d64e..9576f0fa1 100644
--- a/src/Perl6/Actions.nqp
+++ b/src/Perl6/Actions.nqp
@@ -2785,12 +2785,16 @@ class Perl6::Actions is HLL::Actions does STDActions {
method variable($/) {
my $past;
if $<index> {
+ my $val := nqp::radix_I(10, $<index>, 0, 0, $*W.find_symbol(['Int']))[0];
$past := QAST::Op.new(
:op('call'),
:name('&postcircumfix:<[ ]>'),
QAST::Var.new(:name('$/'), :scope('lexical')),
- $*W.add_constant('Int', 'int', nqp::radix(10, $<index>, 0, 0)[0]),
+ QAST::WVal.new( :value($val) ),
);
+ if nqp::isnull(nqp::getobjsc($val)) {
+ $*W.add_object_if_no_sc($val);
+ }
if $<sigil> eq '@' || $<sigil> eq '%' {
my $name := $<sigil> eq '@' ?? 'list' !! 'hash';
$past := QAST::Op.new( :op('callmethod'), :name($name), $past );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment