Пример #1
0
        private IEnumerable <TextLine> FetchDebuggingBlocks(IDebuggingContext context)
        {
            var breakpoint  = context.Breakpoint;
            var currentLine = context.CurrentLine;

            var codeLinesRange = breakpoint == 0 ? 1 : breakpoint - currentLine - 1;

            return(context.SourceText.Lines
                   .Skip(currentLine)
                   .Take(codeLinesRange));
        }
Пример #2
0
        public async Task DebugAsync(IDebuggingContext context)
        {
            if (context is null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (context.SourceText.Length == 0)
            {
                return;
            }

            var options        = CreateDefaultOptions();
            var debuggingBlock = FetchDebuggingBlocks(context);

            foreach (TextLineDebugger line in debuggingBlock)
            {
                context.DebuggingState = await line.DebugAsync(context.DebuggingState, options);

                context.CurrentLine++;
            }
        }