Skip to content

Commit ee9c4fa

Browse files
committed
JS: Deprecate everything that depends on type extraction
1 parent f5ac3fd commit ee9c4fa

File tree

7 files changed

+73
-75
lines changed

7 files changed

+73
-75
lines changed

javascript/ql/lib/javascript.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import semmle.javascript.NodeJS
4747
import semmle.javascript.NPM
4848
import semmle.javascript.Paths
4949
import semmle.javascript.Promises
50-
import semmle.javascript.CanonicalNames
50+
deprecated import semmle.javascript.CanonicalNames
5151
import semmle.javascript.RangeAnalysis
5252
import semmle.javascript.Regexp
5353
import semmle.javascript.Routing

javascript/ql/lib/semmle/javascript/CanonicalNames.qll

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/**
22
* Provides classes for working with name resolution of namespaces and types.
33
*/
4+
deprecated module;
45

56
import javascript
67

@@ -18,7 +19,7 @@ import javascript
1819
*
1920
* This class is only populated when full TypeScript extraction is enabled.
2021
*/
21-
class CanonicalName extends @symbol {
22+
deprecated class CanonicalName extends @symbol {
2223
/**
2324
* Gets the parent of this canonical name, that is, the prefix of its qualified name.
2425
*/
@@ -218,7 +219,7 @@ class CanonicalName extends @symbol {
218219
/**
219220
* The canonical name for a type.
220221
*/
221-
class TypeName extends CanonicalName {
222+
deprecated class TypeName extends CanonicalName {
222223
TypeName() {
223224
exists(TypeReference ref | type_symbol(ref, this)) or
224225
exists(TypeDefinition def | ast_node_symbol(def, this)) or
@@ -261,7 +262,7 @@ class TypeName extends CanonicalName {
261262
/**
262263
* The canonical name for a namespace.
263264
*/
264-
class Namespace extends CanonicalName {
265+
deprecated class Namespace extends CanonicalName {
265266
Namespace() {
266267
this.getAChild().isExportedMember() or
267268
exists(NamespaceDefinition def | ast_node_symbol(def, this)) or
@@ -309,7 +310,7 @@ class Namespace extends CanonicalName {
309310
/**
310311
* The canonical name for a function.
311312
*/
312-
class CanonicalFunctionName extends CanonicalName {
313+
deprecated class CanonicalFunctionName extends CanonicalName {
313314
CanonicalFunctionName() {
314315
exists(Function fun | ast_node_symbol(fun, this)) or
315316
exists(InvokeExpr invoke | ast_node_symbol(invoke, this))

javascript/ql/lib/semmle/javascript/Classes.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class ClassOrInterface extends @class_or_interface, TypeParameterized {
119119
*
120120
* Anonymous classes and interfaces do not have a canonical name.
121121
*/
122-
TypeName getTypeName() { result.getADefinition() = this }
122+
deprecated TypeName getTypeName() { result.getADefinition() = this }
123123

124124
/**
125125
* Gets the ClassOrInterface corresponding to either a super type or an implemented interface.

javascript/ql/lib/semmle/javascript/Expr.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
176176
* Has no result if the expression is in a JavaScript file or in a TypeScript
177177
* file that was extracted without type information.
178178
*/
179-
Type getType() { ast_node_type(this, result) }
179+
deprecated Type getType() { ast_node_type(this, result) }
180180

181181
/**
182182
* Holds if the syntactic context that the expression appears in relies on the expression
@@ -993,7 +993,7 @@ class InvokeExpr extends @invokeexpr, Expr {
993993
*
994994
* This predicate is only populated for files extracted with full TypeScript extraction.
995995
*/
996-
CallSignatureType getResolvedSignature() { invoke_expr_signature(this, result) }
996+
deprecated CallSignatureType getResolvedSignature() { invoke_expr_signature(this, result) }
997997

998998
/**
999999
* Gets the index of the targeted call signature among the overload signatures
@@ -1008,19 +1008,15 @@ class InvokeExpr extends @invokeexpr, Expr {
10081008
*
10091009
* This predicate is only populated for files extracted with full TypeScript extraction.
10101010
*/
1011-
CanonicalFunctionName getResolvedCalleeName() { ast_node_symbol(this, result) }
1011+
deprecated CanonicalFunctionName getResolvedCalleeName() { ast_node_symbol(this, result) }
10121012

10131013
/**
10141014
* Gets the statically resolved target function, as determined by the TypeScript type system, if any.
10151015
*
10161016
* Note that the resolved function may be overridden in a subclass and thus is not
10171017
* necessarily the actual target of this invocation at runtime.
10181018
*/
1019-
Function getResolvedCallee() {
1020-
TypeResolution::callTarget(this, result)
1021-
or
1022-
result = this.getResolvedCalleeName().getImplementation()
1023-
}
1019+
Function getResolvedCallee() { TypeResolution::callTarget(this, result) }
10241020
}
10251021

10261022
/**

javascript/ql/lib/semmle/javascript/Functions.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,12 @@ class Function extends @function, Parameterized, TypeParameterized, StmtContaine
434434
*
435435
* This predicate is only populated for files extracted with full TypeScript extraction.
436436
*/
437-
CanonicalFunctionName getCanonicalName() { ast_node_symbol(this, result) }
437+
deprecated CanonicalFunctionName getCanonicalName() { ast_node_symbol(this, result) }
438438

439439
/**
440440
* Gets the call signature of this function, as determined by the TypeScript compiler, if any.
441441
*/
442-
CallSignatureType getCallSignature() { declared_function_signature(this, result) }
442+
deprecated CallSignatureType getCallSignature() { declared_function_signature(this, result) }
443443
}
444444

445445
/**

javascript/ql/lib/semmle/javascript/TypeAnnotations.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class TypeAnnotation extends @type_annotation, NodeInStmtContainer {
135135
*
136136
* Note that this has no result for JSDoc type annotations.
137137
*/
138-
Type getType() { none() }
138+
deprecated Type getType() { none() }
139139

140140
/**
141141
* Gets the class referenced by this type annotation, if any.

0 commit comments

Comments
 (0)