mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-14 23:22:54 +00:00
fix: update Swift queries and tests for tree-sitter-swift 0.7.1
- Fix assignment query: tree-sitter-swift 0.7.1 uses named fields (target:/result:/suffix:) instead of positional children - Update export detection tests: Swift `internal` (default) is now correctly treated as exported (module-scoped visibility) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
90c9153ccc
commit
712598a055
2 changed files with 11 additions and 10 deletions
|
|
@ -911,13 +911,14 @@ export const SWIFT_QUERIES = `
|
|||
(class_declaration "extension" name: (user_type (type_identifier) @heritage.class)
|
||||
(inheritance_specifier inherits_from: (user_type (type_identifier) @heritage.extends))) @heritage
|
||||
|
||||
; Write access: obj.field = value
|
||||
; Write access: obj.field = value (tree-sitter-swift 0.7.1 uses named fields)
|
||||
(assignment
|
||||
(directly_assignable_expression
|
||||
(_) @assignment.receiver
|
||||
(navigation_suffix
|
||||
(simple_identifier) @assignment.property))
|
||||
(_)) @assignment
|
||||
target: (directly_assignable_expression
|
||||
(navigation_expression
|
||||
target: (_) @assignment.receiver
|
||||
suffix: (navigation_suffix
|
||||
suffix: (simple_identifier) @assignment.property)))
|
||||
result: (_)) @assignment
|
||||
|
||||
`;
|
||||
|
||||
|
|
|
|||
|
|
@ -163,10 +163,10 @@ describe('parsing', () => {
|
|||
expect(isNodeExported(nameNode, 'doStuff', 'swift')).toBe(true);
|
||||
});
|
||||
|
||||
it('non-public function is not exported', () => {
|
||||
it('non-public (internal) function is exported (Swift default is module-scoped)', () => {
|
||||
const fnDecl = mockNode('function_declaration', 'func helper() {}');
|
||||
const nameNode = mockNode('identifier', 'helper', fnDecl);
|
||||
expect(isNodeExported(nameNode, 'helper', 'swift')).toBe(false);
|
||||
expect(isNodeExported(nameNode, 'helper', 'swift')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -660,10 +660,10 @@ describe('parsing', () => {
|
|||
|
||||
// Swift edge cases
|
||||
describe('swift edge cases', () => {
|
||||
it('internal function is not exported (Swift default)', () => {
|
||||
it('internal function is exported (Swift internal = module-scoped visibility)', () => {
|
||||
const visMod = mockNode('visibility_modifier', 'internal');
|
||||
const nameNode = mockNode('identifier', 'setup', visMod);
|
||||
expect(isNodeExported(nameNode, 'setup', 'swift')).toBe(false);
|
||||
expect(isNodeExported(nameNode, 'setup', 'swift')).toBe(true);
|
||||
});
|
||||
|
||||
it('private function is not exported', () => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue