public void Visit(ComparisonNode node)
 {
     BinaryOperator(
         node, "=",
         () => VariableType.BOOLEAN,
         new List<VariableType> { VariableType.INTEGER, VariableType.STRING, VariableType.BOOLEAN });
 }
Exemplo n.º 2
0
        public void Visit(ComparisonNode node)
        {
            node.Children[0].Accept(this);
            node.Children[1].Accept(this);

            switch (node.Children[0].NodeType())
            {
                case VariableType.INTEGER:
                    Emit(Bytecode.IS_EQUAL_INT);
                    break;
                case VariableType.STRING:
                    Emit(Bytecode.IS_EQUAL_STRING);
                    break;
                case VariableType.BOOLEAN:
                    Emit(Bytecode.IS_EQUAL_BOOLEAN);
                    break;
                default:
                    throw new InternalCompilerError("Invalid comparison type");

            }
        }