[][src]Module darklua_core::rules

A module that contains the different rules that mutates a Lua block.

Structs

ComputeExpression

A rule that compute expressions that do not have any side-effects.

ConvertLocalFunctionToAssign

Convert local function statements into local assignements when the function is not recursive.

GroupLocalAssignment

Group local assign statements into one statement.

InjectGlobalValue

A rule to replace global variables with values.

RemoveEmptyDo

A rule that removes empty do statements.

RemoveFunctionCallParens

A rule that removes parentheses when calling functions with a string or a table.

RemoveMethodDefinition

Change method functions into regular functions.

RemoveUnusedIfBranch

A rule that removes unused if branches. It can also turn a if statement into a do block statement.

RemoveUnusedWhile

A rule that removes while statements with a known false condition.

RenameVariables

Rename all identifiers to small and meaningless names.

Enums

RuleConfigurationError

When implementing the configure method of the Rule trait, the method returns a result

RulePropertyValue

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

COMPUTE_EXPRESSIONS_RULE_NAME
CONVERT_LOCAL_FUNCTION_TO_ASSIGN_RULE_NAME
GROUP_LOCAL_ASSIGNMENT
INJECT_GLOBAL_VALUE_RULE_NAME
REMOVE_EMPTY_DO_RULE_NAME
REMOVE_FUNCTION_CALL_PARENS
REMOVE_METHOD_DEFINITION_RULE_NAME
REMOVE_UNUSED_IF_BRANCH_RULE_NAME
REMOVE_UNUSED_WHILE_RULE_NAME
RENAME_VARIABLES_RULE_NAME

Traits

Rule

Defines an interface that will be used to mutate blocks and how to serialize and deserialize the rule configuration.

Functions

get_default_rules

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.

Type Definitions

RuleProperties