public override void VisitDirectiveBlock(DirectiveChunkGenerator chunkGenerator, Block block) { IntermediateNode directiveNode; if (IsMalformed(chunkGenerator.Diagnostics)) { directiveNode = new MalformedDirectiveIntermediateNode() { DirectiveName = chunkGenerator.Descriptor.Directive, Directive = chunkGenerator.Descriptor, Source = BuildSourceSpanFromNode(block), }; } else { directiveNode = new DirectiveIntermediateNode() { DirectiveName = chunkGenerator.Descriptor.Directive, Directive = chunkGenerator.Descriptor, Source = BuildSourceSpanFromNode(block), }; } for (var i = 0; i < chunkGenerator.Diagnostics.Count; i++) { directiveNode.Diagnostics.Add(chunkGenerator.Diagnostics[i]); } _builder.Push(directiveNode); VisitDefault(block); _builder.Pop(); }
public override void VisitRazorDirective(RazorDirectiveSyntax node) { IntermediateNode directiveNode; var descriptor = node.DirectiveDescriptor; if (descriptor != null) { var diagnostics = node.GetDiagnostics(); // This is an extensible directive. if (IsMalformed(diagnostics)) { directiveNode = new MalformedDirectiveIntermediateNode() { DirectiveName = descriptor.Directive, Directive = descriptor, Source = BuildSourceSpanFromNode(node), }; } else { directiveNode = new DirectiveIntermediateNode() { DirectiveName = descriptor.Directive, Directive = descriptor, Source = BuildSourceSpanFromNode(node), }; } for (var i = 0; i < diagnostics.Length; i++) { directiveNode.Diagnostics.Add(diagnostics[i]); } _builder.Push(directiveNode); } Visit(node.Body); if (descriptor != null) { _builder.Pop(); } }
public override IntermediateNode Pop() => _innerBuilder.Pop();