Example #1
0
        void NestExpression(ExpressionType?parentType, Expression child, bool parensIfEqualRank = false)
        {
            int  parentRank  = parentType == null ? 0 : ExpressionPrecedence.Rank(parentType.Value);
            bool needsParens = parentRank > 0 &&
                               (parensIfEqualRank ? parentRank - 1 : parentRank) < ExpressionPrecedence.Rank(child.NodeType);

            if (needsParens)
            {
                sink(ExprTextPart.TextOnly("("), Depth);
            }
            RawChildDispatch(child);
            if (needsParens)
            {
                sink(ExprTextPart.TextOnly(")"), Depth);
            }
        }
Example #2
0
 void Sink(string text, Expression value)
 {
     sink(ExprTextPart.TextAndExpr(text, value), Depth);
 }
Example #3
0
 void Sink(string text)
 {
     sink(ExprTextPart.TextOnly(text), Depth);
 }