mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Ruby: Add up/downgrade scripts (sigh)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
class TAstNodeParent = @file or @erb_ast_node;
|
||||
|
||||
abstract class AstNodeParent extends TAstNodeParent {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class AstNode extends AstNodeParent, @erb_ast_node { }
|
||||
|
||||
class File extends AstNodeParent, @file { }
|
||||
|
||||
class Location extends @location_default {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
predicate hasFileParent(
|
||||
AstNode n, File f, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
exists(Location loc |
|
||||
not erb_ast_node_parent(n, _, _) and
|
||||
erb_ast_node_location(n, loc) and
|
||||
locations_default(loc, f, startline, startcolumn, endline, endcolumn)
|
||||
)
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
predicate hasFileParent(AstNode n, File f, int i) {
|
||||
n =
|
||||
rank[i + 1](AstNode n0, int startline, int startcolumn, int endline, int endcolumn |
|
||||
hasFileParent(n0, f, startline, startcolumn, endline, endcolumn)
|
||||
|
|
||||
n0 order by startline, startcolumn, endline, endcolumn
|
||||
)
|
||||
}
|
||||
|
||||
from AstNode n, AstNodeParent parent, int i, Location location
|
||||
where
|
||||
erb_ast_node_location(n, location) and
|
||||
(
|
||||
erb_ast_node_parent(n, parent, i)
|
||||
or
|
||||
hasFileParent(n, parent, i)
|
||||
)
|
||||
select n, parent, i, location
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
||||
class TAstNodeParent = @file or @ruby_ast_node;
|
||||
|
||||
abstract class AstNodeParent extends TAstNodeParent {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class AstNode extends AstNodeParent, @ruby_ast_node { }
|
||||
|
||||
class File extends AstNodeParent, @file { }
|
||||
|
||||
class Location extends @location_default {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
predicate hasFileParent(
|
||||
AstNode n, File f, int startline, int startcolumn, int endline, int endcolumn
|
||||
) {
|
||||
exists(Location loc |
|
||||
not ruby_ast_node_parent(n, _, _) and
|
||||
ruby_ast_node_location(n, loc) and
|
||||
locations_default(loc, f, startline, startcolumn, endline, endcolumn)
|
||||
)
|
||||
}
|
||||
|
||||
pragma[nomagic]
|
||||
predicate hasFileParent(AstNode n, File f, int i) {
|
||||
n =
|
||||
rank[i + 1](AstNode n0, int startline, int startcolumn, int endline, int endcolumn |
|
||||
hasFileParent(n0, f, startline, startcolumn, endline, endcolumn)
|
||||
|
|
||||
n0 order by startline, startcolumn, endline, endcolumn
|
||||
)
|
||||
}
|
||||
|
||||
from AstNode n, AstNodeParent parent, int i, Location location
|
||||
where
|
||||
ruby_ast_node_location(n, location) and
|
||||
(
|
||||
ruby_ast_node_parent(n, parent, i)
|
||||
or
|
||||
hasFileParent(n, parent, i)
|
||||
)
|
||||
select n, parent, i, location
|
||||
@@ -0,0 +1,8 @@
|
||||
description: Merge `ruby_ast_node_location` and `ruby_ast_node_parent` into `ruby_ast_node_info` (and same for `erb`)
|
||||
compatibility: backwards
|
||||
erb_ast_node_info.rel: run erb_ast_node_info.qlo
|
||||
erb_ast_node_location.rel: delete
|
||||
erb_ast_node_parent.rel: delete
|
||||
ruby_ast_node_info.rel: run ruby_ast_node_info.qlo
|
||||
ruby_ast_node_location.rel: delete
|
||||
ruby_ast_node_parent.rel: delete
|
||||
@@ -0,0 +1,11 @@
|
||||
class AstNode extends @erb_ast_node {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class Location extends @location_default {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
from AstNode n, Location location
|
||||
where erb_ast_node_info(n, _, _, location)
|
||||
select n, location
|
||||
@@ -0,0 +1,7 @@
|
||||
class AstNode extends @erb_ast_node {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
from AstNode n, int i, AstNode parent
|
||||
where erb_ast_node_info(n, parent, i, _)
|
||||
select n, parent, i
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
class AstNode extends @ruby_ast_node {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class Location extends @location_default {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
from AstNode n, Location location
|
||||
where ruby_ast_node_info(n, _, _, location)
|
||||
select n, location
|
||||
@@ -0,0 +1,7 @@
|
||||
class AstNode extends @ruby_ast_node {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
from AstNode n, int i, AstNode parent
|
||||
where ruby_ast_node_info(n, parent, i, _)
|
||||
select n, parent, i
|
||||
@@ -0,0 +1,8 @@
|
||||
description: Split up `ruby_ast_node_info` into `ruby_ast_node_location` and `ruby_ast_node_parent` (and same for `erb`)
|
||||
compatibility: backwards
|
||||
erb_ast_node_location.rel: run erb_ast_node_location.qlo
|
||||
erb_ast_node_parent.rel: run erb_ast_node_parent.qlo
|
||||
erb_ast_node_info.rel: delete
|
||||
ruby_ast_node_location.rel: run ruby_ast_node_location.qlo
|
||||
ruby_ast_node_parent.rel: run ruby_ast_node_parent.qlo
|
||||
ruby_ast_node_info.rel: delete
|
||||
Reference in New Issue
Block a user