JavaScriptNodeContext AST Python Object
The JavaScriptNodeContext
is attached to each AST object for Python via the context
attribute. It inherits the Context
type.
Attributes
currentFunction
(array orFunctionDefinition
): the current function we are in (null
if we are not in a function)currentClass
(typeClassDefinition
): the current class (ornull
if not in a class)imports
(array of typeImport
: list of all importsassignments
(array of typeAssignment
): list of assignments
Example of use
// Getting the context
const ctx = node.context;
// Getting the imports
const allImports = ctx.imports;