Skip to content

Commit 9062bba

Browse files
committed
unified: get rid of undesirable self-recursion in _expression
This caused any field containing an _expression to appear as if it could countain any number of such nodes. It also threw away the information that there was a `?` marker there. To fix it, we simply move the definition into its own named node.
1 parent e709650 commit 9062bba

2 files changed

Lines changed: 76 additions & 72 deletions

File tree

unified/extractor/tree-sitter-swift/grammar.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,11 @@ module.exports = grammar({
521521
$.assignment,
522522
$.value_parameter_pack,
523523
$.value_pack_expansion,
524-
seq($._expression, alias($._immediate_quest, "?"))
524+
$.optional_chain_marker
525525
)
526526
),
527+
optional_chain_marker: ($) =>
528+
seq($._expression, alias($._immediate_quest, "?")),
527529
// Unary expressions
528530
_unary_expression: ($) =>
529531
choice(

0 commit comments

Comments
 (0)