| 1 | package Text::Nunjucks::Nodes::Set; | ||
| 2 | # ABSTRACT: AST node Set (fields targets, value), ported from nodes.js | ||
| 3 | |||
| 4 | 20 | our $VERSION = '0.001'; | |
| 5 | |||
| 6 | 20 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 20 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 20 | extends 'Text::Nunjucks::Nodes::Node'; | |
| 10 | |||
| 11 | # nodes.js: const Set = Node.extend('Set', { fields: ['targets', 'value'] }); | ||
| 12 | |||
| 13 | 20 | has targets => ( is => 'rw' ); | |
| 14 | 20 | has value => ( is => 'rw' ); | |
| 15 | |||
| 16 | # Set carries a non-field `body`. Upstream declares Set with fields | ||
| 17 | # {targets, value}, and the parser attaches a block-set's Capture to node.body | ||
| 18 | # dynamically (parser.js parseSet), which the compiler reads back | ||
| 19 | # (compiler.js compileSet). It is not a field(), so it never appears in the AST | ||
| 20 | # dump -- exactly the CallExtension.autoescape pattern: a real accessor that | ||
| 21 | # lives outside the field list. | ||
| 22 | 20 | has body => ( is => 'rw' ); | |
| 23 | |||
| 24 | 2886 | ▶ | sub typename { 'Set' } |
|
Subroutine
typename: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 25 | 16246 | ▶ | sub fields { [ 'targets', 'value' ] } |
|
Subroutine
fields: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 26 | |||
| 27 | 20 | 1; | |
| 28 | |||
| 29 | __END__ | ||