/// <summary> /// Generates the code for a BinaryExpression node. /// </summary> /// <param name="be">The BinaryExpression node.</param> /// <returns>String containing C# code for BinaryExpression be.</returns> private string GenerateBinaryExpression(BinaryExpression be) { string retstr = String.Empty; retstr += GenerateNode((SYMBOL) be.kids.Pop()); retstr += Generate(String.Format(" {0} ", be.ExpressionSymbol), be); foreach (SYMBOL kid in be.kids) retstr += GenerateNode(kid); return retstr; }
/// <summary> /// Generates the code for a BinaryExpression node. /// </summary> /// <param name="be">The BinaryExpression node.</param> /// <returns>String containing C# code for BinaryExpression be.</returns> private string GenerateBinaryExpression(BinaryExpression be) { string retstr = String.Empty; if (be.ExpressionSymbol.Equals("&&") || be.ExpressionSymbol.Equals("||")) { // special case handling for logical and/or, see Mantis 3174 retstr += "((bool)("; retstr += GenerateNode(be, (SYMBOL)be.kids.Pop()); retstr += "))"; retstr += Generate(String.Format(" {0} ", be.ExpressionSymbol.Substring(0,1)), be); retstr += "((bool)("; foreach (SYMBOL kid in be.kids) retstr += GenerateNode(be, kid); retstr += "))"; } else { retstr += GenerateNode(be, (SYMBOL)be.kids.Pop()); retstr += Generate(String.Format(" {0} ", be.ExpressionSymbol), be); foreach (SYMBOL kid in be.kids) retstr += GenerateNode(be, kid); } return retstr; }