Skip to content

Commit 92b440c

Browse files
authored
flatten set_clause_list and set_target_list (#21)
* change(tree-sitter module): flatten set_clause_list * change(tree-sitter module): flatten set_target_list
1 parent beac322 commit 92b440c

File tree

1 file changed

+21
-1
lines changed
  • crates/postgresql-cst-parser/src/tree_sitter

1 file changed

+21
-1
lines changed

crates/postgresql-cst-parser/src/tree_sitter/convert.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ fn walk_and_build(
149149
| SyntaxKind::qualified_name_list
150150
| SyntaxKind::for_locking_items
151151
| SyntaxKind::cte_list
152-
| SyntaxKind::name_list) => {
152+
| SyntaxKind::name_list
153+
| SyntaxKind::set_clause_list
154+
| SyntaxKind::set_target_list) => {
153155
if parent_kind == child_kind {
154156
// [Node: Flatten]
155157
//
@@ -446,5 +448,23 @@ FROM
446448

447449
assert_no_direct_nested_kind(&new_root, SyntaxKind::name_list);
448450
}
451+
452+
#[test]
453+
fn no_nested_set_clause_list() {
454+
let input = "update t set a = 1, b = 2, c = 3;";
455+
let root = cst::parse(input).unwrap();
456+
let (new_root, _) = get_ts_tree_and_range_map(&input, &root);
457+
458+
assert_no_direct_nested_kind(&new_root, SyntaxKind::set_clause_list);
459+
}
460+
461+
#[test]
462+
fn no_nested_set_target_list() {
463+
let input = "update t set (a, b, c) = (1, 2, 3) where id = 1;";
464+
let root = cst::parse(input).unwrap();
465+
let (new_root, _) = get_ts_tree_and_range_map(&input, &root);
466+
467+
assert_no_direct_nested_kind(&new_root, SyntaxKind::set_target_list);
468+
}
449469
}
450470
}

0 commit comments

Comments
 (0)