Skip to content

Instantly share code, notes, and snippets.

@jnthn
Created October 23, 2011 18:51
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 jnthn/1307705 to your computer and use it in GitHub Desktop.
Save jnthn/1307705 to your computer and use it in GitHub Desktop.
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm
index b6188d5..d6f8836 100644
--- a/src/Perl6/Actions.pm
+++ b/src/Perl6/Actions.pm
@@ -3247,7 +3247,10 @@ class Perl6::Actions is HLL::Actions {
method postcircumfix:sym<[ ]>($/) {
my $past := PAST::Op.new( :name('postcircumfix:<[ ]>'), :pasttype('callmethod'), :node($/) );
- if $<semilist><statement> { $past.push($<semilist>.ast); }
+ if $<semilist><statement> {
+ my $slast := $<semilist>.ast;
+ $past.push(+@($slast) == 1 && $slast[0]<boxable_native> ?? $slast[0][2] !! $slast);
+ }
make $past;
}
diff --git a/src/Perl6/Optimizer.pm b/src/Perl6/Optimizer.pm
index 6664705..bd592ad 100644
--- a/src/Perl6/Optimizer.pm
+++ b/src/Perl6/Optimizer.pm
@@ -280,7 +280,7 @@ class Perl6::Optimizer {
my $i := 0;
while $i < +@($node) {
my $visit := $node[$i];
- unless pir::isa($visit, 'String') || pir::isa($visit, 'Integer') {
+ unless pir::isa($visit, 'String') || pir::isa($visit, 'Integer') || pir::isa($visit, 'Float') {
if $visit.isa(PAST::Op) {
$node[$i] := self.visit_op($visit)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment