Skip to content

Commit 90984a0

Browse files
committed
Add spans to Function node with data from getIdentifer
Port of projectfluent/fluent.js#167.
1 parent 6e14e77 commit 90984a0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

fluent/syntax/parser.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,10 +530,11 @@ def get_selector_expression(self, ps):
530530
if not re.match('^[A-Z][A-Z_?-]*$', literal.id.name):
531531
raise ParseError('E0008')
532532

533-
return ast.CallExpression(
534-
ast.Function(literal.id.name),
535-
args
536-
)
533+
func = ast.Function(literal.id.name)
534+
if (self.with_spans):
535+
func.add_span(literal.span.start, literal.span.end)
536+
537+
return ast.CallExpression(func, args)
537538

538539
return literal
539540

0 commit comments

Comments
 (0)