public override void visit(EqualTo eq) { eq.lhs.accept(this); emit_move("a1", "a0"); eq.rhs.accept(this); emit_jal("eq"); }
public override void visit(EqualTo equalTo) { for (int i = 0; i < depth * 2; i++) { sw.Write(" "); } depth++; sw.WriteLine("_equalto : " + equalTo.type); equalTo.lhs.accept(this); equalTo.rhs.accept(this); depth--; }
public override void visit(EqualTo eq) { eq.lhs.accept(this); eq.rhs.accept(this); eq.type = Constants.BOOLEAN; Symbol lhs_type = eq.lhs.type; Symbol rhs_type = eq.rhs.type; if (lhs_type == Constants.INTEGER || lhs_type == Constants.BOOLEAN || lhs_type == Constants.STRING || rhs_type == Constants.INTEGER || rhs_type == Constants.BOOLEAN || rhs_type == Constants.STRING) { if (lhs_type != rhs_type) { error(eq, "comparison of primitives Int, Bool, and String must be of same type"); eq.type = Constants.OBJECT; } } }
public abstract void visit(EqualTo equalTo);