Skip to content
Snippets Groups Projects
Commit ad6efbd3 authored by Marco Antognini's avatar Marco Antognini Committed by Etienne Kneuss
Browse files

Add parentheses around multi-operators

parent c22b78e6
No related branches found
No related tags found
No related merge requests found
...@@ -105,8 +105,9 @@ class CPrinter(val sb: StringBuffer = new StringBuffer) { ...@@ -105,8 +105,9 @@ class CPrinter(val sb: StringBuffer = new StringBuffer) {
case Assign(lhs, rhs) => case Assign(lhs, rhs) =>
c"$lhs = $rhs;" c"$lhs = $rhs;"
case UnOp(op, rhs) => c"($op $rhs)" case UnOp(op, rhs) => c"($op$rhs)"
case MultiOp(op, stmts) => c"""${nary(stmts, sep = s" ${op.fixMargin} ")}""" case MultiOp(op, stmts) => c"""${nary(stmts, sep = s" ${op.fixMargin} ",
opening = "(", closing = ")")}"""
case SubscriptOp(ptr, idx) => c"$ptr[$idx]" case SubscriptOp(ptr, idx) => c"$ptr[$idx]"
case Break => c"break;" case Break => c"break;"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment