Author: petdance
Date: Sun Dec 28 22:38:18 2008
New Revision: 34555
Modified:
trunk/lib/Parrot/Pmc2c/PMC/RO.pm
trunk/lib/Parrot/Pmc2c/PMC/Ref.pm
trunk/lib/Parrot/Pmc2c/PMC/default.pm
trunk/lib/Parrot/Pmc2c/PMC/deleg_pmc.pm
trunk/lib/Parrot/Pmc2c/UtilFunctions.pm
Log:
renamed gen_ret() to return_statement()
Modified: trunk/lib/Parrot/Pmc2c/PMC/RO.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMC/RO.pm (original)
+++ trunk/lib/Parrot/Pmc2c/PMC/RO.pm Sun Dec 28 22:38:18 2008
@@ -28,8 +28,7 @@
use Parrot::Pmc2c::Emitter ();
use Parrot::Pmc2c::PMCEmitter ();
use Parrot::Pmc2c::Method ();
-use Parrot::Pmc2c::UtilFunctions
- qw( gen_ret dont_edit count_newlines dynext_load_code c_code_coda );
+use Parrot::Pmc2c::UtilFunctions qw( return_statement );
use Text::Balanced 'extract_bracketed';
=item C<make_RO($type)>
@@ -97,6 +96,8 @@
$self->add_method($ro_method);
}
elsif ( $parent->vtable_method_does_write($vt_method_name) ) {
+ # All parameters passed in are shims, because we're
+ # creating an exception-thrower.
my @parameters = split( /\s*,\s*/, $vt_method->parameters );
@parameters = map { "SHIM($_)" } @parameters;
@@ -110,7 +111,7 @@
}
);
my $pmcname = $parent->name;
- my $ret = gen_ret($ro_method);
+ my $ret = return_statement($ro_method);
my $body = <<EOC;
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_WRITE_TO_CONSTCLASS,
"$vt_method_name() in read-only instance of $pmcname");
Modified: trunk/lib/Parrot/Pmc2c/PMC/Ref.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMC/Ref.pm (original)
+++ trunk/lib/Parrot/Pmc2c/PMC/Ref.pm Sun Dec 28 22:38:18 2008
@@ -1,4 +1,4 @@
-# Copyright (C) 2007, The Perl Foundation.
+# Copyright (C) 2007-2008, The Perl Foundation.
# $Id$
=head1 Parrot::Pmc2c::Ref Instance Methods
@@ -11,7 +11,7 @@
use base 'Parrot::Pmc2c::PMC';
use strict;
use warnings;
-use Parrot::Pmc2c::UtilFunctions qw( gen_ret passable_args_from_parameter_list
);
+use Parrot::Pmc2c::UtilFunctions qw( return_statement
passable_args_from_parameter_list );
=item C<prederef($method)>
@@ -81,7 +81,7 @@
if ( $method->return_type ne 'void' ) {
$ret_def = $method->return_type . ' ret_val;';
$ret_assign = 'ret_val = ';
- $ret = gen_ret( $method, 'ret_val' );
+ $ret = return_statement( $method, 'ret_val' );
}
my $body = <<EOC;
$ret_def
Modified: trunk/lib/Parrot/Pmc2c/PMC/default.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMC/default.pm (original)
+++ trunk/lib/Parrot/Pmc2c/PMC/default.pm Sun Dec 28 22:38:18 2008
@@ -1,4 +1,4 @@
-# Copyright (C) 2007, The Perl Foundation.
+# Copyright (C) 2007-2008, The Perl Foundation.
# $Id$
=head1 Parrot::Pmc2c::PMC::default Instance Methods
@@ -10,7 +10,7 @@
package Parrot::Pmc2c::PMC::default;
use strict;
use warnings;
-use Parrot::Pmc2c::UtilFunctions qw( gen_ret );
+use Parrot::Pmc2c::UtilFunctions qw( return_statement );
use base qw( Parrot::Pmc2c::PMC );
=item C<pre_method_gen()>
@@ -33,7 +33,7 @@
}
);
- my $ret = gen_ret($method);
+ my $ret = return_statement($method);
$new_default_method->body( Parrot::Pmc2c::Emitter->text(<<"EOC") );
cant_do_method(interp, pmc, "$vt_method_name");
$ret
Modified: trunk/lib/Parrot/Pmc2c/PMC/deleg_pmc.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMC/deleg_pmc.pm (original)
+++ trunk/lib/Parrot/Pmc2c/PMC/deleg_pmc.pm Sun Dec 28 22:38:18 2008
@@ -1,12 +1,12 @@
package Parrot::Pmc2c::PMC::deleg_pmc;
-# Copyright (C) 2007, The Perl Foundation.
+# Copyright (C) 2007-2008, The Perl Foundation.
# $Id$
use base 'Parrot::Pmc2c::PMC';
use strict;
use warnings;
-use Parrot::Pmc2c::UtilFunctions qw( gen_ret passable_args_from_parameter_list
);
+use Parrot::Pmc2c::UtilFunctions qw( return_statement
passable_args_from_parameter_list );
=over 4
@@ -36,7 +36,7 @@
);
my $arg = passable_args_from_parameter_list( $method->parameters );
- my $ret = gen_ret( $method, "VTABLE_$vt_method_name(interp,
attr$arg)" );
+ my $ret = return_statement( $method, "VTABLE_$vt_method_name(interp,
attr$arg)" );
$new_method->body( Parrot::Pmc2c::Emitter->text(<<"EOC") );
PMC * const attr = get_attrib_num(PMC_data_typed(pmc, SLOTTYPE *), 0);
$ret
Modified: trunk/lib/Parrot/Pmc2c/UtilFunctions.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/UtilFunctions.pm (original)
+++ trunk/lib/Parrot/Pmc2c/UtilFunctions.pm Sun Dec 28 22:38:18 2008
@@ -5,7 +5,7 @@
use strict;
use warnings;
use base qw( Exporter );
-our @EXPORT_OK = qw( count_newlines gen_ret dont_edit dynext_load_code
+our @EXPORT_OK = qw( count_newlines return_statement dont_edit dynext_load_code
c_code_coda slurp spew splat open_file filename escape_filename
args_from_parameter_list
passable_args_from_parameter_list
@@ -84,7 +84,7 @@
EOC
}
-=item C<gen_ret($method, $body)>
+=item C<return_statement($method, $body)>
Generate the C code for a C<return> statement, if the body is empty then
make a cast if needed.
@@ -93,7 +93,7 @@
=cut
-sub gen_ret {
+sub return_statement {
my ( $method, $body ) = @_;
my $return_type = $method->return_type;