From 1f336b92560f73e02fdfa2b6de072f28bb4a83cb Mon Sep 17 00:00:00 2001 From: Taishi Naka Date: Thu, 27 Mar 2025 15:49:58 +0900 Subject: [PATCH] flatten sortby_list --- .../postgresql-cst-parser/src/tree_sitter/convert.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs index 304bdb8..bbacc72 100644 --- a/crates/postgresql-cst-parser/src/tree_sitter/convert.rs +++ b/crates/postgresql-cst-parser/src/tree_sitter/convert.rs @@ -143,7 +143,8 @@ fn walk_and_build( | SyntaxKind::indirection | SyntaxKind::expr_list | SyntaxKind::func_arg_list - | SyntaxKind::when_clause_list) => { + | SyntaxKind::when_clause_list + | SyntaxKind::sortby_list) => { if parent_kind == child_kind { // [Node: Flatten] // @@ -353,5 +354,14 @@ FROM assert_no_direct_nested_kind(&new_root, SyntaxKind::when_clause_list); } + + #[test] + fn no_nested_sortby_list() { + let input = "select * from t order by a, b, c;"; + let root = cst::parse(input).unwrap(); + let (new_root, _) = get_ts_tree_and_range_map(&input, &root); + + assert_no_direct_nested_kind(&new_root, SyntaxKind::sortby_list); + } } }