mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
Add upgrade script moving superclass exprs to own table
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
{ "provide": [ "ql/src/qlpack.yml",
|
||||
"ql/test/qlpack.yml",
|
||||
"ql/examples/qlpack.yml",
|
||||
"extractor-pack/codeql-extractor.yml"
|
||||
]
|
||||
}
|
||||
{
|
||||
"provide": [
|
||||
"ql/src/qlpack.yml",
|
||||
"ql/test/qlpack.yml",
|
||||
"ql/examples/qlpack.yml",
|
||||
"upgrades/qlpack.yml",
|
||||
"extractor-pack/codeql-extractor.yml"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
class Superclass extends @superclass {
|
||||
string toString() { result = "" }
|
||||
}
|
||||
|
||||
class Class extends @class {
|
||||
string toString() { result = "" }
|
||||
}
|
||||
|
||||
class ClassChildType extends @class_child_type {
|
||||
string toString() { result = "" }
|
||||
}
|
||||
|
||||
// Select all non-superclass children.
|
||||
// If the 0th child is a superclass, shuffle all the indexes down one. (Having
|
||||
// superclass children at other indexes is allowed in the old dbscheme, but
|
||||
// doesn't happen in practice, given the tree-sitter grammar).
|
||||
from Class c, int oldIndex, ClassChildType child, int newIndex
|
||||
where
|
||||
class_child(c, oldIndex, child) and
|
||||
(
|
||||
if exists(Superclass sc | class_child(c, 0, sc))
|
||||
then newIndex = oldIndex - 1
|
||||
else newIndex = oldIndex
|
||||
) and
|
||||
not child instanceof Superclass
|
||||
select c, newIndex, child
|
||||
@@ -0,0 +1,12 @@
|
||||
class Superclass extends @superclass {
|
||||
string toString() { result = "" }
|
||||
}
|
||||
|
||||
class Class extends @class {
|
||||
string toString() { result = "" }
|
||||
}
|
||||
|
||||
// Select the 0th child if it's a @superclass
|
||||
from Class c, Superclass sc
|
||||
where class_child(c, 0, sc)
|
||||
select c, sc
|
||||
1485
upgrades/5df84541a21ef20b2c8d7b73de0e4b9720c45642/old.dbscheme
Normal file
1485
upgrades/5df84541a21ef20b2c8d7b73de0e4b9720c45642/old.dbscheme
Normal file
File diff suppressed because it is too large
Load Diff
1490
upgrades/5df84541a21ef20b2c8d7b73de0e4b9720c45642/ruby.dbscheme
Normal file
1490
upgrades/5df84541a21ef20b2c8d7b73de0e4b9720c45642/ruby.dbscheme
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,4 @@
|
||||
description: moves class superclass nodes into their own table
|
||||
compatibility: full
|
||||
class_superclass.rel: run class_superclass.qlo
|
||||
class_child.rel: run class_child.qlo
|
||||
2
upgrades/qlpack.yml
Normal file
2
upgrades/qlpack.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
name: codeql-ruby-upgrades
|
||||
upgrades: .
|
||||
Reference in New Issue
Block a user