Skip to content

Commit 864ea14

Browse files
committed
JS: Deprecate everything that depends on type extraction
1 parent 5625608 commit 864ea14

File tree

6 files changed

+72
-74
lines changed

6 files changed

+72
-74
lines changed

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,7 +1008,7 @@ 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.
@@ -1018,11 +1018,7 @@ class InvokeExpr extends @invokeexpr, Expr {
10181018
* Note that the resolved function may be overridden in a subclass and thus is not
10191019
* necessarily the actual target of this invocation at runtime.
10201020
*/
1021-
Function getResolvedCallee() {
1022-
TypeResolution::callTarget(this, result)
1023-
or
1024-
result = this.getResolvedCalleeName().getImplementation()
1025-
}
1021+
Function getResolvedCallee() { TypeResolution::callTarget(this, result) }
10261022
}
10271023

10281024
/**

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
@@ -126,7 +126,7 @@ class TypeAnnotation extends @type_annotation, NodeInStmtContainer {
126126
*
127127
* Note that this has no result for JSDoc type annotations.
128128
*/
129-
Type getType() { none() }
129+
deprecated Type getType() { none() }
130130

131131
/**
132132
* Gets the class referenced by this type annotation, if any.

0 commit comments

Comments
 (0)