Conversation
jeparlefrancais
left a comment
There was a problem hiding this comment.
Hi! Thanks for submitting the PR
Before merging this, I'd like to see these:
- change the rule name to
convert_luau_numbers - convert only binary numbers to decimal numbers because those are the compatibility issue
- for each kind of number, if they have a token, remove the token if it contains any underscores (
_)
src/rules/mod.rs
Outdated
| Box::<RemoveNilDeclaration>::default(), | ||
| Box::<RenameVariables>::default(), | ||
| Box::<RemoveFunctionCallParens>::default(), | ||
| Box::<RemoveNumberLiterals>::default(), |
There was a problem hiding this comment.
I think I would not put this rule in the default rules, at least for now
src/rules/remove_number_literals.rs
Outdated
| struct Processor {} | ||
|
|
||
| impl NodeProcessor for Processor { | ||
| fn process_expression(&mut self, exp: &mut Expression) { |
There was a problem hiding this comment.
There is a function for number expressions you can use directly:
| fn process_expression(&mut self, exp: &mut Expression) { | |
| fn process_number_expression(&mut self, number: &mut NumberExpression) { |
|
I can't see a reason why you would want this, but it might be cool to atleast have an option for it to convert all number literals (so even hex literals like 0xFFFFFFF, like it's doing right now), instead of it only converting binary literals and removing underscores. |
… changed to convert_luau_numbers and only converts binary to decimal and removes underscores from token)
oh, it is for lua 5.1 compatibility thingy |
|
Closed since this has been merged in #274 |
Closes #256
Changes
convert_luau_numbersthat converts luau's number literal syntax.convert_luau_numbers.