private void WriteOpName(Symbol op, ILNode target, Precedence prec, bool spaceAfter = false) { _out.BeginNode(target); // Note: if the operator has a space after it, there's a subtle reason why // we want to print that space before the trivia and not after. Consider // the input "a == //comment\n b". After trivia injection this becomes // (@[@%trailing(@%SLComment("comment"))] @==)(a, @[@%newline] b). // Because the injector associates the newline with a different node than the // single-line comment, there's no easy way to strip out the newline during // the parsing process. So, to make the trivia round-trip, we use // _out.Newline(pending: true) when printing a single-line comment, which // suppresses the newline if it is followed immediately by another newline. // But if we print a space after the trivia, then this suppression does not // occur and we end up with two newlines. Therefore, we must print the space first. if (target.AttrCount() == 0) { target = null; // optimize the usual case } if (target != null) { PrintPrefixTrivia(target); } if (!Les2PrecedenceMap.IsNaturalOperator(op.Name)) { PrintStringCore('`', false, op.Name); } else { Debug.Assert(op.Name.StartsWith("'")); _out.Write(op.Name.Substring(1)); } SpaceIf(spaceAfter); if (target != null) { PrintSuffixTrivia(target, 0, null); } _out.EndNode(); }