/// <summary> /// Visits breakpointa /// </summary> /// <param name="line">Line to add the tag for</param> /// <param name="context">BreakpointsNode to visit</param> /// <param name="lineNo">Current line numer</param> /// <param name="collectedSpans">Collection of spans found</param> private void Visit(ITextSnapshotLine line, BreakpointsNode context, int lineNo, List <TagSpan <Z80TestTokenTag> > collectedSpans) { if (context == null || lineNo < context.Span.StartLine || lineNo > context.Span.EndLine) { return; } Visit(line, context.BreakpointKeywordSpan, lineNo, collectedSpans, Z80TestTokenType.Keyword); foreach (var expr in context.Expressions) { Visit(line, expr, lineNo, collectedSpans); } }
/// <summary> /// Visit a parse tree produced by <see cref="Z80TestParser.breakpoint"/>. /// <para> /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/> /// on <paramref name="context"/>. /// </para> /// </summary> /// <param name="context">The parse tree.</param> /// <return>The visitor result.</return> public override object VisitBreakpoint(Z80TestParser.BreakpointContext context) { if (IsInvalidContext(context)) { return(null); } var node = new BreakpointsNode(context); foreach (var expr in context.expr()) { node.Expressions.Add((ExpressionNode)VisitExpr(expr)); } return(node); }
/// <summary> /// Visits breakpoints /// </summary> /// <param name="line">Line to add the tag for</param> /// <param name="context">BreakpointsNode to visit</param> /// <param name="lineNo">Current line number</param> /// <param name="collectedSpans">Collection of spans found</param> private void Visit(ITextSnapshotLine line, BreakpointsNode context, int lineNo, List <ClassificationSpan> collectedSpans) { if (context == null || lineNo < context.Span.StartLine || lineNo > context.Span.EndLine) { return; } Visit(line, context.BreakpointKeywordSpan, lineNo, collectedSpans, _keyword); foreach (var expr in context.Expressions) { Visit(line, expr, lineNo, collectedSpans); } }
/// <summary> /// Visits breakpoint of the test block /// </summary> /// <param name="plan">Test file plan</param> /// <param name="testBlock">TestBlockPlan to visit</param> /// <param name="breakpoints">Breakpoints syntax node</param> private void VisitBreakPoints(TestFilePlan plan, TestBlockPlan testBlock, BreakpointsNode breakpoints) { if (breakpoints == null) { return; } foreach (var expr in breakpoints.Expressions) { var value = Eval(plan, testBlock, expr, true); if (value == null) { continue; } testBlock.Breakpoints.Add(expr); } }