Skip to content

Commit 9887025

Browse files
committed
JS: Some minor fixes in Classes.qll
1 parent 68bf9f3 commit 9887025

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ class MemberDeclaration extends @property, Documentable {
493493
*/
494494
predicate isStatic() { is_static(this) }
495495

496+
/** Gets a boolean indicating if this member is static. */
497+
boolean getStaticAsBool() { if isStatic() then result = true else result = false }
498+
496499
/**
497500
* Holds if this member is abstract.
498501
*
@@ -694,10 +697,10 @@ class MethodDeclaration extends MemberDeclaration {
694697
* the overload index is defined as if only one of them was concrete.
695698
*/
696699
int getOverloadIndex() {
697-
exists(ClassOrInterface type, string name |
700+
exists(ClassOrInterface type, string name, boolean static |
698701
this =
699702
rank[result + 1](MethodDeclaration method, int i |
700-
methodDeclaredInType(type, name, i, method)
703+
methodDeclaredInType(type, name, static, i, method)
701704
|
702705
method order by i
703706
)
@@ -718,10 +721,11 @@ class MethodDeclaration extends MemberDeclaration {
718721
* Holds if the `index`th member of `type` is `method`, which has the given `name`.
719722
*/
720723
private predicate methodDeclaredInType(
721-
ClassOrInterface type, string name, int index, MethodDeclaration method
724+
ClassOrInterface type, string name, boolean static, int index, MethodDeclaration method
722725
) {
723726
not method instanceof ConstructorDeclaration and // distinguish methods named "constructor" from the constructor
724727
type.getMemberByIndex(index) = method and
728+
static = method.getStaticAsBool() and
725729
method.getName() = name
726730
}
727731

0 commit comments

Comments
 (0)