Skip to content

Commit

Permalink
avoid unnecessary checks
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidb80 committed Sep 20, 2022
1 parent 5e256ed commit 6a40b1f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/uncomment.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,17 @@ proc unCommentResolver(prefix: string, body: NimNode) =
for text in node.strval.splitLines:
let
code = strip text
a = code.startswith prefix
b = code.startswith uncommentPrefixDebug
cond = code.startswith prefix

body[i].add:
when not defined(release) and not defined(danger):
if a or b:
if cond or code.startswith uncommentPrefixDebug:
parsestmt code[prefix.len..^1]
else:
newCommentStmtNode(code)

else:
if a: parsestmt code[prefix.len..^1]
if cond: parsestmt code[prefix.len..^1]
else: newCommentStmtNode(code)

elif body.len > 0:
Expand Down

0 comments on commit 6a40b1f

Please sign in to comment.