Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06e9e5c

Browse files
committed
JS: Make FunctionNode and ClassNode use inferred names
1 parent c44a3b4 commit 06e9e5c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • javascript/ql/src/semmle/javascript/dataflow

javascript/ql/src/semmle/javascript/dataflow/Nodes.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ class FunctionNode extends DataFlow::ValueNode, DataFlow::SourceNode {
344344
/** Holds if the last parameter of this function is a rest parameter. */
345345
predicate hasRestParameter() { astNode.hasRestParameter() }
346346

347-
/** Gets the name of this function, if it has one. */
348-
string getName() { result = astNode.getName() }
347+
/** Gets the unqualified name of this function, if it has one or one can be determined from the context. */
348+
string getName() { result = astNode.getInferredName() }
349349

350350
/** Gets a data flow node corresponding to a return value of this function. */
351351
DataFlow::Node getAReturn() { result = astNode.getAReturnedExpr().flow() }
@@ -575,7 +575,7 @@ class ClassNode extends DataFlow::SourceNode {
575575
ClassNode() { this = impl }
576576

577577
/**
578-
* Gets the name of the class, if it has one.
578+
* Gets the unqualified name of the class, if it has one or one can be determined from the context.
579579
*/
580580
string getName() { result = impl.getName() }
581581

@@ -795,7 +795,7 @@ module ClassNode {
795795
private class ES6Class extends Range, DataFlow::ValueNode {
796796
override ClassDefinition astNode;
797797

798-
override string getName() { result = astNode.getName() }
798+
override string getName() { result = astNode.getInferredName() }
799799

800800
override string describe() { result = astNode.describe() }
801801

@@ -855,7 +855,7 @@ module ClassNode {
855855
)
856856
}
857857

858-
override string getName() { result = astNode.getName() }
858+
override string getName() { result = astNode.getInferredName() }
859859

860860
override string describe() { result = astNode.describe() }
861861

0 commit comments

Comments
 (0)