Swift: add more tests for the generated parent-child relationship

This commit is contained in:
Paolo Tranquilli
2022-08-29 16:03:44 +02:00
parent 105c0d0dce
commit 20e94b8a38
6 changed files with 1347 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
import swift
import codeql.swift.generated.ParentChild
import TestUtils
from AstNode parent, AstNode child, int index, string accessor
where
toBeTested(parent) and
child = getImmediateChildAndAccessor(parent, index, accessor)
select parent, index, accessor, child

View File

@@ -0,0 +1,10 @@
import swift
private import codeql.swift.generated.ParentChild
from AstNode parent, int index, AstNode child1, AstNode child2
where
child1 != child2 and
child1 = getImmediateChildAndAccessor(parent, index, _) and
child2 = getImmediateChildAndAccessor(parent, index, _)
select parent, parent.getPrimaryQlClasses(), index, child1, child1.getPrimaryQlClasses(), child2,
child2.getPrimaryQlClasses()

View File

@@ -0,0 +1,9 @@
import swift
private import codeql.swift.generated.ParentChild
from AstNode parent, int index1, int index2, AstNode child
where
index1 != index2 and
child = getImmediateChildAndAccessor(parent, index1, _) and
child = getImmediateChildAndAccessor(parent, index2, _)
select parent, parent.getPrimaryQlClasses(), child, child.getPrimaryQlClasses(), index1, index2