/// <summary> /// Writes code for the given <paramref name="chunk"/>. /// </summary> /// <param name="chunk">The <see cref="SectionChunk"/> to render.</param> /// <remarks> /// Unconditionally adds a <see cref="RazorError"/> to inform user of unexpected <c>@section</c> directive. /// </remarks> protected override void Visit(SectionChunk chunk) { Context.ErrorSink.OnError( chunk.Association.Start, RazorResources.FormatTagHelpers_Directives_NotSupported_InAttributes( SyntaxConstants.CSharp.SectionKeyword), chunk.Association.Length); }
protected override void Visit(SectionChunk chunk) { using (_context.Builder.BuildBlock <RenderSection>(sectionBlock => { sectionBlock.Name = chunk.Name; })) { Accept(chunk.Children); } }
protected override void Visit(SectionChunk chunk) { Writer.WriteStartMethodInvocation(Context.Host.GeneratedClassContext.DefineSectionMethodName) .WriteStringLiteral(chunk.Name) .WriteParameterSeparator(); var currentTargetWriterName = Context.TargetWriterName; Context.TargetWriterName = TemplateWriterName; using (Writer.BuildAsyncLambda(endLine: false, parameterNames: TemplateWriterName)) { Accept(chunk.Children); } Context.TargetWriterName = currentTargetWriterName; Writer.WriteEndMethodInvocation(); }
protected override void Visit(SectionChunk chunk) { }
protected virtual void Visit(SectionChunk chunk) { }
protected abstract void Visit(SectionChunk chunk);