Ruby: add predicates to DataFlow::ModuleNode to get singleton methods

This commit is contained in:
Alex Ford 2023-06-13 11:38:23 +01:00
Родитель 24e83165ee
Коммит 7a3b6f107b
1 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -1010,6 +1010,23 @@ class ModuleNode instanceof Module {
*/
MethodNode getAnInstanceMethod() { result = this.getInstanceMethod(_) }
/**
* Gets the singleton method named `name` available in this module, including methods inherited from ancestors.
*
* Overridden methods are not included.
*/
MethodNode getSingletonMethod(string name) {
result.asCallableAstNode() = super.getAnOwnSingletonMethod() and
result.getMethodName() = name
}
/**
* Gets a singleton method available in this module, including methods inherited from ancestors.
*
* Overridden methods are not included.
*/
MethodNode getASingletonMethod() { result = this.getSingletonMethod(_) }
/**
* Gets the enclosing module, as it appears in the qualified name of this module.
*