コード例 #1
0
        public override int VisitLogical_and(BRAQParser.Logical_andContext context)
        {
            if (context.left != null)
            {
                context.left.Accept(this);
                // если левый оператор ложный, тогда перепрыгиваем, иначе правый
                Label falsey = il.DefineLabel();    //stack: left
                il.Emit(OpCodes.Brfalse_S, falsey); //stack:
                context.right.Accept(this);         //stack: right
                Label truthey = il.DefineLabel();
                il.Emit(OpCodes.Br_S, truthey);     //stack: right

                il.MarkLabel(falsey);               //from Brfalse, stack:
                il.Emit(OpCodes.Ldc_I4_0);          //stack: 0
                il.MarkLabel(truthey);              //from br_s, stack: right
            }
            else
            {
                context.right.Accept(this);
            }
            return(0);
        }
コード例 #2
0
 /// <summary>
 /// Visit a parse tree produced by <see cref="BRAQParser.logical_and"/>.
 /// <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_and([NotNull] BRAQParser.Logical_andContext context)
 {
     return(VisitChildren(context));
 }
コード例 #3
0
 /// <summary>
 /// Exit a parse tree produced by <see cref="BRAQParser.logical_and"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitLogical_and([NotNull] BRAQParser.Logical_andContext context)
 {
 }
コード例 #4
0
 public override Type VisitLogical_and(BRAQParser.Logical_andContext context)
 {
     return(binary_optional_left_expr(context, context.left, context.op, context.right));
 }