Front page | perl.cvs.parrot |
Postings from January 2009
[svn:parrot] r35049 - trunk/compilers/pirc/src
From:
kjs
Date:
January 6, 2009 08:40
Subject:
[svn:parrot] r35049 - trunk/compilers/pirc/src
Message ID:
20090106164015.29423CB9F9@x12.develooper.com
Author: kjs
Date: Tue Jan 6 08:40:14 2009
New Revision: 35049
Modified:
trunk/compilers/pirc/src/pircompunit.c
trunk/compilers/pirc/src/pircompunit.h
trunk/compilers/pirc/src/pirpcc.c
Log:
[pirc] fix bits for method invocation.
Modified: trunk/compilers/pirc/src/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/src/pircompunit.c (original)
+++ trunk/compilers/pirc/src/pircompunit.c Tue Jan 6 08:40:14 2009
@@ -748,7 +748,7 @@
PARROT_ASSERT(last);
PARROT_ASSERT(newarg);
- newarg->next = last->next; /* arg2->next is last one, must point to first item */
+ newarg->next = last->next;
last->next = newarg;
last = newarg;
@@ -758,6 +758,36 @@
/*
=item C<void
+unshift_arg(argument *last, argument * const newarg)>
+
+Unshift argument C<newarg> in front of the list, pointed to by C<last>.
+Given this list:
+
+ A->B->C->D
+ ^
+
+A is the last one, B the first one. D points to A.
+After the unshift_arg() call, the list should look like:
+
+ A->X->B->C->D
+ ^
+
+Where X is the new argument. Basically, it's inserted in between
+A (last) and B (first), but the pointer to the "last" is not updated,
+so that A stays the last.
+
+=cut
+
+*/
+void
+unshift_arg(argument *last, argument * const newarg) {
+ newarg->next = last->next;
+ last->next = newarg;
+}
+
+/*
+
+=item C<void
set_arg_flag(argument * const arg, arg_flag flag)>
Set the flag C<flag> on argument C<arg>. Note the C<flag> may
Modified: trunk/compilers/pirc/src/pircompunit.h
==============================================================================
--- trunk/compilers/pirc/src/pircompunit.h (original)
+++ trunk/compilers/pirc/src/pircompunit.h Tue Jan 6 08:40:14 2009
@@ -417,6 +417,7 @@
/* functions for argument node creation and storing */
argument *new_argument(struct lexer_state * const lexer, expression * const expr);
argument *add_arg(argument *arg1, argument * const arg2);
+void unshift_arg(argument *last, argument * const newarg);
target *add_param(struct lexer_state * const lexer, pir_type type, char const * const name);
target *set_param_alias(struct lexer_state * const lexer, char const * const alias);
Modified: trunk/compilers/pirc/src/pirpcc.c
==============================================================================
--- trunk/compilers/pirc/src/pirpcc.c (original)
+++ trunk/compilers/pirc/src/pirpcc.c Tue Jan 6 08:40:14 2009
@@ -618,9 +618,10 @@
static void
convert_pcc_methodcall(lexer_state * const lexer, invocation * const inv) {
new_sub_instr(lexer, PARROT_OP_set_args_pc, "set_args_pc", inv->num_arguments);
- arguments_to_operands(lexer, inv->arguments, inv->num_arguments);
+
/* in a methodcall, the invocant object is passed as the first argument */
- unshift_operand(lexer, expr_from_target(lexer, inv->sub));
+ unshift_arg(inv->arguments, new_argument(lexer, expr_from_target(lexer, inv->sub)));
+ arguments_to_operands(lexer, inv->arguments, inv->num_arguments);
new_sub_instr(lexer, PARROT_OP_get_results_pc, "get_results_pc", inv->num_results);
targets_to_operands(lexer, inv->results, inv->num_results);
-
[svn:parrot] r35049 - trunk/compilers/pirc/src
by kjs