public override void Visit(AndExpressionNode node) { Console.WriteLine(this.indentation + "&&"); indentation = indentation + " "; node.expression1.Accept(this); node.expression2.Accept(this); indentation = indentation.Substring(0, indentation.Length - 3); }
public override void Visit(AndExpressionNode node) { string BooleanExpressionLabel = BooleanExpressionLabelGenerator.GetNewLabel(); string BooleanExpressionIsFalseLabel = BooleanExpressionLabel + "IsFalse"; string BooleanExpressionStoreLabel = BooleanExpressionLabel + "Store"; node.expression1.Accept(this); Gen("cmp", "eax","0"); Gen("je", BooleanExpressionIsFalseLabel); node.expression2.Accept(this); Gen("cmp", "eax", "0"); Gen("je", BooleanExpressionIsFalseLabel); Gen("mov", "eax", "1"); Gen("jmp", BooleanExpressionStoreLabel); GenText(BooleanExpressionIsFalseLabel + ":"); Gen("mov", "eax", "0"); GenText(BooleanExpressionStoreLabel + ":"); }
public virtual void Visit(AndExpressionNode node) { node.expression1.Accept(this); node.expression2.Accept(this); }
public override void Visit(AndExpressionNode node) { node.expression1.Accept(this); node.expression2.Accept(this); if (!AreTypeCompatible(node.expression1.ExpressionType.GetType(), typeof(BooleanType))) throw new Exception("Expression 1 for && operation is not of type Boolean!"); if (!AreTypeCompatible(node.expression2.ExpressionType.GetType(), typeof(BooleanType))) throw new Exception("Expression 2 for && operation is not of type Boolean!"); node.ExpressionType = BooleanType.Instance; }