Param
struct ParamImplements Copyable, Movable
- Fields
name: Stringconv: String:read,mut,ref,var,outordeinit—readwhen unwritten.type: String: The declared type text, default value removed; empty if untyped.
mojolint.structureFunctions, parameters, structs and fields, recovered from logical lines by indentation alone.
A def header at indent k owns every following line with indent > k;
the same for struct. That is enough to know, for any line, which function
it is in and what that function's parameters and var locals are called —
the whole vocabulary the rules use.
Paramstruct ParamImplements Copyable, Movable
name: Stringconv: String: read, mut, ref, var, out or deinit — read when unwritten.type: String: The declared type text, default value removed; empty if untyped.Funcstruct FuncImplements Copyable, Movable
name: Stringowner: String: The enclosing struct's name, or empty for a free function.params: List[Param]header: Int: Index of the header line in the List[Line].body_start: Intbody_end: Int: Exclusive end of the body in the List[Line].paramdef param(self, name: String) -> Optional[Param] is_paramdef is_param(self, name: String) -> Bool Fieldstruct FieldImplements Copyable, Movable
name: Stringtype: StringStructstruct StructImplements Copyable, Movable
name: Stringfields: List[Field]has_deinit: Bool: Defines __deinit__ or __del__.header: Intbody_end: Intfielddef field(self, name: String) -> Optional[Field] Modulestruct ModuleThe functions and structs of one file.
Implements Movable
funcs: List[Func]structs: List[Struct]func_atdef func_at(self, line_index: Int) -> Optional[Func] The innermost function whose body contains line_index.
struct_nameddef struct_named(self, name: String) -> Optional[Struct] parse_paramsdef parse_params(header: String) -> List[Param] Parameters of a def header line, in order.
parse_moduledef parse_module(lines: List[Line]) -> Module Recover functions and structs from lines.
locals_ofdef locals_of(lines: List[Line], f: Func) -> List[String] Names declared with var in f's body, in order of declaration.
has_localdef has_local(lines: List[Line], f: Func, name: String) -> Bool used_afterdef used_after(lines: List[Line], f: Func, line_index: Int, name: String) -> Bool Is name mentioned on any line of f after line_index?