Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Start giving statements an ID.
Also tag blocks pushed while compiling that statement with the ID.
Will be used for fixing various thunking scoping bugs.
  • Loading branch information
jnthn committed Apr 28, 2015
1 parent 4fafbe8 commit 5774ac0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Perl6/Actions.nqp
Expand Up @@ -862,6 +862,7 @@ Compilation unit '$file' contained the following violations:
$past
);
}
$past.annotate('statement_id', $*STATEMENT_ID) if $past;
make $past;
}

Expand Down
2 changes: 2 additions & 0 deletions src/Perl6/Grammar.nqp
Expand Up @@ -1038,6 +1038,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
:my $*POD_ANGLE_COUNT := 0; # pod stuff
:my $*IN_REGEX_ASSERTION := 0;
:my $*IN_PROTO := 0; # are we inside a proto?
:my $*NEXT_STATEMENT_ID := 0; # to give each statement an ID

# Various interesting scopes we'd like to keep to hand.
:my $*GLOBALish;
Expand Down Expand Up @@ -1364,6 +1365,7 @@ grammar Perl6::Grammar is HLL::Grammar does STD {
:my $*QSIGIL := '';
:my $*SCOPE := '';
:my $*ACTIONS := %*LANG<MAIN-actions>;
:my $*STATEMENT_ID := $*NEXT_STATEMENT_ID++;
<!before <[\])}]> | $ >
<!stopper>
<!!{ nqp::rebless($/.CURSOR, %*LANG<MAIN>) }>
Expand Down
3 changes: 2 additions & 1 deletion src/Perl6/World.nqp
Expand Up @@ -244,11 +244,12 @@ class Perl6::World is HLL::World {

# Creates a new lexical scope and puts it on top of the stack.
method push_lexpad($/) {
# Create pad, link to outer and add to stack.
# Create pad, link to outer, annotate with creating statement, and add to stack.
my $pad := QAST::Block.new( QAST::Stmts.new( :node($/) ) );
if +@!BLOCKS {
$pad.annotate('outer', @!BLOCKS[+@!BLOCKS - 1]);
}
$pad.annotate('statement_id', $*STATEMENT_ID);
@!BLOCKS[+@!BLOCKS] := $pad;
$pad
}
Expand Down

0 comments on commit 5774ac0

Please sign in to comment.