mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
JavaScript: Add predicate AbstractCallable.getDefinition.
This commit is contained in:
@@ -260,8 +260,18 @@ class AbstractRegExp extends DefiniteAbstractValue, TAbstractRegExp {
|
||||
abstract class AbstractCallable extends DefiniteAbstractValue {
|
||||
/**
|
||||
* Gets the function represented by this abstract value.
|
||||
*
|
||||
* For abstract class values, this is the constructor method of the class.
|
||||
*/
|
||||
abstract Function getFunction();
|
||||
|
||||
/**
|
||||
* Gets the definition of the function or class represented by this abstract value.
|
||||
*
|
||||
* For abstract class values, this is the definition of the class itself (and not
|
||||
* its constructor).
|
||||
*/
|
||||
abstract AST::ValueNode getDefinition();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,6 +280,8 @@ abstract class AbstractCallable extends DefiniteAbstractValue {
|
||||
class AbstractFunction extends AbstractCallable, TAbstractFunction {
|
||||
override Function getFunction() { this = TAbstractFunction(result) }
|
||||
|
||||
override AST::ValueNode getDefinition() { result = getFunction() }
|
||||
|
||||
override boolean getBooleanValue() { result = true }
|
||||
|
||||
override InferredType getType() { result = TTFunction() }
|
||||
@@ -298,6 +310,8 @@ class AbstractClass extends AbstractCallable, TAbstractClass {
|
||||
|
||||
override Function getFunction() { result = getClass().getConstructor().getBody() }
|
||||
|
||||
override AST::ValueNode getDefinition() { result = getClass() }
|
||||
|
||||
override boolean getBooleanValue() { result = true }
|
||||
|
||||
override InferredType getType() { result = TTClass() }
|
||||
|
||||
Reference in New Issue
Block a user