Skip to content

Commit 22aac8e

Browse files
committed
ensure that the existence of non-synthetic constructor is checked correctly
1 parent a66e33e commit 22aac8e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

javascript/ql/src/Declarations/SuspiciousMethodNameDeclaration.ql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ where
3737
( // Assume that a "new" method is intentional if the class has an explicit constructor.
3838
name = "new" and
3939
container instanceof ClassDefinition and
40-
not container.getMember("constructor").(ConstructorDeclaration).isSynthetic()
40+
exists(ConstructorDeclaration constructor |
41+
container.getMember("constructor") = constructor and
42+
not constructor.isSynthetic()
43+
)
4144
)
4245
or
4346
( // Explicitly declared static methods are fine.

0 commit comments

Comments
 (0)