[Parrot-users] Documentation Issue
John Rizzo
johnrizzo1 at gmail.com
Wed Jan 18 12:13:55 UTC 2012
When I was trying to walk through the examples for implementing the
instructional language squaak I ran into an error.
Symbol '$S0' not predeclared in statement:sym<try>
If I change the method statement:sym<try> where it declares $pir to use "'"
characters intead of '"' characters for the quote it works. I didn't see
anywhere I could submit a patch or open a bug so I'm hoping someone can
update the doc for the next person who walks through them. My working
version is as follows;
method statement:sym<try>($/) {
## get the try block
my $try := $<try>.ast;
## create a new PAST::Stmts node for
## the catch block; note that no
## PAST::Block is created, as this
## currently has problems with the
## exception object. For now this will
## do.
my $catch := PAST::Stmts.new( :node($/) );
$catch.push($<catch>.ast);
## get the exception identifier;
## set a declaration flag, the scope,
## and clear the viviself attribute.
my $exc := $<exception>.ast;
$exc.isdecl(1);
$exc.scope('lexical');
$exc.viviself(0);
## generate instruction to retrieve the exception object (and the
## exception message, that is passed automatically in PIR, this is stored
## into $S0 (but not used).
my $pir := ' .get_results (%r, $S0)\n'
~ " store_lex '" ~ $exc.name()
~ "', %r";
$catch.unshift( PAST::Op.new( :inline($pir), :node($/) ) );
## do the declaration of the exception object as a lexical here:
$catch.unshift( $exc );
make PAST::Op.new( $try, $catch, :pasttype('try'), :node($/) );
}
It may be the case that I'm doing something wrong and it should in fact not
be changed. If so please let me know so I can figure out what I'm doing.
Thanks
John Rizzo
johnrizzo1 at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.parrot.org/pipermail/parrot-users/attachments/20120118/ab8e08d9/attachment.html>
More information about the Parrot-users
mailing list