Exemplo n.º 1
0
        private SourceText?ReadText()
        {
            var diagnostics = new List <DiagnosticInfo>();
            var text        = _compiler.TryReadFileContent(_sourceFile, diagnostics);

            _diagnostics = diagnostics;
            return(text);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns a <see cref="SourceText"/> with the contents of this file, or <c>null</c> if
        /// there were errors reading the file.
        /// </summary>
        public override SourceText GetText(CancellationToken cancellationToken = default)
        {
            lock (_lockObject)
            {
                if (_text == null)
                {
                    var diagnostics = new List <DiagnosticInfo>();
                    _text        = _compiler.TryReadFileContent(_sourceFile, diagnostics);
                    _diagnostics = diagnostics;
                }
            }

            return(_text);
        }