Class Function
A function as defined either by a function declaration or a function expression.
Examples:
function greet() { // function declaration
console.log("Hi");
}
var greet =
function() { // function expression
console.log("Hi");
};
var greet2 =
() => console.log("Hi") // arrow function expression
var o = {
m() { // function expression in a method definition in an object literal
return 0;
},
get x() { // function expression in a getter method definition in an object literal
return 1
}
};
class C {
m() { // function expression in a method definition in a class
return 0;
}
}
Import path
import javascript
Direct supertypes
Indirect supertypes
Known direct subtypes
Predicates
declaresArguments |
Holds if this function declares a parameter or local variable named |
describe |
Gets a description of this function. |
getABodyStmt |
Gets a statement in the body of this function. |
getAParameter |
Gets a parameter of this function. |
getAReturnStmt |
Gets a return statement in the body of this function, if any. |
getAReturnedExpr |
Gets an expression that could be returned by this function, if any. |
getArgumentsVariable |
Gets the |
getBody |
Gets the body of this function. |
getBodyStmt |
Gets the |
getCallSignature |
Gets the call signature of this function, as determined by the TypeScript compiler, if any. |
getCanonicalName |
Gets the canonical name for this function, as determined by the TypeScript compiler. |
getCyclomaticComplexity |
Gets the cyclomatic complexity of this function. |
getEnclosingContainer |
Gets the enclosing function or toplevel of this function. |
getEnclosingStmt |
Gets the statement enclosing this function, if any. |
getIdentifier |
Gets the identifier specifying the name of this function, if any. |
getName |
Gets the name of this function if it has one, or a name inferred from its context. |
getNumBodyStmt |
Gets the number of statements in the body of this function. |
getNumberOfLines |
Gets the number of lines in this function. |
getNumberOfLinesOfCode |
Gets the number of lines containing code in this function. |
getNumberOfLinesOfComments |
Gets the number of lines containing comments in this function. |
getParameter |
Gets the |
getParameterByName |
Gets the parameter named |
getRestParameter |
Gets the |
getReturnTypeAnnotation |
Gets the return type annotation on this function, if any. |
getThisBinder |
Gets the function whose |
getThisBindingContainer |
Gets the function or top-level whose |
getThisTypeAnnotation |
Gets the type annotation for the special |
getTypeParameter |
Gets the |
getVariable |
Gets the variable holding this function. |
hasBody |
Holds if this function has a body. |
hasMappedArgumentsVariable |
Holds if this function has a mapped |
hasRestParameter |
Holds if the last parameter of this function is a rest parameter. |
hasTrailingComma |
Holds if the parameter list of this function has a trailing comma. |
isAbstract |
Holds if this function is part of an abstract class member. |
isAsync |
Holds if this function is an asynchronous function. |
isAsyncOrGenerator |
Holds if this function is asynchronous or a generator. |
isGenerator |
Holds if this function is a generator function. |
isNonConstructible |
Holds if this function cannot be invoked using |
isStrict |
Holds if the code in this container is executed in ECMAScript strict mode. |
usesArgumentsObject |
Holds if the body of this function refers to the function’s |
Inherited predicates
analyze |
Gets type inference results for this element. |
from ValueNode |
flow |
Gets the data flow node associated with this program element. |
from ValueNode |
getAChild |
Gets a child node of this node. |
from AstNode |
getAChildExpr |
Gets a child expression of this node. |
from AstNode |
getAChildStmt |
Gets a child statement of this node. |
from AstNode |
getAPrimaryQlClass |
Gets the primary QL class for the Locatable. |
from Locatable |
getAStmt |
Gets a statement that belongs to this container. |
from StmtContainer |
getAToken |
Gets a token belonging to this element. |
from AstNode |
getATypeParameter |
Gets any type parameter declared on this function or type. |
from TypeParameterized |
getChild |
Gets the |
from AstNode |
getChildExpr |
Gets the |
from AstNode |
getChildStmt |
Gets the |
from AstNode |
getChildTypeExpr |
Gets the |
from AstNode |
getContainer |
Gets the function or toplevel to which this node belongs. |
from NodeInStmtContainer |
getDocumentation |
Gets the JSDoc comment for this element, if any. |
from Documentable |
getEndLine |
Gets the line on which this element ends. |
from Locatable |
getEntry |
Gets the (unique) entry node of the control flow graph for this toplevel or function. |
from StmtContainer |
getEntryBB |
Gets the entry basic block of this function, that is, the basic block containing the entry node of its CFG. |
from StmtContainer |
getExit |
Gets the (unique) exit node of the control flow graph for this toplevel or function. |
from StmtContainer |
getFile |
Gets the file this program element comes from. |
from AstNode |
getFirstControlFlowNode |
Gets the first control flow node belonging to this syntactic entity. |
from AstNode |
getFirstToken |
Gets the first token belonging to this element. |
from AstNode |
getFunctionBoundary |
Gets the innermost enclosing function or top-level, possibly this container itself if it is a function or top-level. |
from StmtContainer |
getLastToken |
Gets the last token belonging to this element. |
from AstNode |
getLocation |
Gets this element’s location. |
from AstNode |
getNumChild |
Gets the number of child nodes of this node. |
from AstNode |
getNumChildExpr |
Gets the number of child expressions of this node. |
from AstNode |
getNumChildStmt |
Gets the number of child statements of this node. |
from AstNode |
getNumLines |
Gets the number of lines covered by this element. |
from Locatable |
getNumParameter |
Gets the number of parameters declared by this element. |
from Parameterized |
getNumTypeParameter |
Gets the number of type parameters declared on this function or type. |
from TypeParameterized |
getParameterVariable |
Gets a variable of the given name that is a parameter of this element. |
from Parameterized |
getParent |
Gets the parent node of this node, if any. |
from AstNode |
getPrimaryQlClasses |
Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs. |
from Locatable |
getScope |
Gets the scope induced by this toplevel or function, if any. |
from StmtContainer |
getStart |
Gets the (unique) CFG node at which execution of this toplevel or function begins. |
from StmtContainer |
getStartBB |
Gets the start basic block of this function, that is, the basic block containing the start node of its CFG. |
from StmtContainer |
getStartLine |
Gets the line on which this element starts. |
from Locatable |
getTopLevel |
Gets the toplevel syntactic unit to which this element belongs. |
from AstNode |
hasTypeParameters |
Holds if this function or type declares any type parameters. |
from TypeParameterized |
inExternsFile |
Holds if this syntactic entity belongs to an externs file. |
from AstNode |
isAmbient |
Holds if this is part of an ambient declaration or type annotation in a TypeScript file. |
from AstNode |
toString |
Gets a textual representation of this element. |
from Locatable |