Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adjust to the post GLR world
  • Loading branch information
niner committed Sep 4, 2015
1 parent b0b56fc commit 9a4e8b0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions lib/Inline/Perl5.pm6
Expand Up @@ -475,13 +475,13 @@ method !unpack_return_values($av) {
}

method call(Str $function, *@args, *%args) {
my $av = p5_call_function($!p5, $function, |self!setup_arguments([@args.list, %args.list]));
my $av = p5_call_function($!p5, $function, |self!setup_arguments([flat @args, %args.list]));
self.handle_p5_exception();
self!unpack_return_values($av);
}

multi method invoke(Str $package, Str $function, *@args, *%args) {
my $av = p5_call_package_method($!p5, $package, $function, |self!setup_arguments([@args.list, %args.list]));
my $av = p5_call_package_method($!p5, $package, $function, |self!setup_arguments([flat @args.list, %args.list]));
self.handle_p5_exception();
self!unpack_return_values($av);
}
Expand All @@ -491,7 +491,7 @@ multi method invoke(OpaquePointer $obj, Str $function, *@args) {
}

method invoke-parent(Str $package, OpaquePointer $obj, Bool $context, Str $function, *@args, *%args) {
my $av = p5_call_method($!p5, $package, $obj, $context ?? 1 !! 0, $function, |self!setup_arguments([@args.list, %args.list]));
my $av = p5_call_method($!p5, $package, $obj, $context ?? 1 !! 0, $function, |self!setup_arguments([flat @args.list, %args.list]));
self.handle_p5_exception();
self!unpack_return_values($av);
}
Expand Down Expand Up @@ -756,7 +756,7 @@ role Perl5Package[Inline::Perl5 $p5, Str $module] {
multi method FALLBACK($name, @args, %kwargs) {
return self.defined
?? $p5.invoke-parent($module, $!parent.ptr, False, $name, $!parent, |@args, |%kwargs)
!! $p5.invoke($module, $name, |@args, |%kwargs);
!! $p5.invoke($module, $name, |@args.list, |%kwargs);
}

for Any.^methods>>.name.list, <say> -> $name {
Expand Down Expand Up @@ -835,7 +835,7 @@ method require(Str $module, Num $version?) {
return EnumMap.new(self.import($module, @args.list).map({
my $name = $_;
'&' ~ $name => sub (*@args, *%args) {
self.call("{$module}::$name", @args.list, %args.list);
self.call("{$module}::$name", |@args.list, %args.list);
}
}));
};
Expand Down
2 changes: 1 addition & 1 deletion t/call.t
Expand Up @@ -154,7 +154,7 @@ else {
say "not ok 10 - Any converted to undef";
}

if ($p5.call('test_hash', 'main', {a => 2, b => {c => [4, 3]}}) == 1) {
if ($p5.call('test_hash', 'main', $({a => 2, b => {c => [4, 3]}})) == 1) {
say "ok 11 - Passing hashes to Perl 5";
}
else {
Expand Down
2 changes: 1 addition & 1 deletion t/callables.t
Expand Up @@ -42,7 +42,7 @@ is $p5.call('call_something', &something, 6), 'Perl 6';
is $p5.call('return_code', 'Perl')(5), 'Perl 5';
my $sub = $p5.call('return_code', 'Foo');
is $p5.call('call_something', $sub, 1), 'Foo 1';
is($p5.call('return_array_checker')([1, 2, 3]), 3);
is($p5.call('return_array_checker')([1, 2, 3].item), 3);
my &callable := $p5.call('return_code', 'Foo');

# vim: ft=perl6
4 changes: 2 additions & 2 deletions t/use.t
Expand Up @@ -15,9 +15,9 @@ BEGIN {
$p5.use('Data::Dumper');
}

my $dumper = Data::Dumper.new([1, 2]);
my $dumper = Data::Dumper.new([1, 2].item);
Test::More::is($dumper.Dump.Str, "\$VAR1 = 1;\n \$VAR2 = 2;\n", 'constructor works');
Test::More::is(Data::Dumper.Dump([1, 2]).Str, "\$VAR1 = 1;\n \$VAR2 = 2;\n", 'package methods work');
Test::More::is(Data::Dumper.Dump([1, 2].item).Str, "\$VAR1 = 1;\n \$VAR2 = 2;\n", 'package methods work');

# Should be safe to load a module more than once.
$p5.use('Test::More');
Expand Down

0 comments on commit 9a4e8b0

Please sign in to comment.