Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e9e8409

Browse files
committed
Ensure Int nodes with preceding unary + get formatted properly.
1 parent a8b239c commit e9e8409

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
5858
- Ensure nested `HshPtn` nodes use braces.
5959
- Force using braces if the block is within a `Binary` within the predicate of a loop or conditional.
6060
- Make sure `StringLiteral` and `StringEmbExpr` know that they can be extended by heredocs.
61+
- Ensure `Int` nodes with preceding unary `+` get formatted properly.
6162

6263
### Removed
6364

lib/syntax_tree.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7220,7 +7220,7 @@ def child_nodes
72207220
end
72217221

72227222
def format(q)
7223-
if !value.start_with?("0") && value.length >= 5 && !value.include?("_")
7223+
if !value.start_with?(/\+?0/) && value.length >= 5 && !value.include?("_")
72247224
# If it's a plain integer and it doesn't have any underscores separating
72257225
# the values, then we're going to insert them every 3 characters
72267226
# starting from the right.

0 commit comments

Comments
 (0)