mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Swift: Add up and downgrade scripts.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// Change the second column in named_patterns from a @var_decl to a string
|
||||
class NamedPattern extends @named_pattern {
|
||||
VarDecl getVarDecl() { named_patterns(this, result) }
|
||||
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class VarDecl extends @var_decl {
|
||||
string getName() { var_decls(this, result, _) }
|
||||
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
from NamedPattern np, VarDecl d, string name
|
||||
where d = np.getVarDecl() and name = d.getName()
|
||||
select np, name
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
description: change the second column in named_patterns to a string
|
||||
compatibility: full
|
||||
|
||||
named_patterns.rel: run named_patterns.ql
|
||||
@@ -0,0 +1,43 @@
|
||||
// Change the second column in named_patterns from a string a @var_decl using the same logic that used to be in the Swift QL libraries
|
||||
class Pattern extends @pattern {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class NamedPattern extends @named_pattern {
|
||||
string getName() { named_patterns(this, result) }
|
||||
|
||||
VarDecl getVarDecl() {
|
||||
this.getImmediateEnclosingPattern*() = result.getImmediateParentPattern() and
|
||||
pragma[only_bind_out](result.getName()) = pragma[only_bind_out](this.getName())
|
||||
}
|
||||
|
||||
Pattern getImmediateEnclosingPattern() {
|
||||
enum_element_pattern_sub_patterns(result, this)
|
||||
or
|
||||
optional_some_patterns(result, this)
|
||||
or
|
||||
tuple_pattern_elements(result, _, this)
|
||||
or
|
||||
binding_patterns(result, this)
|
||||
or
|
||||
is_pattern_sub_patterns(result, this)
|
||||
or
|
||||
paren_patterns(result, this)
|
||||
or
|
||||
typed_patterns(result, this)
|
||||
}
|
||||
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class VarDecl extends @var_decl {
|
||||
string getName() { var_decls(this, result, _) }
|
||||
|
||||
Pattern getImmediateParentPattern() { var_decl_parent_patterns(this, result) }
|
||||
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
from NamedPattern np, string name, VarDecl varDecl
|
||||
where np.getName() = name and varDecl = np.getVarDecl()
|
||||
select np, varDecl
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
description: change the second column in named_patterns to a var_decl
|
||||
compatibility: partial
|
||||
|
||||
named_patterns.rel: run named_patterns.ql
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
description: update named_patterns table
|
||||
compatibility: partial
|
||||
Reference in New Issue
Block a user