Ejemplo n.º 1
0
        public override int VisitLogical_equal(BRAQParser.Logical_equalContext context)
        {
            if (context.left != null)
            {
                context.left.Accept(this);
                context.right.Accept(this);

                if (context.op.Text == "?=")
                {
                    if (type_dict[context.left] == typeof(string))
                    {
                        il.EmitCall(OpCodes.Call, typeof(string).GetMethod("op_Equality",
                                                                           new[] { typeof(string), typeof(string) }) ?? throw new BindError(), null);
                    }
                    else
                    {
                        il.Emit(OpCodes.Ceq);
                    }
                }
                else
                {
                    if (type_dict[context.left] == typeof(string))
                    {
                        il.EmitCall(OpCodes.Call, typeof(string).GetMethod("op_Inequality",
                                                                           new[] { typeof(string), typeof(string) }) ?? throw new BindError(), null);
                    }
                    else
                    {
                        il.Emit(OpCodes.Ceq);
                        il.Emit(OpCodes.Ldc_I4_0);
                        il.Emit(OpCodes.Ceq);
                    }
                }
            }
            else
            {
                context.right.Accept(this);
            }
            return(0);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="BRAQParser.logical_equal"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitLogical_equal([NotNull] BRAQParser.Logical_equalContext context)
 {
     return(VisitChildren(context));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="BRAQParser.logical_equal"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitLogical_equal([NotNull] BRAQParser.Logical_equalContext context)
 {
 }
Ejemplo n.º 4
0
 public override Type VisitLogical_equal(BRAQParser.Logical_equalContext context)
 {
     return(binary_optional_left_expr(context, context.left, context.op, context.right));
 }