mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Add DB upgrade script to change generic type names to undecorated ones
This commit is contained in:
@@ -56,7 +56,7 @@ private predicate isObjectClass(Class c) { c instanceof ObjectType }
|
||||
*/
|
||||
class ValueOrRefType extends DotNet::ValueOrRefType, Type, Attributable, @value_or_ref_type {
|
||||
/**
|
||||
* DEPRECATED: use `getUndecoratedName()` instead
|
||||
* DEPRECATED: use `getUndecoratedName()` instead.
|
||||
*
|
||||
* Gets the name of this type without `<...>` brackets, in case it is a generic type.
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/* This is a dummy line to alter the dbscheme, so we can make a database upgrade
|
||||
* without actually changing any of the dbscheme predicates. It contains a date
|
||||
* to allow for such updates in the future as well.
|
||||
*
|
||||
* 2021-07-14
|
||||
*
|
||||
* DO NOT remove this comment carelessly, since it can revert the dbscheme back to a
|
||||
* previously seen state (matching a previously seen SHA), which would make the upgrade
|
||||
* mechanism not work properly.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An invocation of the compiler. Note that more than one file may be
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
class Type extends @type {
|
||||
string toString() { none() }
|
||||
|
||||
string getNewName() {
|
||||
not this instanceof Generic and
|
||||
types(this, _, result)
|
||||
or
|
||||
result = this.(Generic).getUndecoratedName()
|
||||
}
|
||||
}
|
||||
|
||||
class Generic extends Type {
|
||||
Generic() {
|
||||
type_parameters(_, _, this, _) or
|
||||
type_arguments(_, _, this)
|
||||
}
|
||||
|
||||
string getUndecoratedName() {
|
||||
exists(string oldName |
|
||||
types(this, _, oldName) and result = oldName.prefix(min(int i | i = oldName.indexOf("<")))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
from Type type, int kind
|
||||
where types(type, kind, _)
|
||||
select type, kind, type.getNewName()
|
||||
@@ -0,0 +1,4 @@
|
||||
description: Extractor changed to not include angle brackets in generic type names.
|
||||
compatibility: backwards
|
||||
|
||||
types.rel: run types.qlo
|
||||
Reference in New Issue
Block a user