unified: Unify more fields

Not entirely happy about the mixed nature of the `kind` filed (having
both tokens and the named node `throw_keyword` in there), but that's a
problem for a different time.
This commit is contained in:
Taus
2026-05-12 14:40:17 +00:00
parent bc96ae6e47
commit 5784ef22f6
2 changed files with 5 additions and 3 deletions

View File

@@ -1266,7 +1266,10 @@ module.exports = grammar({
),
control_transfer_statement: ($) =>
choice(
prec.right(PRECS.control_transfer, $._throw_statement),
prec.right(
PRECS.control_transfer,
seq(field("kind", $.throw_keyword), field("result", $.expression))
),
prec.right(
PRECS.control_transfer,
seq(

View File

@@ -220,8 +220,7 @@ named:
lambda*: lambda_literal
name*: simple_identifier
control_transfer_statement:
$children*: [expression, throw_keyword]
kind?: ["break", "continue", "return", "yield"]
kind: ["break", "continue", "return", throw_keyword, "yield"]
result?: expression
custom_operator:
default_keyword: