private static bool NeedsParens(AstNode node, JSToken refToken) { bool needsParens = false; // assignments and commas are the only operators that need parens // around them. Conditional is pretty low down the list BinaryOperator binaryOp = node as BinaryOperator; if (binaryOp != null) { OpPrec thisPrecedence = JSScanner.GetOperatorPrecedence(refToken); OpPrec nodePrecedence = JSScanner.GetOperatorPrecedence(binaryOp.OperatorToken); needsParens = (nodePrecedence < thisPrecedence); } return(needsParens); }