pub struct Scope<'src> {
pub namespace: Option<&'src str>,
pub class_name: Option<&'src str>,
pub function_name: Option<&'src str>,
}Expand description
Lexical scope context passed to each ScopeVisitor method.
Represents the immediately enclosing namespace, class-like definition,
and named function or method at the point a node is visited.
All fields are None when the node is at the global top level.
Namespace is set when inside a braced or simple namespace declaration.
class_name is set inside class, interface, trait, and enum
declarations; it is None for anonymous classes.
function_name is set inside named functions and methods; it is None
inside closures and arrow functions.
Fields§
§namespace: Option<&'src str>Current namespace, or None for the global namespace.
This is a borrowed slice of the original source string, so copying or cloning the scope is always allocation-free.
class_name: Option<&'src str>Name of the immediately enclosing class-like declaration, or None.
function_name: Option<&'src str>Name of the immediately enclosing named function or method, or None.