public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
        {
            if (context.Host.DesignTimeMode)
            {
                return; // Don't generate anything!
            }
            context.FlushBufferedStatement();
            context.AddStatement(context.BuildCodeString(cw =>
            {
                if (!String.IsNullOrEmpty(context.TargetWriterName))
                {
                    cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteAttributeToMethodName);
                    cw.WriteSnippet(context.TargetWriterName);
                    cw.WriteParameterSeparator();
                }
                else
                {
                    cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteAttributeMethodName);
                }
                cw.WriteStringLiteral(Name);
                cw.WriteParameterSeparator();
                cw.WriteLocationTaggedString(Prefix);
                cw.WriteParameterSeparator();
                cw.WriteLocationTaggedString(Suffix);

                // In VB, we need a line continuation
                cw.WriteLineContinuation();
            }));
        }
Пример #2
0
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            context.FlushBufferedStatement();

            string generatedCode = context.BuildCodeString(
                cw =>
            {
                cw.WriteSnippet(target.Content);
            }
                );

            int startGeneratedCode = target.Start.CharacterIndex;
            int paddingCharCount;

            generatedCode = CodeGeneratorPaddingHelper.PadStatement(
                context.Host,
                generatedCode,
                target,
                ref startGeneratedCode,
                out paddingCharCount
                );

            context.AddStatement(
                generatedCode,
                context.GenerateLinePragma(target, paddingCharCount)
                );
        }
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            context.FlushBufferedStatement();

            string generatedCode = context.BuildCodeString(cw =>
            {
                cw.WriteSnippet(target.Content);
            });

            int startGeneratedCode = target.Start.CharacterIndex;
            generatedCode = Pad(generatedCode, target);

            // Is this the span immediately following "@"?
            if (context.Host.DesignTimeMode &&
                !String.IsNullOrEmpty(generatedCode) &&
                Char.IsWhiteSpace(generatedCode[0]) &&
                target.Previous != null &&
                target.Previous.Kind == SpanKind.Transition &&
                String.Equals(target.Previous.Content, SyntaxConstants.TransitionString))
            {
                generatedCode = generatedCode.Substring(1);
                startGeneratedCode--;
            }

            context.AddStatement(
                generatedCode,
                context.GenerateLinePragma(target, startGeneratedCode));
        }
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            context.FlushBufferedStatement();

            string generatedCode = context.BuildCodeString(cw =>
            {
                cw.WriteSnippet(target.Content);
            });

            int startGeneratedCode = target.Start.CharacterIndex;

            generatedCode = Pad(generatedCode, target);

            // Is this the span immediately following "@"?
            if (context.Host.DesignTimeMode &&
                !String.IsNullOrEmpty(generatedCode) &&
                Char.IsWhiteSpace(generatedCode[0]) &&
                target.Previous != null &&
                target.Previous.Kind == SpanKind.Transition &&
                String.Equals(target.Previous.Content, SyntaxConstants.TransitionString))
            {
                generatedCode = generatedCode.Substring(1);
                startGeneratedCode--;
            }

            context.AddStatement(
                generatedCode,
                context.GenerateLinePragma(target, startGeneratedCode));
        }
        public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
        {
            if (context.Host.DesignTimeMode)
            {
                return; // Don't generate anything!
            }
            context.FlushBufferedStatement();
            context.AddStatement(context.BuildCodeString(cw =>
            {
                if (!String.IsNullOrEmpty(context.TargetWriterName))
                {
                    cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteAttributeToMethodName);
                    cw.WriteSnippet(context.TargetWriterName);
                    cw.WriteParameterSeparator();
                }
                else
                {
                    cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteAttributeMethodName);
                }
                cw.WriteStringLiteral(Name);
                cw.WriteParameterSeparator();
                cw.WriteLocationTaggedString(Prefix);
                cw.WriteParameterSeparator();
                cw.WriteLocationTaggedString(Suffix);

                // In VB, we need a line continuation
                cw.WriteLineContinuation();
            }));
        }
		public override void GenerateStartBlockCode (Block target, CodeGeneratorContext context)
		{
			if (context.Host.DesignTimeMode)
				return;

			context.FlushBufferedStatement();

			var sb = new StringBuilder ();
			if (!string.IsNullOrEmpty (context.TargetWriterName)) {
				sb.AppendFormat (
					"{0} ({1}, ",
					context.Host.GeneratedClassContext.WriteAttributeToMethodName,
					context.TargetWriterName
				);
			} else {
				sb.AppendFormat (
					"{0} (",
					context.Host.GeneratedClassContext.WriteAttributeMethodName
				);
			}
			sb.WriteCStyleStringLiteral (Name);
			sb.Append (", ");
			sb.WriteCStyleStringLiteral (Prefix);
			sb.Append (", ");
			sb.WriteCStyleStringLiteral (Suffix);

			context.AddStatement (sb.ToString ());
		}
Пример #7
0
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            if (!context.Host.DesignTimeMode && String.IsNullOrEmpty(target.Content))
            {
                return;
            }

            if (!String.IsNullOrEmpty(target.Content) && !context.Host.DesignTimeMode)
            {
                string code = context.BuildCodeString(cw =>
                {
                    if (!String.IsNullOrEmpty(context.TargetWriterName))
                    {
                        cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteLiteralToMethodName);
                        cw.WriteSnippet(context.TargetWriterName);
                        cw.WriteParameterSeparator();
                    }
                    else
                    {
                        cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteLiteralMethodName);
                    }
                    cw.WriteStringLiteral(target.Content);
                    cw.WriteEndMethodInvoke();
                    cw.WriteEndStatement();
                });
                context.AddStatement(code);
            }
        }
		public override void GenerateCode (Span target, CodeGeneratorContext context)
		{
			if (context.Host.DesignTimeMode)
				return;

			ExpressionRenderingMode oldMode = context.GetExpressionRenderingMode ();

			var sb = new StringBuilder ();
			sb.Append (", Tuple.Create<string,object,bool> (");
			sb.WriteCStyleStringLiteral (Prefix.Value);
			sb.Append (", ");

			if (ValueGenerator != null) {
				context.SetExpressionRenderingMode (ExpressionRenderingMode.InjectCode);
			} else {
				sb.WriteCStyleStringLiteral (Value);
				sb.Append (", true)");
			}
			context.BufferStatementFragment (sb.ToString ());

			if (ValueGenerator != null) {
				ValueGenerator.Value.GenerateCode (target, context);
				context.FlushBufferedStatement ();
				context.SetExpressionRenderingMode (oldMode);
				context.AddStatement (", false)");
			} else {
				context.FlushBufferedStatement ();
			}
		}
		public override void GenerateEndBlockCode (Block target, CodeGeneratorContext context)
		{
			if (context.Host.DesignTimeMode)
				return;

			context.FlushBufferedStatement ();
			context.AddStatement (");");
		}
Пример #10
0
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            // Check if the host supports it
            if (String.IsNullOrEmpty(context.Host.GeneratedClassContext.ResolveUrlMethodName))
            {
                // Nope, just use the default MarkupCodeGenerator behavior
                new MarkupCodeGenerator().GenerateCode(target, context);
                return;
            }

            if (!context.Host.DesignTimeMode && String.IsNullOrEmpty(target.Content))
            {
                return;
            }

            if (!String.IsNullOrEmpty(target.Content) && !context.Host.DesignTimeMode)
            {
                string code = context.BuildCodeString(cw =>
                {
                    if (context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
                    {
                        if (!String.IsNullOrEmpty(context.TargetWriterName))
                        {
                            cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteLiteralToMethodName);
                            cw.WriteSnippet(context.TargetWriterName);
                            cw.WriteParameterSeparator();
                        }
                        else
                        {
                            cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteLiteralMethodName);
                        }
                    }
                    cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.ResolveUrlMethodName);
                    cw.WriteStringLiteral(target.Content);
                    cw.WriteEndMethodInvoke();

                    if (context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
                    {
                        cw.WriteEndMethodInvoke();
                        cw.WriteEndStatement();
                    }
                    else
                    {
                        cw.WriteLineContinuation();
                    }
                });
                if (context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
                {
                    context.AddStatement(code);
                }
                else
                {
                    context.BufferStatementFragment(code);
                }
            }
        }
 public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
 {
     string startBlock = context.BuildCodeString(cw =>
     {
         cw.WriteEndLambdaDelegate();
         cw.WriteEndMethodInvoke();
         cw.WriteEndStatement();
     });
     context.AddStatement(startBlock);
 }
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            if (context.Host.DesignTimeMode)
            {
                return;
            }
            ExpressionRenderingMode oldMode = context.ExpressionRenderingMode;

            context.BufferStatementFragment(context.BuildCodeString(cw =>
            {
                cw.WriteParameterSeparator();
                cw.WriteStartMethodInvoke("Tuple.Create");
                cw.WriteLocationTaggedString(Prefix);
                cw.WriteParameterSeparator();
                if (ValueGenerator != null)
                {
                    cw.WriteStartMethodInvoke("Tuple.Create", "System.Object", "System.Int32");
                    context.ExpressionRenderingMode = ExpressionRenderingMode.InjectCode;
                }
                else
                {
                    cw.WriteLocationTaggedString(Value);
                    cw.WriteParameterSeparator();
                    // literal: true - This attribute value is a literal value
                    cw.WriteBooleanLiteral(true);
                    cw.WriteEndMethodInvoke();

                    // In VB, we need a line continuation
                    cw.WriteLineContinuation();
                }
            }));
            if (ValueGenerator != null)
            {
                ValueGenerator.Value.GenerateCode(target, context);
                context.FlushBufferedStatement();
                context.ExpressionRenderingMode = oldMode;
                context.AddStatement(context.BuildCodeString(cw =>
                {
                    cw.WriteParameterSeparator();
                    cw.WriteSnippet(ValueGenerator.Location.AbsoluteIndex.ToString(CultureInfo.CurrentCulture));
                    cw.WriteEndMethodInvoke();
                    cw.WriteParameterSeparator();
                    // literal: false - This attribute value is not a literal value, it is dynamically generated
                    cw.WriteBooleanLiteral(false);
                    cw.WriteEndMethodInvoke();

                    // In VB, we need a line continuation
                    cw.WriteLineContinuation();
                }));
            }
            else
            {
                context.FlushBufferedStatement();
            }
        }
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            if (context.Host.DesignTimeMode)
            {
                return;
            }
            ExpressionRenderingMode oldMode = context.ExpressionRenderingMode;
            context.BufferStatementFragment(context.BuildCodeString(cw =>
            {
                cw.WriteParameterSeparator();
                cw.WriteStartMethodInvoke("Tuple.Create");
                cw.WriteLocationTaggedString(Prefix);
                cw.WriteParameterSeparator();
                if (ValueGenerator != null)
                {
                    cw.WriteStartMethodInvoke("Tuple.Create", "System.Object", "System.Int32");
                    context.ExpressionRenderingMode = ExpressionRenderingMode.InjectCode;
                }
                else
                {
                    cw.WriteLocationTaggedString(Value);
                    cw.WriteParameterSeparator();
                    // literal: true - This attribute value is a literal value
                    cw.WriteBooleanLiteral(true);
                    cw.WriteEndMethodInvoke();

                    // In VB, we need a line continuation
                    cw.WriteLineContinuation();
                }
            }));
            if (ValueGenerator != null)
            {
                ValueGenerator.Value.GenerateCode(target, context);
                context.FlushBufferedStatement();
                context.ExpressionRenderingMode = oldMode;
                context.AddStatement(context.BuildCodeString(cw =>
                {
                    cw.WriteParameterSeparator();
                    cw.WriteSnippet(ValueGenerator.Location.AbsoluteIndex.ToString(CultureInfo.CurrentCulture));
                    cw.WriteEndMethodInvoke();
                    cw.WriteParameterSeparator();
                    // literal: false - This attribute value is not a literal value, it is dynamically generated
                    cw.WriteBooleanLiteral(false);
                    cw.WriteEndMethodInvoke();

                    // In VB, we need a line continuation
                    cw.WriteLineContinuation();
                }));
            }
            else
            {
                context.FlushBufferedStatement();
            }
        }
Пример #14
0
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            // Build the string
            string code = Prefix + target.Content + ";";

            // Calculate the line pragma including information about where the user-specified code starts and ends (for editors)
            CodeLinePragma pragma = context.GenerateLinePragma(target, Prefix.Length, target.Content.Length);

            // Add the statement
            context.AddStatement(code, pragma);
        }
 public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
 {
     string startBlock = context.BuildCodeString(cw =>
     {
         cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.DefineSectionMethodName);
         cw.WriteStringLiteral(SectionName);
         cw.WriteParameterSeparator();
         cw.WriteStartLambdaDelegate();
     });
     context.AddStatement(startBlock);
 }
Пример #16
0
        public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
        {
            string startBlock = context.BuildCodeString(cw =>
            {
                cw.WriteEndLambdaDelegate();
                cw.WriteEndMethodInvoke();
                cw.WriteEndStatement();
            });

            context.AddStatement(startBlock);
        }
Пример #17
0
        public override void GenerateStartBlockCode(Block target, CodeGeneratorContext context)
        {
            string startBlock = context.BuildCodeString(cw =>
            {
                cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.DefineSectionMethodName);
                cw.WriteStringLiteral(SectionName);
                cw.WriteParameterSeparator();
                cw.WriteStartLambdaDelegate();
            });

            context.AddStatement(startBlock);
        }
Пример #18
0
        public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
        {
            if (context.Host.DesignTimeMode)
            {
                return; // Don't generate anything!
            }

            string generatedCode;

            if (_isExpression)
            {
                generatedCode = context.BuildCodeString(
                    cw =>
                {
                    cw.WriteParameterSeparator();
                    cw.WriteSnippet(
                        ValueStart.AbsoluteIndex.ToString(CultureInfo.CurrentCulture)
                        );
                    cw.WriteEndMethodInvoke();
                    cw.WriteParameterSeparator();
                    // literal: false - This attribute value is not a literal value, it is dynamically generated
                    cw.WriteBooleanLiteral(false);
                    cw.WriteEndMethodInvoke();
                    cw.WriteLineContinuation();
                }
                    );
                context.ExpressionRenderingMode = _oldRenderingMode;
            }
            else
            {
                generatedCode = context.BuildCodeString(
                    cw =>
                {
                    cw.WriteEndLambdaDelegate();
                    cw.WriteEndConstructor();
                    cw.WriteParameterSeparator();
                    cw.WriteSnippet(
                        ValueStart.AbsoluteIndex.ToString(CultureInfo.CurrentCulture)
                        );
                    cw.WriteEndMethodInvoke();
                    cw.WriteParameterSeparator();
                    // literal: false - This attribute value is not a literal value, it is dynamically generated
                    cw.WriteBooleanLiteral(false);
                    cw.WriteEndMethodInvoke();
                    cw.WriteLineContinuation();
                }
                    );
            }

            context.AddStatement(generatedCode);
            context.TargetWriterName = _oldTargetWriter;
        }
 public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
 {
     if (context.Host.DesignTimeMode)
     {
         return; // Don't generate anything!
     }
     context.FlushBufferedStatement();
     context.AddStatement(context.BuildCodeString(cw =>
     {
         cw.WriteEndMethodInvoke();
         cw.WriteEndStatement();
     }));
 }
 public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
 {
     if (context.Host.DesignTimeMode)
     {
         return; // Don't generate anything!
     }
     context.FlushBufferedStatement();
     context.AddStatement(context.BuildCodeString(cw =>
     {
         cw.WriteEndMethodInvoke();
         cw.WriteEndStatement();
     }));
 }
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            context.FlushBufferedStatement();

            string generatedCode = context.BuildCodeString(cw =>
            {
                cw.WriteSnippet(target.Content);
            });

            int startGeneratedCode = target.Start.CharacterIndex;
            int paddingCharCount;
            generatedCode = CodeGeneratorPaddingHelper.PadStatement(context.Host, generatedCode, target, ref startGeneratedCode, out paddingCharCount);

            context.AddStatement(
                generatedCode,
                context.GenerateLinePragma(target, paddingCharCount));
        }
Пример #22
0
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            if (!context.Host.DesignTimeMode && String.IsNullOrEmpty(target.Content))
            {
                return;
            }

            if (context.Host.EnableInstrumentation)
            {
                context.AddContextCall(target, context.Host.GeneratedClassContext.BeginContextMethodName, isLiteral: true);
            }

            if (!String.IsNullOrEmpty(target.Content) && !context.Host.DesignTimeMode)
            {
                string code = context.BuildCodeString(cw =>
                {
                    if (!String.IsNullOrEmpty(context.TargetWriterName))
                    {
                        cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteLiteralToMethodName);
                        cw.WriteSnippet(context.TargetWriterName);
                        cw.WriteParameterSeparator();
                    }
                    else
                    {
                        cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteLiteralMethodName);
                    }
                    cw.WriteStringLiteral(target.Content);
                    cw.WriteEndMethodInvoke();
                    cw.WriteEndStatement();
                });
                context.AddStatement(code);
            }

            if (context.Host.EnableInstrumentation)
            {
                context.AddContextCall(target, context.Host.GeneratedClassContext.EndContextMethodName, isLiteral: true);
            }
        }
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            // Check if the host supports it
            if (String.IsNullOrEmpty(context.Host.GeneratedClassContext.ResolveUrlMethodName))
            {
                // Nope, just use the default MarkupCodeGenerator behavior
                new MarkupCodeGenerator().GenerateCode(target, context);
                return;
            }

            if (!context.Host.DesignTimeMode && String.IsNullOrEmpty(target.Content))
            {
                return;
            }

            if (context.Host.EnableInstrumentation && context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
            {
                // Add a non-literal context call (non-literal because the expanded URL will not match the source character-by-character)
                context.AddContextCall(target, context.Host.GeneratedClassContext.BeginContextMethodName, isLiteral: false);
            }

            if (!String.IsNullOrEmpty(target.Content) && !context.Host.DesignTimeMode)
            {
                string code = context.BuildCodeString(cw =>
                {
                    if (context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
                    {
                        if (!String.IsNullOrEmpty(context.TargetWriterName))
                        {
                            cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteLiteralToMethodName);
                            cw.WriteSnippet(context.TargetWriterName);
                            cw.WriteParameterSeparator();
                        }
                        else
                        {
                            cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteLiteralMethodName);
                        }
                    }
                    cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.ResolveUrlMethodName);
                    cw.WriteStringLiteral(target.Content);
                    cw.WriteEndMethodInvoke();

                    if (context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
                    {
                        cw.WriteEndMethodInvoke();
                        cw.WriteEndStatement();
                    }
                    else
                    {
                        cw.WriteLineContinuation();
                    }
                });
                if (context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
                {
                    context.AddStatement(code);
                }
                else
                {
                    context.BufferStatementFragment(code);
                }
            }

            if (context.Host.EnableInstrumentation && context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
            {
                context.AddContextCall(target, context.Host.GeneratedClassContext.EndContextMethodName, isLiteral: false);
            }
        }
        public override void GenerateEndBlockCode(Block target, CodeGeneratorContext context)
        {
            if (context.Host.DesignTimeMode)
            {
                return; // Don't generate anything!
            }

            string generatedCode;
            if (_isExpression)
            {
                generatedCode = context.BuildCodeString(cw =>
                {
                    cw.WriteParameterSeparator();
                    cw.WriteSnippet(ValueStart.AbsoluteIndex.ToString(CultureInfo.CurrentCulture));
                    cw.WriteEndMethodInvoke();
                    cw.WriteParameterSeparator();
                    // literal: false - This attribute value is not a literal value, it is dynamically generated
                    cw.WriteBooleanLiteral(false);
                    cw.WriteEndMethodInvoke();
                    cw.WriteLineContinuation();
                });
                context.ExpressionRenderingMode = _oldRenderingMode;
            }
            else
            {
                generatedCode = context.BuildCodeString(cw =>
                {
                    cw.WriteEndLambdaDelegate();
                    cw.WriteEndConstructor();
                    cw.WriteParameterSeparator();
                    cw.WriteSnippet(ValueStart.AbsoluteIndex.ToString(CultureInfo.CurrentCulture));
                    cw.WriteEndMethodInvoke();
                    cw.WriteParameterSeparator();
                    // literal: false - This attribute value is not a literal value, it is dynamically generated
                    cw.WriteBooleanLiteral(false);
                    cw.WriteEndMethodInvoke();
                    cw.WriteLineContinuation();
                });
            }

            context.AddStatement(generatedCode);
            context.TargetWriterName = _oldTargetWriter;
        }
        public override void GenerateCode(Span target, CodeGeneratorContext context)
        {
            // Check if the host supports it
            if (String.IsNullOrEmpty(context.Host.GeneratedClassContext.ResolveUrlMethodName))
            {
                // Nope, just use the default MarkupCodeGenerator behavior
                new MarkupCodeGenerator().GenerateCode(target, context);
                return;
            }

            if (!context.Host.DesignTimeMode && String.IsNullOrEmpty(target.Content))
            {
                return;
            }

            if (context.Host.EnableInstrumentation && context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
            {
                // Add a non-literal context call (non-literal because the expanded URL will not match the source character-by-character)
                context.AddContextCall(target, context.Host.GeneratedClassContext.BeginContextMethodName, isLiteral: false);
            }

            if (!String.IsNullOrEmpty(target.Content) && !context.Host.DesignTimeMode)
            {
                string code = context.BuildCodeString(cw =>
                {
                    if (context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
                    {
                        if (!String.IsNullOrEmpty(context.TargetWriterName))
                        {
                            cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteLiteralToMethodName);
                            cw.WriteSnippet(context.TargetWriterName);
                            cw.WriteParameterSeparator();
                        }
                        else
                        {
                            cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.WriteLiteralMethodName);
                        }
                    }
                    cw.WriteStartMethodInvoke(context.Host.GeneratedClassContext.ResolveUrlMethodName);
                    cw.WriteStringLiteral(target.Content);
                    cw.WriteEndMethodInvoke();

                    if (context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
                    {
                        cw.WriteEndMethodInvoke();
                        cw.WriteEndStatement();
                    }
                    else
                    {
                        cw.WriteLineContinuation();
                    }
                });
                if (context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
                {
                    context.AddStatement(code);
                }
                else
                {
                    context.BufferStatementFragment(code);
                }
            }

            if (context.Host.EnableInstrumentation && context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
            {
                context.AddContextCall(target, context.Host.GeneratedClassContext.EndContextMethodName, isLiteral: false);
            }
        }
		public override void GenerateEndBlockCode (Block target, CodeGeneratorContext context)
		{
			if (context.Host.DesignTimeMode)
				return;

			var sb = new StringBuilder ();
			if (isExpression) {
				sb.Append (", false)");
				context.SetExpressionRenderingMode (oldRenderingMode);
			} else {
				sb.Append ("}), false)");
			}

			context.AddStatement (sb.ToString ());
			context.TargetWriterName = oldTargetWriter;
		}