Author: leo
Date: Wed May 4 01:03:15 2005
New Revision: 7972
Modified:
trunk/imcc/docs/calling_conventions.pod
trunk/imcc/t/syn/pcc.t
Log:
[perl #35195] [PATCH] @MAIN defined twice - behavior documented and tested
i couldn't find documentation on the behavior of IMCC if the @MAIN
subpragma was defined on more than one subroutine, so i modified the
documentation to reflect the system behavior, and provided a test.
BTW the system runs the last subroutine marked as @MAIN.
Courtesy of Jerry Gay <[EMAIL PROTECTED]>
Modified: trunk/imcc/docs/calling_conventions.pod
==============================================================================
--- trunk/imcc/docs/calling_conventions.pod (original)
+++ trunk/imcc/docs/calling_conventions.pod Wed May 4 01:03:15 2005
@@ -101,7 +101,8 @@
=item * @MAIN
-Define "main" entry point to start execution.
+Define "main" entry point to start execution. If multiple subroutines
+are marked as B<@MAIN>, the B<last> marked subroutine is entered.
=item * @LOAD
Modified: trunk/imcc/t/syn/pcc.t
==============================================================================
--- trunk/imcc/t/syn/pcc.t (original)
+++ trunk/imcc/t/syn/pcc.t Wed May 4 01:03:15 2005
@@ -3,7 +3,7 @@
# $Id$
use strict;
-use Parrot::Test tests => 42;
+use Parrot::Test tests => 43;
##############################
# Parrot Calling Conventions
@@ -1242,7 +1242,7 @@
# The result of the code should depend on whether we run parrot with the
# "-o code.pbc -r -r" command line params.
# Strangely, the same output is written
- my $output = $ENV{TEST_PROG_ARGS} =~ m/-r / ?
+ my $output = ($ENV{TEST_PROG_ARGS} || '') =~ m/-r / ?
qq{ok\n} :
qq{ok\n};
pir_output_is(<<'CODE', $output, "more pragmas, syntax only");
@@ -1531,3 +1531,22 @@
CODE
ok 1
OUT
+
+
+pir_output_is(<<'CODE', <<'OUT', "[EMAIL PROTECTED] defined twice");
+.sub foo @MAIN
+ set S0, 'not ok'
+ print S0
+ print "\r\n"
+ end
+.end
+
+.sub bar @MAIN
+ set S0, 'ok'
+ print S0
+ print "\r\n"
+ end
+.end
+CODE
+ok
+OUT