Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix @x is copy for non-flatteny arguments
  • Loading branch information
sorear committed Jul 7, 2011
1 parent 739ab2f commit bad54f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
12 changes: 5 additions & 7 deletions lib/Kernel.cs
Expand Up @@ -718,7 +718,6 @@ public class SubInfo {

// Value binding
public const int SIG_F_READWRITE = 2;
public const int SIG_F_COPY = 4;
public const int SIG_F_RWTRANS = 8;
public const int SIG_F_BINDLIST = 16;
public const int SIG_F_INVOCANT = 8192;
Expand Down Expand Up @@ -902,15 +901,14 @@ public class SubInfo {
gotit:
if ((flags & SIG_F_RWTRANS) != 0) {
} else if ((flags & SIG_F_IS_COPY) != 0) {
Variable nvar;
if ((flags & SIG_F_IS_HASH) != 0)
nvar = Kernel.CreateHash();
src = Kernel.Assign(Kernel.CreateHash(),
Kernel.NewRWListVar(src.Fetch()));
else if ((flags & SIG_F_IS_LIST) != 0)
nvar = Kernel.CreateArray();
src = Kernel.Assign(Kernel.CreateArray(),
Kernel.NewRWListVar(src.Fetch()));
else
nvar = Kernel.NewTypedScalar(type);

src = Kernel.Assign(nvar, src);
src = Kernel.Assign(Kernel.NewTypedScalar(type), src);
} else {
bool islist = ((flags & SIG_F_BINDLIST) != 0);
bool rw = ((flags & SIG_F_READWRITE) != 0) && !islist;
Expand Down
11 changes: 11 additions & 0 deletions test2.pl
Expand Up @@ -169,6 +169,17 @@
is_approx 1i ** 4, 1, "1i ** 4 is 1";
}

{
"x" ~~ /./;
$/.perl; # regression; failure mode was infinite loop
my $x = 1;
2 R+= $x;
is $x, 3, 'R+= works';

sub foo(@y is copy) { +@y }
is foo([1,2,4]), 3, '@y is copy works with non-flatteny values';
}

#is $?ORIG.substr(0,5), '# vim', '$?ORIG works';

# {
Expand Down

0 comments on commit bad54f1

Please sign in to comment.