Skip to content

Commit f08d52a

Browse files
authored
flatten for_locking_items (#15)
* flatten for_locking_items * flatten qualified_name_list
1 parent ec3c52f commit f08d52a

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

  • crates/postgresql-cst-parser/src/tree_sitter

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ fn walk_and_build(
145145
| SyntaxKind::func_arg_list
146146
| SyntaxKind::when_clause_list
147147
| SyntaxKind::group_by_list
148-
| SyntaxKind::sortby_list) => {
148+
| SyntaxKind::sortby_list
149+
| SyntaxKind::qualified_name_list
150+
| SyntaxKind::for_locking_items) => {
149151
if parent_kind == child_kind {
150152
// [Node: Flatten]
151153
//
@@ -373,5 +375,23 @@ FROM
373375

374376
assert_no_direct_nested_kind(&new_root, SyntaxKind::group_by_list);
375377
}
378+
379+
#[test]
380+
fn no_nested_for_locking_items() {
381+
let input = "select * from t1, t2 for update of t1 for update of t2;";
382+
let root = cst::parse(input).unwrap();
383+
let (new_root, _) = get_ts_tree_and_range_map(&input, &root);
384+
385+
assert_no_direct_nested_kind(&new_root, SyntaxKind::for_locking_items);
386+
}
387+
388+
#[test]
389+
fn no_nested_qualified_name_list() {
390+
let input = "select a from t for update of t.a, t.b;";
391+
let root = cst::parse(input).unwrap();
392+
let (new_root, _) = get_ts_tree_and_range_map(&input, &root);
393+
394+
assert_no_direct_nested_kind(&new_root, SyntaxKind::qualified_name_list);
395+
}
376396
}
377397
}

0 commit comments

Comments
 (0)