Exemplo n.º 1
0
        public override bool NeedParens(OutputContext output)
        {
            if (output.FirstInStatement())
            {
                return(true);
            }

            if (output.Options.Webkit)
            {
                var p = output.Parent();
                if (p is AstPropAccess propAccess && propAccess.Expression == this)
                {
                    return(true);
                }
            }

            if (output.Options.WrapIife)
            {
                var p = output.Parent();
                return(p is AstCall call && call.Expression == this);
            }

            return(false);
        }
Exemplo n.º 2
0
 public override bool NeedParens(OutputContext output)
 {
     // object literal could need parens, because it would be interpreted as a block of code.
     return(!output.HasParens() && output.FirstInStatement());
 }
Exemplo n.º 3
0
 public override bool NeedParens(OutputContext output)
 {
     return(output.FirstInStatement());
 }