public void Dispose() { // Need to add an additional line at the end IF there wasn't one already written. // This is needed to work with the C# editor's handling of #line ... var endsWithNewline = _writer.Length > 0 && _writer[_writer.Length - 1] == '\n'; // Always write at least 1 empty line to potentially separate code from pragmas. _writer.WriteLine(); // Check if the previous empty line wasn't enough to separate code from pragmas. if (!endsWithNewline) { _writer.WriteLine(); } var lineCount = _writer.Location.LineIndex - _startLineIndex; var linePragma = new LinePragma(_sourceLineIndex, lineCount, _sourceFilePath); _context.AddLinePragma(linePragma); _writer .WriteLine("#line default") .WriteLine("#line hidden"); if (!_context.Options.SuppressNullabilityEnforcement) { _writer.WriteLine("#nullable disable"); } _writer.CurrentIndent = _startIndent; }
public virtual void AddLinePragma(LinePragma linePragma) { }
public override void AddLinePragma(LinePragma linePragma) { LinePragmas.Add(linePragma); }