Skip to content

Compiled templates have incorrect line numbers for IF statements #306

@petdance

Description

@petdance

The line numbers in the compiled cache files aren't correct.

For this template:

[% x = 3 %]
[% y = 3 %]
[% IF x == y %]
    blah blah
[% END %]

the relevant part of the compiled Perl code is:

    eval { BLOCK: {
#line 1 "./sample.ttml"
$stash->set('x', 3);
$output .=  '
';
#line 2 "./sample.ttml"
$stash->set('y', 3);
$output .=  '
';
#line 5 "./sample.ttml"
if ($stash->get('x') eq $stash->get('y')) {
$output .=  '
    blah blah
';
}

It shows that the IF statement is on line 5, which is actually the line number of the end of the IF block.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions