mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Expand downgrade script
This commit is contained in:
@@ -0,0 +1,37 @@
|
|||||||
|
// Removes all nodes nested inside a qualified type access,
|
||||||
|
// and changes qualified type access nodes to "named type" nodes.
|
||||||
|
//
|
||||||
|
/*
|
||||||
|
* jsdoc_type_exprs (unique int id: @jsdoc_type_expr,
|
||||||
|
* int kind: int ref,
|
||||||
|
* int parent: @jsdoc_type_expr_parent ref,
|
||||||
|
* int idx: int ref,
|
||||||
|
* varchar(900) tostring: string ref);
|
||||||
|
*/
|
||||||
|
|
||||||
|
class JSDocTypeExprParent extends @jsdoc_type_expr_parent {
|
||||||
|
string toString() { none() }
|
||||||
|
}
|
||||||
|
|
||||||
|
class JSDocTypeExpr extends @jsdoc_type_expr {
|
||||||
|
string toString() { none() }
|
||||||
|
|
||||||
|
JSDocTypeExpr getChild(int n) { jsdoc_type_exprs(result, _, this, n, _) }
|
||||||
|
|
||||||
|
int getNewKind() { jsdoc_type_exprs(this, result, _, _, _) }
|
||||||
|
|
||||||
|
predicate shouldRemove() { this = any(JSDocQualifiedTypeAccess a).getChild(_) }
|
||||||
|
}
|
||||||
|
|
||||||
|
class JSDocQualifiedTypeAccess extends @jsdoc_qualified_type_expr, JSDocTypeExpr {
|
||||||
|
override int getNewKind() {
|
||||||
|
result = 5
|
||||||
|
/* 5 = @jsdoc_named_type_expr */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
from JSDocTypeExpr node, JSDocTypeExprParent parent, int idx, string tostring
|
||||||
|
where
|
||||||
|
jsdoc_type_exprs(node, _, parent, idx, tostring) and
|
||||||
|
not node.shouldRemove()
|
||||||
|
select node, node.getNewKind(), parent, idx, tostring
|
||||||
@@ -1,2 +1,4 @@
|
|||||||
description: split up qualified names in jsdoc type exprs
|
description: split up qualified names in jsdoc type exprs
|
||||||
compatibility: backwards
|
compatibility: backwards
|
||||||
|
|
||||||
|
jsdoc_type_exprs.rel: run jsdoc_type_exprs.ql
|
||||||
|
|||||||
Reference in New Issue
Block a user