public override void Visit(CompareNode node)
        {
            Contracts.AssertValue(node);

            if (TryShowValue(node))
            {
                return;
            }

            TokKind tidLax    = node.TidLax;
            TokKind tidStrict = node.TidStrict;
            string  strLax    = GetString(tidLax);
            string  strStrict = GetString(tidStrict);

            string str   = string.Empty;
            string strOp = string.Empty;

            for (int i = 0; ;)
            {
                _wrt.Write(strOp);
                var arg  = node.Operands.Items[i];
                var prec = GetPrec(arg);
                if (prec <= Precedence.Compare)
                {
                    _wrt.Write('(');
                }
                arg.Accept(this);
                if (prec <= Precedence.Compare)
                {
                    _wrt.Write(')');
                }
                if (++i >= node.Operands.Items.Length)
                {
                    break;
                }
                var tid = node.Operands.Delimiters[i - 1].Kind;
                Contracts.Assert(tid == tidLax || tid == tidStrict);
                strOp = tid == tidLax ? strLax : strStrict;
            }

            ShowType(node);
        }
Exemple #2
0
 public override void PostVisit(CompareNode node)
 {
     Contracts.Assert(false);
 }
Exemple #3
0
 public abstract void Visit(CompareNode node);
Exemple #4
0
 public override bool PreVisit(CompareNode node)
 {
     Visit(node); return(false);
 }
Exemple #5
0
 public virtual bool PreVisit(CompareNode node)
 {
     return(true);
 }