darklua
darklua copied to clipboard
A command line tool that transforms Lua code
This idea comes from a test case that I meant to add for #64, which uncovered new possibilities of optimizations: ```lua return if call() and false then value else other...
Having this feature will open up a lot of new possibilities for this project. For example, the evaluation of pure functions with constant arguments. This would require some pretty clever...
Other darklua rules may modified the content of a function and remove every statement from it. This rule should remove calls to these functions. **Example** ```lua local function assertInDev() end...
Probably only in the CLI part of the project, it could read files and perform code transforms while waiting for IO.
When a numeric for statement is used with a constant start, end and/or step value, the loop can be unwrapped into the repeated statements of the block. This rule should...
In GitLab by @matthargett on Oct 3, 2021, 12:00 Const fold trivial module exports from a specified module: SchedulerFeatureFlags.new.lua: ```lua local exports = { debug = false } exports.taskAPI =...
```lua function foo.bar() end ``` Turns into: ```lua foo.bar = function() end ```
For code similar to this: ```lua local var = (function() if something then return "foo" else return "bar" end end)() ``` It can be simplified to avoid the cost of...
This rule would take code that looks like this: ```lua local function Component(props) local textColor = props.style.text.default local highlight = props.style.text.red end ``` And transform it into: ```lua local function...
This is a special case of the rule describe in issue #26 darklua needs to assume that `require` is a function call that does not perform any side-effects, so that...