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 VisitDirectiveBlock(DirectiveChunkGenerator chunkGenerator, Block block)
            {
                if (_nestedLevel > 0)
                {
                    var directiveStart = block.Children.First(child => !child.IsBlock && ((Span)child).Kind == SpanKindInternal.Transition).Start;
                    var errorLength    = /* @ */ 1 + SectionDirective.Directive.Directive.Length;
                    var error          = RazorDiagnosticFactory.CreateParsing_SectionsCannotBeNested(new SourceSpan(directiveStart, errorLength));
                    chunkGenerator.Diagnostics.Add(error);
                }

                _nestedLevel++;

                VisitDefault(block);

                _nestedLevel--;
            }
예제 #3
0
            public override void VisitDirectiveBlock(DirectiveChunkGenerator chunkGenerator, Block block)
            {
                if (_nestedLevel > 0)
                {
                    var directiveStart = block.Children.First(child => !child.IsBlock && ((Span)child).Kind == SpanKindInternal.Transition).Start;
                    var errorLength    = /* @ */ 1 + SectionDirective.Directive.Directive.Length;
                    var error          = RazorDiagnostic.Create(
                        new RazorError(
                            LegacyResources.FormatParseError_Sections_Cannot_Be_Nested(LegacyResources.SectionExample_CS),
                            directiveStart,
                            errorLength));
                    chunkGenerator.Diagnostics.Add(error);
                }

                _nestedLevel++;

                VisitDefault(block);

                _nestedLevel--;
            }
예제 #4
0
 public virtual void VisitDirectiveBlock(DirectiveChunkGenerator chunkGenerator, Block block)
 {
     VisitDefault(block);
 }