Module darklua_core::rules
source · Expand description
A module that contains the different rules that mutates a Lua block.
Modules
Structs
- A rule that compute expressions that do not have any side-effects.
- The intent of this struct is to hold data shared across all rules applied to a file.
- A rule that converts index expression into field expression.
- Convert local function statements into local assignements when the function is not recursive.
- A rule that converts require calls between environments
- A rule that removes statements that will never be executed because of an earlier
return
statement. - Group local assign statements into one statement.
- A rule to replace global variables with values.
- A rule that removes comments associated with AST nodes.
- A rule that converts compound assignment (like
+=
) into regular assignments. - A rule that removes empty do statements.
- A rule that removes parentheses when calling functions with a string or a table.
- Change method functions into regular functions.
- A rule that removes trailing
nil
in local assignments. - A rule that removes whitespaces associated with AST nodes.
- A rule that removes unused if branches. It can also turn a if statement into a do block statement.
- A rule that removes while statements with a known false condition.
- Rename all identifiers to small and meaningless names.
Enums
- When implementing the configure method of the Rule trait, the method returns a result that uses this error type.
- In order to be able to weakly-type the properties of any rule, this enum makes it possible to easily use serde to gather the value associated with a property.
Constants
Traits
- Defines an interface that will be used to mutate blocks and how to serialize and deserialize the rule configuration.
Functions
- A function to get the default rule stack for darklua. All the rules here must preserve all the functionalities of the original code after being applied. They must guarantee that the processed block will work as much as the original one.