/// <summary>
        /// Uses the precedence operator only if needed. i.e. '(' operations ')'.
        /// <para> - Writes '(' immediately, and returns a disposable that writes the ending ')'.</para>
        /// <para> - Pushes the operation into the stack, and pops it when disposed.</para>
        /// </summary>
        /// <param name="node">The node representing the operation that is going to be rendered inside the using block.</param>
        /// <returns>Disposable that renders the ending ')' of the precedence operator.</returns>
        public IDisposable Operation(Expression node)
        {
            var op = JsOperationHelper.GetJsOperator(node.NodeType, node.Type);

            if (op == JavascriptOperationTypes.NoOp)
            {
                return(null);
            }

            return(new PrecedenceController(result, operandTypes, op));
        }
        private bool CurrentHasPrecedence()
        {
            var cnt = _operandTypes.Count;

            if (cnt < 2)
            {
                return(true);
            }

            var current = _operandTypes[cnt - 1];
            var parent  = _operandTypes[cnt - 2];

            return(JsOperationHelper.CurrentHasPrecedence(current, parent));
        }
 /// <summary>
 /// Writes the operator that corresponds to the given expression type.
 /// </summary>
 /// <param name="expressionType">Expression type representing the operator to render..</param>
 /// <returns>The <see cref="JavascriptWriter"/>, allowing a fluent style.</returns>
 public JavascriptWriter WriteOperator(ExpressionType expressionType, Type type)
 {
     JsOperationHelper.WriteOperator(result, expressionType, type);
     return(this);
 }