Permalink
Browse files

Don't lose namedness of arguments when inlining.

  • Loading branch information...
1 parent 0fdbf28 commit 14a88157da881822c02f4e09aea9f027aefc7a9b @jnthn jnthn committed Jul 31, 2012
Showing with 16 additions and 3 deletions.
  1. +16 −3 src/QAST/InlinePlaceholder.nqp
@@ -8,8 +8,21 @@ class QAST::InlinePlaceholder is QAST::Node {
}
method substitute_inline_placeholders(@fillers) {
- $!position < +@fillers
- ?? @fillers[$!position]
- !! nqp::die("Inline placeholder index out of range")
+ if $!position < +@fillers {
+ my $result := @fillers[$!position];
+ if self.named || self.flat {
+ $result := $result.shallow_clone();
+ if self.named -> $name {
+ $result.named($name);
+ }
+ if self.flat {
+ $result.flat(1);
+ }
+ }
+ $result
+ }
+ else {
+ nqp::die("Inline placeholder index out of range")
+ }
}
}

0 comments on commit 14a8815

Please sign in to comment.