/
smwwiki
/
OneScript_fork
Обзор
Документация
Войти
/
smwwiki
/
OneScript_fork
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/OneScript.Language/Sources/SourceCode.cs
45 строк
1 KB
EvilBeaver
Еще исправления по замечаниям Сонара
26 окт 2023, 12:14
26 окт 2023, 12:14
501ae47
Код
Авторство
О чём код?
/*---------------------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v.2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. ----------------------------------------------------------*/ using OneScript.Language.LexicalAnalysis; // ReSharper disable once CheckNamespace namespace OneScript.Sources { public class SourceCode : ISourceCodeIndexer { private readonly ICodeSource _source; private ISourceCodeIndexer _indexer; internal SourceCode(string sourceName, ICodeSource source) { _source = source; Name = sourceName; } public SourceCodeIterator CreateIterator() { var newIterator = new SourceCodeIterator(this); _indexer = newIterator; return newIterator; } public string Location => _source.Location; public string Name { get; } public string GetSourceCode() => _source.GetSourceCode(); public string GetCodeLine(int lineNumber) { return _indexer?.GetCodeLine(lineNumber); } public override string ToString() => Name ?? Location; } }