mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Swift: Fix key path numbering in upgrade and downgrade scripts
This commit is contained in:
@@ -19,14 +19,19 @@ class ValueDeclOrNone extends @value_decl_or_none {
|
||||
}
|
||||
|
||||
predicate isKeyPathComponentWithNewKind(KeyPathComponent id) {
|
||||
key_path_components(id, 3, _) or key_path_components(id, 4, _)
|
||||
key_path_components(id, 1, _) or key_path_components(id, 4, _)
|
||||
}
|
||||
|
||||
query predicate new_key_path_components(KeyPathComponent id, int kind, TypeOrNone component_type) {
|
||||
exists(int old_kind |
|
||||
key_path_components(id, old_kind, component_type) and
|
||||
not isKeyPathComponentWithNewKind(id) and
|
||||
if old_kind < 5 then kind = old_kind else kind = old_kind - 2
|
||||
if old_kind = 0
|
||||
then kind = old_kind
|
||||
else
|
||||
if old_kind = 2 or old_kind = 3
|
||||
then kind = old_kind - 1
|
||||
else kind = old_kind - 2
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,5 +9,10 @@ class TypeOrNone extends @type_or_none {
|
||||
from KeyPathComponent id, int kind, int new_kind, TypeOrNone component_type
|
||||
where
|
||||
key_path_components(id, kind, component_type) and
|
||||
if kind < 3 then new_kind = kind else new_kind = kind + 2
|
||||
if kind = 0
|
||||
then new_kind = kind
|
||||
else
|
||||
if kind = 1 or kind = 2
|
||||
then new_kind = kind + 1
|
||||
else new_kind = kind + 2
|
||||
select id, new_kind, component_type
|
||||
|
||||
Reference in New Issue
Block a user