Skip to content

Commit

Permalink
Nim: do not wrap ternary operators in parenthesis when not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Mingun committed Oct 4, 2024
1 parent 5a6b401 commit ab8666f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class NimTranslator(provider: TypeProvider, importList: ImportList) extends Base
case _ => s"this.${doName(s)}"
}
override def doIfExp(condition: expr, ifTrue: expr, ifFalse: expr): String =
s"(if ${translate(condition)}: ${translate(ifTrue)} else: ${translate(ifFalse)})"
s"if ${translate(condition)}: ${translate(ifTrue)} else: ${translate(ifFalse)}"
override def arraySubscript(container: expr, idx: expr): String =
s"${translate(container)}[${translate(idx)}]"

Expand Down

0 comments on commit ab8666f

Please sign in to comment.