New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The return value of an an empty block, when evaluated, produces an error #158
Comments
From @masakA "Null PMC access" is produced when evaluating the return value from $ cat undef.pl $ cat nothing.pl $ patch -p0 < empty-block.patch ; make perl6 $ ./perl6 nothing.pl $ |
From @masakempty-block.patchIndex: src/parser/actions.pm
===================================================================
--- src/parser/actions.pm (revision 29090)
+++ src/parser/actions.pm (working copy)
@@ -73,6 +73,18 @@
for $<statement> {
$past.push( $($_) );
}
+ my $num_statements := +@($<statement>);
+ if $num_statements == 1 {
+ $past.push( PAST::Op.new(
+ :pasttype('callmethod'),
+ :name('new'),
+ :node($/),
+ PAST::Var.new(
+ :name('Failure'),
+ :scope('package')
+ )
+ ));
+ }
make $past;
}
|
@pmichaud - Status changed from 'new' to 'open' |
From @moritzCarl MXXsak (via RT) wrote:
Thank you for your patch, but it produces a lot of test failures So the patch needs more work, but I don't feel competent enough for that Cheers, -- |
From @bacekThis patch is slightly better, but it still causes problem with code diff --git a/languages/perl6/src/parser/actions.pm |
From @pmichaudNow fixed in r29135. The patches contributed in the ticket put the logic at "too low a level" The r29135 patch adds a return value as part of <routine_declarator>, Also, we should probably start avoiding the C<< new "Failure" >> meme Thanks for the bug report and patches! Pm |
@pmichaud - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#56640 (status was 'resolved')
Searchable as RT56640$
The text was updated successfully, but these errors were encountered: