Updating CSharpCodeVisitor to generate implicit expressions on a single

line

Fixing 151
This commit is contained in:
Pranav K 2014-09-25 12:10:43 -07:00
parent e5f157565c
commit f913d8929f
30 changed files with 343 additions and 499 deletions

View File

@ -180,9 +180,27 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
return WriteLine();
}
/// <summary>
/// Writes a <c>#line</c> pragma directive for the line number at the specified <paramref name="location"/>.
/// </summary>
/// <param name="location">The location to generate the line pragma for.</param>
/// <param name="file">The file to generate the line pragma for.</param>
/// <returns>The current instance of <see cref="CSharpCodeWriter"/>.</returns>
public CSharpCodeWriter WriteLineNumberDirective(SourceLocation location, string file)
{
return WriteLineNumberDirective(location.LineIndex + 1, file);
}
public CSharpCodeWriter WriteLineNumberDirective(int lineNumber, string file)
{
return Write("#line ").Write(lineNumber.ToString()).Write(" \"").Write(file).WriteLine("\"");
if (!string.IsNullOrEmpty(LastWrite) &&
!LastWrite.EndsWith(Environment.NewLine, StringComparison.Ordinal))
{
WriteLine();
}
var lineNumberAsString = lineNumber.ToString(CultureInfo.InvariantCulture);
return Write("#line ").Write(lineNumberAsString).Write(" \"").Write(file).WriteLine("\"");
}
public CSharpCodeWriter WriteStartMethodInvocation(string methodName)

View File

@ -2,7 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Linq;
using Microsoft.AspNet.Razor.Text;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
@ -15,16 +14,21 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
private int _startIndent;
private int _generatedContentLength;
private bool _writePragmas;
private bool _addLineMapping;
public CSharpLineMappingWriter(CSharpCodeWriter writer, SourceLocation documentLocation, int contentLength)
private CSharpLineMappingWriter([NotNull] CSharpCodeWriter writer,
bool addLineMappings)
{
_writer = writer;
_documentMapping = new MappingLocation(documentLocation, contentLength);
_addLineMapping = addLineMappings;
_startIndent = _writer.CurrentIndent;
_generatedContentLength = 0;
_writer.ResetIndent();
}
public CSharpLineMappingWriter(CSharpCodeWriter writer, SourceLocation documentLocation, int contentLength)
: this(writer, addLineMappings: true)
{
_documentMapping = new MappingLocation(documentLocation, contentLength);
_generatedLocation = _writer.GetCurrentSourceLocation();
}
@ -33,17 +37,27 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{
_writePragmas = true;
// TODO: Should this just be '\n'?
if (!_writer.LastWrite.EndsWith("\n"))
{
_writer.WriteLine();
}
_writer.WriteLineNumberDirective(documentLocation.LineIndex + 1, sourceFilename);
_writer.WriteLineNumberDirective(documentLocation, sourceFilename);
_generatedLocation = _writer.GetCurrentSourceLocation();
}
/// <summary>
/// Initializes a new instance of <see cref="CSharpLineMappingWriter"/> used for generation of runtime
/// line mappings. The constructed instance of <see cref="CSharpLineMappingWriter"/> does not track
/// mappings between the Razor content and the generated content.
/// </summary>
/// <param name="writer">The <see cref="CSharpCodeWriter"/> to write output to.</param>
/// <param name="documentLocation">The <see cref="SourceLocation"/> of the Razor content being mapping.</param>
/// <param name="sourceFileName">The input file path.</param>
public CSharpLineMappingWriter([NotNull] CSharpCodeWriter writer,
[NotNull] SourceLocation documentLocation,
[NotNull] string sourceFileName)
: this(writer, addLineMappings: false)
{
_writePragmas = true;
_writer.WriteLineNumberDirective(documentLocation, sourceFileName);
}
public void MarkLineMappingStart()
{
_generatedLocation = _writer.GetCurrentSourceLocation();
@ -54,9 +68,9 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
_generatedContentLength = _writer.GenerateCode().Length - _generatedLocation.AbsoluteIndex;
}
protected virtual void Dispose(bool disposing)
public void Dispose()
{
if(disposing)
if (_addLineMapping)
{
// Verify that the generated length has not already been calculated
if (_generatedContentLength == 0)
@ -73,34 +87,29 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
_writer.LineMappingManager.AddMapping(
documentLocation: _documentMapping,
generatedLocation: new MappingLocation(_generatedLocation, _generatedContentLength));
}
if (_writePragmas)
if (_writePragmas)
{
// Need to add an additional line at the end IF there wasn't one already written.
// This is needed to work with the C# editor's handling of #line ...
bool endsWithNewline = _writer.GenerateCode().EndsWith("\n");
// Always write at least 1 empty line to potentially separate code from pragmas.
_writer.WriteLine();
// Check if the previous empty line wasn't enough to separate code from pragmas.
if (!endsWithNewline)
{
// Need to add an additional line at the end IF there wasn't one already written.
// This is needed to work with the C# editor's handling of #line ...
bool endsWithNewline = _writer.GenerateCode().EndsWith("\n");
// Always write at least 1 empty line to potentially separate code from pragmas.
_writer.WriteLine();
// Check if the previous empty line wasn't enough to separate code from pragmas.
if (!endsWithNewline)
{
_writer.WriteLine();
}
_writer.WriteLineDefaultDirective()
.WriteLineHiddenDirective();
}
// Reset indent back to when it was started
_writer.SetIndent(_startIndent);
_writer.WriteLineDefaultDirective()
.WriteLineHiddenDirective();
}
}
public void Dispose()
{
Dispose(disposing: true);
// Reset indent back to when it was started
_writer.SetIndent(_startIndent);
}
}
}

View File

@ -149,7 +149,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
protected override void Visit(ExpressionChunk chunk)
{
CreateExpressionCodeMapping(chunk.Code, chunk);
Writer.Write(chunk.Code);
}
protected override void Visit(StatementChunk chunk)
@ -343,28 +343,17 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
public void RenderRuntimeExpressionBlockChunk(ExpressionBlockChunk chunk)
{
var generateInstrumentation = ShouldGenerateInstrumentationForExpressions();
Span contentSpan = null;
// For expression chunks, such as @value, @(value) etc, pick the first Code or Markup span
// from the expression (in this case "value") and use that to calculate the length. This works
// accurately for most parts. The scenarios that don't work are
// (a) Expressions with inline comments (e.g. @(a @* comment *@ b)) - these have multiple code spans
// (b) Expressions with inline templates (e.g. @Foo(@<p>Hello world</p>)).
// Tracked via https://github.com/aspnet/Razor/issues/153
if (generateInstrumentation)
{
// For expression chunks, such as @value, @(value) etc, pick the first Code or Markup span
// from the expression (in this case "value") and use that to calculate the length. This works
// accurately for most parts. The scenarios that don't work are
// (a) Expressions with inline comments (e.g. @(a @* comment *@ b)) - these have multiple code spans
// (b) Expressions with inline templates (e.g. @Foo(@<p>Hello world</p>)).
// Tracked via https://github.com/aspnet/Razor/issues/153
var block = (Block)chunk.Association;
contentSpan = block.Children
.OfType<Span>()
.FirstOrDefault(s => s.Kind == SpanKind.Code || s.Kind == SpanKind.Markup);
if (contentSpan != null)
{
Writer.WriteStartInstrumentationContext(Context, contentSpan, isLiteral: false);
}
}
var block = (Block)chunk.Association;
var contentSpan = block.Children
.OfType<Span>()
.FirstOrDefault(s => s.Kind == SpanKind.Code || s.Kind == SpanKind.Markup);
if (Context.ExpressionRenderingMode == ExpressionRenderingMode.InjectCode)
{
@ -372,39 +361,86 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
}
else if (Context.ExpressionRenderingMode == ExpressionRenderingMode.WriteToOutput)
{
if (!String.IsNullOrEmpty(Context.TargetWriterName))
if (contentSpan != null)
{
Writer.WriteStartMethodInvocation(Context.Host.GeneratedClassContext.WriteToMethodName)
.Write(Context.TargetWriterName)
.WriteParameterSeparator();
RenderRuntimeExpressionBlockChunkWithContentSpan(chunk, contentSpan);
}
else
{
Writer.WriteStartMethodInvocation(Context.Host.GeneratedClassContext.WriteMethodName);
if (!string.IsNullOrEmpty(Context.TargetWriterName))
{
Writer.WriteStartMethodInvocation(Context.Host.GeneratedClassContext.WriteToMethodName)
.Write(Context.TargetWriterName)
.WriteParameterSeparator();
}
else
{
Writer.WriteStartMethodInvocation(Context.Host.GeneratedClassContext.WriteMethodName);
}
Accept(chunk.Children);
Writer.WriteEndMethodInvocation()
.WriteLine();
}
}
}
private void RenderRuntimeExpressionBlockChunkWithContentSpan(ExpressionBlockChunk chunk, Span contentSpan)
{
var generateInstrumentation = ShouldGenerateInstrumentationForExpressions();
if (generateInstrumentation)
{
Writer.WriteStartInstrumentationContext(Context, contentSpan, isLiteral: false);
}
using (var mappingWriter = new CSharpLineMappingWriter(Writer, chunk.Start, Context.SourceFile))
{
if (!string.IsNullOrEmpty(Context.TargetWriterName))
{
var generatedStart = Context.Host.GeneratedClassContext.WriteToMethodName.Length +
Context.TargetWriterName.Length +
3; // 1 for the opening '(' and 2 for ', '
var padding = _paddingBuilder.BuildExpressionPadding(contentSpan, generatedStart);
Writer.Write(padding)
.WriteStartMethodInvocation(Context.Host.GeneratedClassContext.WriteToMethodName)
.Write(Context.TargetWriterName)
.WriteParameterSeparator();
}
else
{
var generatedStart = Context.Host.GeneratedClassContext.WriteMethodName.Length +
1; // for the opening '('
var padding = _paddingBuilder.BuildExpressionPadding(contentSpan, generatedStart);
Writer.Write(padding)
.WriteStartMethodInvocation(Context.Host.GeneratedClassContext.WriteMethodName);
}
Accept(chunk.Children);
Writer.WriteEndMethodInvocation()
.WriteLine();
Writer.WriteEndMethodInvocation();
}
if (contentSpan != null)
if (generateInstrumentation)
{
Writer.WriteEndInstrumentationContext(Context);
}
}
public void CreateExpressionCodeMapping(string code, Chunk chunk)
{
CreateCodeMapping(_paddingBuilder.BuildExpressionPadding((Span)chunk.Association), code, chunk);
}
public void CreateStatementCodeMapping(string code, Chunk chunk)
{
CreateCodeMapping(_paddingBuilder.BuildStatementPadding((Span)chunk.Association), code, chunk);
}
public void CreateExpressionCodeMapping(string code, Chunk chunk)
{
CreateCodeMapping(_paddingBuilder.BuildExpressionPadding((Span)chunk.Association), code, chunk);
}
public void CreateCodeMapping(string padding, string code, Chunk chunk)
{
using (CSharpLineMappingWriter mappingWriter = Writer.BuildLineMapping(chunk.Start, code.Length, Context.SourceFile))

View File

@ -145,8 +145,6 @@ namespace Microsoft.AspNet.Razor.Test.Generator
BuildLineMapping(238, 11, 899, 45, 2, 24),
BuildLineMapping(310, 12, 1036, 51, 45, 3),
BuildLineMapping(323, 14, 2, 1112, 56, 6, 1),
BuildLineMapping(328, 14, 1155, 58, 7, 1)
});
}
@ -296,8 +294,7 @@ namespace Microsoft.AspNet.Razor.Test.Generator
BuildLineMapping(113, 7, 2, 1262, 71, 6, 12),
BuildLineMapping(129, 8, 1, 1343, 76, 6, 4),
BuildLineMapping(142, 8, 1443, 78, 14, 3),
BuildLineMapping(153, 8, 1540, 85, 25, 1),
BuildLineMapping(204, 13, 5, 1725, 95, 6, 3)
BuildLineMapping(204, 13, 5, 1638, 90, 6, 3)
});
}

View File

@ -0,0 +1,91 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Razor.Text;
using Xunit;
namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{
public class CSharpLineMappingWriterTest
{
[Fact]
public void WriterConstructedWithContentLength_AddsLineMappings_OnDispose()
{
// Arrange
var location = new SourceLocation(10, 15, 20);
var expected = new LineMapping(
new MappingLocation(location, 30),
new MappingLocation(new SourceLocation(0, 0, 0), 11));
var writer = new CSharpCodeWriter();
// Act
using (var mappingWriter = new CSharpLineMappingWriter(writer, location, 30))
{
writer.Write("Hello world");
}
// Assert
Assert.Equal("Hello world", writer.GenerateCode());
var mapping = Assert.Single(writer.LineMappingManager.Mappings);
Assert.Equal(expected, mapping);
}
[Fact]
public void WriterConstructedWithContentLengthAndSourceFile_AddsLineMappingsAndLinePragmas_OnDispose()
{
// Arrange
var location = new SourceLocation(10, 1, 20);
var expected = string.Join(Environment.NewLine,
@"#line 2 ""myfile""",
"Hello world",
"",
"#line default",
"#line hidden",
"");
var expectedMappings = new LineMapping(
new MappingLocation(location, 30),
new MappingLocation(new SourceLocation(18, 1, 0), 11));
var writer = new CSharpCodeWriter();
// Act
using (var mappingWriter = new CSharpLineMappingWriter(writer, location, 30, "myfile"))
{
writer.Write("Hello world");
}
// Assert
Assert.Equal(expected, writer.GenerateCode());
var mapping = Assert.Single(writer.LineMappingManager.Mappings);
Assert.Equal(expectedMappings, mapping);
}
[Fact]
public void WriterConstructedWithoutContentLengthAndSourceFile_AddsLinePragmas_OnDispose()
{
// Arrange
var location = new SourceLocation(10, 1, 20);
var expected = string.Join(Environment.NewLine,
@"#line 2 ""myfile""",
"Hello world",
"",
"#line default",
"#line hidden",
"");
var expectedMappings = new LineMapping(
new MappingLocation(location, 30),
new MappingLocation(new SourceLocation(18, 1, 0), 11));
var writer = new CSharpCodeWriter();
// Act
using (var mappingWriter = new CSharpLineMappingWriter(writer, location, "myfile"))
{
writer.Write("Hello world");
}
// Assert
Assert.Equal(expected, writer.GenerateCode());
Assert.Empty(writer.LineMappingManager.Mappings);
}
}
}

View File

@ -28,27 +28,21 @@ namespace TestOutput
"ronous Expression: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(192, 11, false);
Write(
#line 10 "Await.cshtml"
await Foo()
Write(await Foo());
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(203, 42, true);
WriteLiteral("</p>\r\n <p>Basic Asynchronous Template: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(247, 11, false);
Write(
#line 11 "Await.cshtml"
await Foo()
Write(await Foo());
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(259, 43, true);
WriteLiteral("</p>\r\n <p>Basic Asynchronous Statement: ");
@ -63,14 +57,11 @@ namespace TestOutput
WriteLiteral("</p>\r\n <p>Basic Asynchronous Statement Nested: <b>");
Instrumentation.EndContext();
Instrumentation.BeginContext(376, 11, false);
Write(
#line 13 "Await.cshtml"
await Foo()
Write(await Foo());
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(387, 5, true);
WriteLiteral("</b> ");
@ -85,54 +76,42 @@ namespace TestOutput
WriteLiteral("</p>\r\n <p>Basic Incomplete Asynchronous Statement: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(448, 5, false);
Write(
#line 14 "Await.cshtml"
await
Write(await);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(453, 124, true);
WriteLiteral("</p>\r\n</section>\r\n\r\n<section>\r\n <h1>Advanced Asynchronous Expression Test</h1>" +
"\r\n <p>Advanced Asynchronous Expression: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(578, 15, false);
Write(
#line 19 "Await.cshtml"
await Foo(1, 2)
Write(await Foo(1, 2));
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(593, 56, true);
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Expression Extended: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(650, 19, false);
Write(
#line 20 "Await.cshtml"
await Foo.Bar(1, 2)
Write(await Foo.Bar(1, 2));
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(669, 45, true);
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Template: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(716, 22, false);
Write(
#line 21 "Await.cshtml"
await Foo("bob", true)
Write(await Foo("bob", true));
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(739, 46, true);
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Statement: ");
@ -156,14 +135,11 @@ namespace TestOutput
WriteLiteral("</p>\r\n <p>Advanced Asynchronous Statement Nested: <b>");
Instrumentation.EndContext();
Instrumentation.BeginContext(966, 27, false);
Write(
#line 24 "Await.cshtml"
await Foo(boolValue: false)
Write(await Foo(boolValue: false));
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(993, 5, true);
WriteLiteral("</b> ");
@ -178,14 +154,11 @@ namespace TestOutput
WriteLiteral("</p>\r\n <p>Advanced Incomplete Asynchronous Statement: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(1057, 19, false);
Write(
#line 25 "Await.cshtml"
await ("wrrronggg")
Write(await ("wrrronggg"));
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(1076, 16, true);
WriteLiteral("</p>\r\n</section>");

View File

@ -34,14 +34,11 @@ namespace TestOutput
WriteLiteral(" <p>Hello from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(69, 1, false);
Write(
#line 6 "Blocks.cshtml"
i
Write(i);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(71, 6, true);
WriteLiteral("</p>\r\n");
@ -114,14 +111,11 @@ namespace TestOutput
WriteLiteral(" <p>Hello again from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(378, 1, false);
Write(
#line 24 "Blocks.cshtml"
j
Write(j);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(380, 6, true);
WriteLiteral("</p>\r\n");
@ -154,14 +148,11 @@ namespace TestOutput
WriteLiteral(" <p>Oh no! An error occurred: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(500, 10, false);
Write(
#line 30 "Blocks.cshtml"
ex.Message
Write(ex.Message);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(511, 6, true);
WriteLiteral("</p>\r\n");
@ -176,14 +167,11 @@ namespace TestOutput
WriteLiteral("\r\n<p>i is now ");
Instrumentation.EndContext();
Instrumentation.BeginContext(535, 1, false);
Write(
#line 33 "Blocks.cshtml"
i
Write(i);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(536, 8, true);
WriteLiteral("</p>\r\n\r\n");

View File

@ -26,57 +26,27 @@ namespace TestOutput
WriteLiteral(" <a href=\"Foo\" />\r\n <p");
Instrumentation.EndContext();
WriteAttribute("class", Tuple.Create(" class=\"", 74), Tuple.Create("\"", 86),
Tuple.Create(Tuple.Create("", 82), Tuple.Create<System.Object, System.Int32>(
#line 5 "ConditionalAttributes.cshtml"
cls
#line default
#line hidden
, 82), false));
Tuple.Create(Tuple.Create("", 82), Tuple.Create<System.Object, System.Int32>(cls, 82), false));
Instrumentation.BeginContext(87, 11, true);
WriteLiteral(" />\r\n <p");
Instrumentation.EndContext();
WriteAttribute("class", Tuple.Create(" class=\"", 98), Tuple.Create("\"", 114), Tuple.Create(Tuple.Create("", 106), Tuple.Create("foo", 106), true),
Tuple.Create(Tuple.Create(" ", 109), Tuple.Create<System.Object, System.Int32>(
#line 6 "ConditionalAttributes.cshtml"
cls
#line default
#line hidden
, 110), false));
Tuple.Create(Tuple.Create(" ", 109), Tuple.Create<System.Object, System.Int32>(cls, 110), false));
Instrumentation.BeginContext(115, 11, true);
WriteLiteral(" />\r\n <p");
Instrumentation.EndContext();
WriteAttribute("class", Tuple.Create(" class=\"", 126), Tuple.Create("\"", 142),
Tuple.Create(Tuple.Create("", 134), Tuple.Create<System.Object, System.Int32>(
#line 7 "ConditionalAttributes.cshtml"
cls
#line default
#line hidden
, 134), false), Tuple.Create(Tuple.Create(" ", 138), Tuple.Create("foo", 139), true));
Tuple.Create(Tuple.Create("", 134), Tuple.Create<System.Object, System.Int32>(cls, 134), false), Tuple.Create(Tuple.Create(" ", 138), Tuple.Create("foo", 139), true));
Instrumentation.BeginContext(143, 31, true);
WriteLiteral(" />\r\n <input type=\"checkbox\"");
Instrumentation.EndContext();
WriteAttribute("checked", Tuple.Create(" checked=\"", 174), Tuple.Create("\"", 187),
Tuple.Create(Tuple.Create("", 184), Tuple.Create<System.Object, System.Int32>(
#line 8 "ConditionalAttributes.cshtml"
ch
#line default
#line hidden
, 184), false));
Tuple.Create(Tuple.Create("", 184), Tuple.Create<System.Object, System.Int32>(ch, 184), false));
Instrumentation.BeginContext(188, 31, true);
WriteLiteral(" />\r\n <input type=\"checkbox\"");
Instrumentation.EndContext();
WriteAttribute("checked", Tuple.Create(" checked=\"", 219), Tuple.Create("\"", 236), Tuple.Create(Tuple.Create("", 229), Tuple.Create("foo", 229), true),
Tuple.Create(Tuple.Create(" ", 232), Tuple.Create<System.Object, System.Int32>(
#line 9 "ConditionalAttributes.cshtml"
ch
#line default
#line hidden
, 233), false));
Tuple.Create(Tuple.Create(" ", 232), Tuple.Create<System.Object, System.Int32>(ch, 233), false));
Instrumentation.BeginContext(237, 11, true);
WriteLiteral(" />\r\n <p");
Instrumentation.EndContext();
@ -89,14 +59,11 @@ namespace TestOutput
#line hidden
Instrumentation.BeginContext(276, 3, false);
WriteTo(__razor_attribute_value_writer,
#line 10 "ConditionalAttributes.cshtml"
cls
WriteTo(__razor_attribute_value_writer, cls);
#line default
#line hidden
);
Instrumentation.EndContext();
#line 10 "ConditionalAttributes.cshtml"
}
@ -114,24 +81,12 @@ namespace TestOutput
WriteLiteral(" />\r\n <script");
Instrumentation.EndContext();
WriteAttribute("src", Tuple.Create(" src=\"", 322), Tuple.Create("\"", 373),
Tuple.Create(Tuple.Create("", 328), Tuple.Create<System.Object, System.Int32>(
#line 12 "ConditionalAttributes.cshtml"
Url.Content("~/Scripts/jquery-1.6.2.min.js")
#line default
#line hidden
, 328), false));
Tuple.Create(Tuple.Create("", 328), Tuple.Create<System.Object, System.Int32>(Url.Content("~/Scripts/jquery-1.6.2.min.js"), 328), false));
Instrumentation.BeginContext(374, 46, true);
WriteLiteral(" type=\"text/javascript\"></script>\r\n <script");
Instrumentation.EndContext();
WriteAttribute("src", Tuple.Create(" src=\"", 420), Tuple.Create("\"", 487),
Tuple.Create(Tuple.Create("", 426), Tuple.Create<System.Object, System.Int32>(
#line 13 "ConditionalAttributes.cshtml"
Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")
#line default
#line hidden
, 426), false));
Tuple.Create(Tuple.Create("", 426), Tuple.Create<System.Object, System.Int32>(Url.Content("~/Scripts/modernizr-2.0.6-development-only.js"), 426), false));
Instrumentation.BeginContext(488, 152, true);
WriteLiteral(" type=\"text/javascript\"></script>\r\n <script src=\"http://ajax.aspnetcdn.com/aja" +
"x/jquery.ui/1.8.16/jquery-ui.min.js\" type=\"text/javascript\"></script>\r\n");

View File

@ -82,12 +82,7 @@ __o = Foo(item => new Template((__razor_template_writer) => {
#line hidden
}
)
#line 9 "DesignTime.cshtml"
)
#line default
#line hidden
;
);
#line default
#line hidden

View File

@ -18,14 +18,11 @@ namespace TestOutput
WriteLiteral("1 + 1 = ");
Instrumentation.EndContext();
Instrumentation.BeginContext(10, 3, false);
Write(
#line 1 "ExplicitExpression.cshtml"
1+1
Write(1+1);
#line default
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998

View File

@ -33,14 +33,11 @@ namespace TestOutput
#line hidden
Instrumentation.BeginContext(83, 3, false);
Write(
#line 7 "ExpressionsInCode.cshtml"
foo
Write(foo);
#line default
#line hidden
);
Instrumentation.EndContext();
#line 7 "ExpressionsInCode.cshtml"
@ -69,14 +66,11 @@ namespace TestOutput
#line hidden
Instrumentation.BeginContext(174, 21, false);
Write(
#line 14 "ExpressionsInCode.cshtml"
bar.Replace("F", "B")
Write(bar.Replace("F", "B"));
#line default
#line hidden
);
Instrumentation.EndContext();
#line 14 "ExpressionsInCode.cshtml"

View File

@ -36,14 +36,11 @@ namespace TestOutput
WriteLiteral("\r\nHere\'s a random number: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(167, 11, false);
Write(
#line 12 "FunctionsBlock.cshtml"
RandomInt()
Write(RandomInt());
#line default
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998

View File

@ -36,14 +36,11 @@ namespace TestOutput
WriteLiteral("\r\nHere\'s a random number: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(152, 11, false);
Write(
#line 12 "FunctionsBlock_Tabs.cshtml"
RandomInt()
Write(RandomInt());
#line default
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998

View File

@ -24,14 +24,11 @@ Bold(string s) {
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(61, 1, false);
WriteTo(__razor_helper_writer,
#line 3 "Helpers.cshtml"
s
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(62, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
@ -67,14 +64,11 @@ Italic(string s) {
WriteLiteralTo(__razor_helper_writer, " <em>");
Instrumentation.EndContext();
Instrumentation.BeginContext(137, 1, false);
WriteTo(__razor_helper_writer,
#line 8 "Helpers.cshtml"
s
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(138, 7, true);
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
@ -107,14 +101,11 @@ Italic(string s) {
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(151, 13, false);
Write(
#line 11 "Helpers.cshtml"
Bold("Hello")
Write(Bold("Hello"));
#line default
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998

View File

@ -24,14 +24,11 @@ Bold(string s) {
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(61, 1, false);
WriteTo(__razor_helper_writer,
#line 3 "Helpers.cshtml"
s
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(62, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
@ -67,14 +64,11 @@ Italic(string s) {
WriteLiteralTo(__razor_helper_writer, " <em>");
Instrumentation.EndContext();
Instrumentation.BeginContext(137, 1, false);
WriteTo(__razor_helper_writer,
#line 8 "Helpers.cshtml"
s
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(138, 7, true);
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
@ -107,14 +101,11 @@ Italic(string s) {
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(151, 13, false);
Write(
#line 11 "Helpers.cshtml"
Bold("Hello")
Write(Bold("Hello"));
#line default
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998

View File

@ -24,14 +24,11 @@ Bold(string s) {
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(61, 1, false);
WriteTo(__razor_helper_writer,
#line 3 "HelpersMissingCloseParen.cshtml"
s
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(62, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");

View File

@ -24,14 +24,11 @@ Bold(string s) {
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(61, 1, false);
WriteTo(__razor_helper_writer,
#line 3 "HelpersMissingOpenBrace.cshtml"
s
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(62, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
@ -68,14 +65,11 @@ Italic(string s)
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(106, 9, false);
Write(
#line 7 "HelpersMissingOpenBrace.cshtml"
Italic(s)
Write(Italic(s));
#line default
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998

View File

@ -24,14 +24,11 @@ Bold(string s) {
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(61, 1, false);
WriteTo(__razor_helper_writer,
#line 3 "HelpersMissingOpenParen.cshtml"
s
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(62, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
@ -68,14 +65,11 @@ Italic
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(95, 13, false);
Write(
#line 7 "HelpersMissingOpenParen.cshtml"
Bold("Hello")
Write(Bold("Hello"));
#line default
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998

View File

@ -24,14 +24,11 @@ namespace TestOutput
WriteLiteral(" <p>This is item #");
Instrumentation.EndContext();
Instrumentation.BeginContext(55, 1, false);
Write(
#line 2 "ImplicitExpression.cshtml"
i
Write(i);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(56, 6, true);
WriteLiteral("</p>\r\n");

View File

@ -35,27 +35,21 @@ using System
WriteLiteral("\r\n<p>Path\'s full type name is ");
Instrumentation.EndContext();
Instrumentation.BeginContext(99, 21, false);
Write(
#line 5 "Imports.cshtml"
typeof(Path).FullName
Write(typeof(Path).FullName);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(120, 40, true);
WriteLiteral("</p>\r\n<p>Foo\'s actual full type name is ");
Instrumentation.EndContext();
Instrumentation.BeginContext(161, 20, false);
Write(
#line 6 "Imports.cshtml"
typeof(Foo).FullName
Write(typeof(Foo).FullName);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(181, 4, true);
WriteLiteral("</p>");

View File

@ -15,14 +15,11 @@ namespace TestOutput
public override async Task ExecuteAsync()
{
Instrumentation.BeginContext(1, 5, false);
Write(
#line 1 "Inherits.cshtml"
foo()
Write(foo());
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(6, 4, true);
WriteLiteral("\r\n\r\n");

View File

@ -31,14 +31,11 @@ Link(string link) {
#line hidden
Instrumentation.BeginContext(63, 4, false);
WriteTo(__razor_attribute_value_writer,
#line 2 "InlineBlocks.cshtml"
link
WriteTo(__razor_attribute_value_writer, link);
#line default
#line hidden
);
Instrumentation.EndContext();
#line 2 "InlineBlocks.cshtml"
} else {

View File

@ -23,14 +23,11 @@ Strong(string s) {
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(41, 1, false);
WriteTo(__razor_helper_writer,
#line 2 "Instrumented.cshtml"
s
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(42, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
@ -100,14 +97,11 @@ Strong(string s) {
WriteLiteral(" <p>Hello from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(200, 1, false);
Write(
#line 13 "Instrumented.cshtml"
i
Write(i);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(202, 6, true);
WriteLiteral("</p>\r\n");
@ -180,14 +174,11 @@ Strong(string s) {
WriteLiteral(" <p>Hello again from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(509, 1, false);
Write(
#line 31 "Instrumented.cshtml"
j
Write(j);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(511, 6, true);
WriteLiteral("</p>\r\n");
@ -220,14 +211,11 @@ Strong(string s) {
WriteLiteral(" <p>Oh no! An error occurred: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(631, 10, false);
Write(
#line 37 "Instrumented.cshtml"
ex.Message
Write(ex.Message);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(642, 6, true);
WriteLiteral("</p>\r\n");

View File

@ -25,14 +25,11 @@ namespace TestOutput
WriteLiteral(" <p>Hello from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(69, 12, false);
Write(
#line 3 "MarkupInCodeBlock.cshtml"
i.ToString()
Write(i.ToString());
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(82, 6, true);
WriteLiteral("</p>\r\n");

View File

@ -31,14 +31,11 @@ Italic(string s) {
WriteLiteralTo(__razor_helper_writer, " <em>");
Instrumentation.EndContext();
Instrumentation.BeginContext(151, 7, false);
WriteTo(__razor_helper_writer,
#line 7 "NestedHelpers.cshtml"
Bold(s)
WriteTo(__razor_helper_writer, Bold(s));
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(158, 7, true);
WriteLiteralTo(__razor_helper_writer, "</em>\r\n");
@ -74,14 +71,11 @@ Bold(string s) {
WriteLiteralTo(__razor_helper_writer, " <strong>");
Instrumentation.EndContext();
Instrumentation.BeginContext(123, 1, false);
WriteTo(__razor_helper_writer,
#line 5 "NestedHelpers.cshtml"
s
WriteTo(__razor_helper_writer, s);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(124, 11, true);
WriteLiteralTo(__razor_helper_writer, "</strong>\r\n");
@ -112,14 +106,11 @@ Bold(string s) {
WriteLiteral("\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(171, 15, false);
Write(
#line 10 "NestedHelpers.cshtml"
Italic("Hello")
Write(Italic("Hello"));
#line default
#line hidden
);
Instrumentation.EndContext();
}
#pragma warning restore 1998

View File

@ -34,14 +34,11 @@ namespace TestOutput
WriteLiteral(" <p>Hello from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(69, 1, false);
Write(
#line 6 ""
i
Write(i);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(71, 6, true);
WriteLiteral("</p>\r\n");
@ -114,14 +111,11 @@ namespace TestOutput
WriteLiteral(" <p>Hello again from C#, #");
Instrumentation.EndContext();
Instrumentation.BeginContext(378, 1, false);
Write(
#line 24 ""
j
Write(j);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(380, 6, true);
WriteLiteral("</p>\r\n");
@ -154,14 +148,11 @@ namespace TestOutput
WriteLiteral(" <p>Oh no! An error occurred: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(500, 10, false);
Write(
#line 30 ""
ex.Message
Write(ex.Message);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(511, 6, true);
WriteLiteral("</p>\r\n");
@ -183,14 +174,11 @@ namespace TestOutput
WriteLiteral("<p>i is now ");
Instrumentation.EndContext();
Instrumentation.BeginContext(571, 1, false);
Write(
#line 34 ""
i
Write(i);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(572, 8, true);
WriteLiteral("</p>\r\n\r\n");

View File

@ -54,13 +54,7 @@ namespace TestOutput
#line default
#line hidden
#line 15 "RazorComments.cshtml"
__o = a
#line 15 "RazorComments.cshtml"
b
#line default
#line hidden
;
__o = ab;
#line default
#line hidden

View File

@ -53,32 +53,21 @@ namespace TestOutput
WriteLiteral("\r\n<p>But this should show the comment syntax: ");
Instrumentation.EndContext();
Instrumentation.BeginContext(310, 3, false);
Write(
#line 13 "RazorComments.cshtml"
bar
Write(bar);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(313, 8, true);
WriteLiteral("</p>\r\n\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(323, 1, false);
Write(
#line 15 "RazorComments.cshtml"
a
Write(ab);
#line default
#line hidden
#line 15 "RazorComments.cshtml"
b
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(330, 2, true);
WriteLiteral("\r\n");

View File

@ -22,48 +22,27 @@ namespace TestOutput
WriteLiteral(">Foo</a>\r\n<a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 27), Tuple.Create("\"", 56), Tuple.Create(Tuple.Create("", 34), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 34), false),
Tuple.Create(Tuple.Create("", 45), Tuple.Create<System.Object, System.Int32>(
#line 2 "ResolveUrl.cshtml"
product.id
#line default
#line hidden
, 45), false));
Tuple.Create(Tuple.Create("", 45), Tuple.Create<System.Object, System.Int32>(product.id, 45), false));
Instrumentation.BeginContext(57, 1, true);
WriteLiteral(">");
Instrumentation.EndContext();
Instrumentation.BeginContext(59, 12, false);
Write(
#line 2 "ResolveUrl.cshtml"
product.Name
Write(product.Name);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(71, 8, true);
WriteLiteral("</a>\r\n<a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 79), Tuple.Create("\"", 115), Tuple.Create(Tuple.Create("", 86), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 86), false),
Tuple.Create(Tuple.Create("", 97), Tuple.Create<System.Object, System.Int32>(
#line 3 "ResolveUrl.cshtml"
product.id
#line default
#line hidden
, 97), false), Tuple.Create(Tuple.Create("", 108), Tuple.Create("/Detail", 108), true));
Tuple.Create(Tuple.Create("", 97), Tuple.Create<System.Object, System.Int32>(product.id, 97), false), Tuple.Create(Tuple.Create("", 108), Tuple.Create("/Detail", 108), true));
Instrumentation.BeginContext(116, 16, true);
WriteLiteral(">Details</a>\r\n<a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 132), Tuple.Create("\"", 187), Tuple.Create(Tuple.Create("", 139), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 139), false),
Tuple.Create(Tuple.Create("", 169), Tuple.Create<System.Object, System.Int32>(
#line 4 "ResolveUrl.cshtml"
product.id
#line default
#line hidden
, 169), false), Tuple.Create(Tuple.Create("", 180), Tuple.Create("/Detail", 180), true));
Tuple.Create(Tuple.Create("", 169), Tuple.Create<System.Object, System.Int32>(product.id, 169), false), Tuple.Create(Tuple.Create("", 180), Tuple.Create("/Detail", 180), true));
Instrumentation.BeginContext(188, 19, true);
WriteLiteral(">Crazy Url!</a>\r\n\r\n");
Instrumentation.EndContext();
@ -81,48 +60,27 @@ namespace TestOutput
WriteLiteral(">Foo</a>\r\n <a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 266), Tuple.Create("\"", 295), Tuple.Create(Tuple.Create("", 273), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 273), false),
Tuple.Create(Tuple.Create("", 284), Tuple.Create<System.Object, System.Int32>(
#line 9 "ResolveUrl.cshtml"
product.id
#line default
#line hidden
, 284), false));
Tuple.Create(Tuple.Create("", 284), Tuple.Create<System.Object, System.Int32>(product.id, 284), false));
Instrumentation.BeginContext(296, 1, true);
WriteLiteral(">");
Instrumentation.EndContext();
Instrumentation.BeginContext(298, 12, false);
Write(
#line 9 "ResolveUrl.cshtml"
product.Name
Write(product.Name);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(310, 16, true);
WriteLiteral("</a>\r\n <a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 326), Tuple.Create("\"", 362), Tuple.Create(Tuple.Create("", 333), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 333), false),
Tuple.Create(Tuple.Create("", 344), Tuple.Create<System.Object, System.Int32>(
#line 10 "ResolveUrl.cshtml"
product.id
#line default
#line hidden
, 344), false), Tuple.Create(Tuple.Create("", 355), Tuple.Create("/Detail", 355), true));
Tuple.Create(Tuple.Create("", 344), Tuple.Create<System.Object, System.Int32>(product.id, 344), false), Tuple.Create(Tuple.Create("", 355), Tuple.Create("/Detail", 355), true));
Instrumentation.BeginContext(363, 24, true);
WriteLiteral(">Details</a>\r\n <a");
Instrumentation.EndContext();
WriteAttribute("href", Tuple.Create(" href=\"", 387), Tuple.Create("\"", 442), Tuple.Create(Tuple.Create("", 394), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 394), false),
Tuple.Create(Tuple.Create("", 424), Tuple.Create<System.Object, System.Int32>(
#line 11 "ResolveUrl.cshtml"
product.id
#line default
#line hidden
, 424), false), Tuple.Create(Tuple.Create("", 435), Tuple.Create("/Detail", 435), true));
Tuple.Create(Tuple.Create("", 424), Tuple.Create<System.Object, System.Int32>(product.id, 424), false), Tuple.Create(Tuple.Create("", 435), Tuple.Create("/Detail", 435), true));
Instrumentation.BeginContext(443, 23, true);
WriteLiteral(">Crazy Url!</a>\r\n \r\n");
Instrumentation.EndContext();
@ -143,48 +101,27 @@ namespace TestOutput
WriteLiteralTo(__razor_template_writer, ">Foo</a>\r\n <a");
Instrumentation.EndContext();
WriteAttributeTo(__razor_template_writer, "href", Tuple.Create(" href=\"", 529), Tuple.Create("\"", 558), Tuple.Create(Tuple.Create("", 536), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 536), false),
Tuple.Create(Tuple.Create("", 547), Tuple.Create<System.Object, System.Int32>(
#line 17 "ResolveUrl.cshtml"
product.id
#line default
#line hidden
, 547), false));
Tuple.Create(Tuple.Create("", 547), Tuple.Create<System.Object, System.Int32>(product.id, 547), false));
Instrumentation.BeginContext(559, 1, true);
WriteLiteralTo(__razor_template_writer, ">");
Instrumentation.EndContext();
Instrumentation.BeginContext(561, 12, false);
WriteTo(__razor_template_writer,
#line 17 "ResolveUrl.cshtml"
product.Name
WriteTo(__razor_template_writer, product.Name);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(573, 12, true);
WriteLiteralTo(__razor_template_writer, "</a>\r\n <a");
Instrumentation.EndContext();
WriteAttributeTo(__razor_template_writer, "href", Tuple.Create(" href=\"", 585), Tuple.Create("\"", 621), Tuple.Create(Tuple.Create("", 592), Tuple.Create<System.Object, System.Int32>(Href("~/Products/"), 592), false),
Tuple.Create(Tuple.Create("", 603), Tuple.Create<System.Object, System.Int32>(
#line 18 "ResolveUrl.cshtml"
product.id
#line default
#line hidden
, 603), false), Tuple.Create(Tuple.Create("", 614), Tuple.Create("/Detail", 614), true));
Tuple.Create(Tuple.Create("", 603), Tuple.Create<System.Object, System.Int32>(product.id, 603), false), Tuple.Create(Tuple.Create("", 614), Tuple.Create("/Detail", 614), true));
Instrumentation.BeginContext(622, 20, true);
WriteLiteralTo(__razor_template_writer, ">Details</a>\r\n <a");
Instrumentation.EndContext();
WriteAttributeTo(__razor_template_writer, "href", Tuple.Create(" href=\"", 642), Tuple.Create("\"", 697), Tuple.Create(Tuple.Create("", 649), Tuple.Create<System.Object, System.Int32>(Href("~/A+Really(Crazy),Url.Is:This/"), 649), false),
Tuple.Create(Tuple.Create("", 679), Tuple.Create<System.Object, System.Int32>(
#line 19 "ResolveUrl.cshtml"
product.id
#line default
#line hidden
, 679), false), Tuple.Create(Tuple.Create("", 690), Tuple.Create("/Detail", 690), true));
Tuple.Create(Tuple.Create("", 679), Tuple.Create<System.Object, System.Int32>(product.id, 679), false), Tuple.Create(Tuple.Create("", 690), Tuple.Create("/Detail", 690), true));
Instrumentation.BeginContext(698, 17, true);
WriteLiteralTo(__razor_template_writer, ">Crazy Url!</a>\r\n");
Instrumentation.EndContext();

View File

@ -41,14 +41,11 @@ namespace TestOutput
WriteLiteralTo(__razor_template_writer, "This works ");
Instrumentation.EndContext();
Instrumentation.BeginContext(337, 4, false);
WriteTo(__razor_template_writer,
#line 12 "Templates.cshtml"
item
WriteTo(__razor_template_writer, item);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(341, 1, true);
WriteLiteralTo(__razor_template_writer, "!");
@ -63,14 +60,11 @@ namespace TestOutput
#line hidden
Instrumentation.BeginContext(357, 7, false);
Write(
#line 13 "Templates.cshtml"
foo("")
Write(foo(""));
#line default
#line hidden
);
Instrumentation.EndContext();
#line 13 "Templates.cshtml"
@ -82,104 +76,74 @@ namespace TestOutput
WriteLiteral("\r\n\r\n<ul>\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(379, 11, false);
Write(
#line 17 "Templates.cshtml"
Repeat(10,
Write(Repeat(10, item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(391, 10, true);
WriteLiteralTo(__razor_template_writer, "<li>Item #");
Instrumentation.EndContext();
Instrumentation.BeginContext(402, 4, false);
#line 17 "Templates.cshtml"
WriteTo(__razor_template_writer, item);
#line default
#line hidden
item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(391, 10, true);
WriteLiteralTo(__razor_template_writer, "<li>Item #");
Instrumentation.EndContext();
Instrumentation.BeginContext(402, 4, false);
WriteTo(__razor_template_writer,
#line 17 "Templates.cshtml"
item
Instrumentation.EndContext();
Instrumentation.BeginContext(406, 5, true);
WriteLiteralTo(__razor_template_writer, "</li>");
Instrumentation.EndContext();
}
)
));
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(406, 5, true);
WriteLiteralTo(__razor_template_writer, "</li>");
Instrumentation.EndContext();
}
)
#line 17 "Templates.cshtml"
)
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(413, 16, true);
WriteLiteral("\r\n</ul>\r\n\r\n<p>\r\n");
Instrumentation.EndContext();
Instrumentation.BeginContext(430, 16, false);
Write(
#line 21 "Templates.cshtml"
Repeat(10,
#line default
#line hidden
item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(448, 14, true);
WriteLiteralTo(__razor_template_writer, " This is line#");
Instrumentation.EndContext();
Instrumentation.BeginContext(463, 4, false);
WriteTo(__razor_template_writer,
Write(Repeat(10,
item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(448, 14, true);
WriteLiteralTo(__razor_template_writer, " This is line#");
Instrumentation.EndContext();
Instrumentation.BeginContext(463, 4, false);
#line 22 "Templates.cshtml"
item
WriteTo(__razor_template_writer, item);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(467, 17, true);
WriteLiteralTo(__razor_template_writer, " of markup<br/>\r\n");
Instrumentation.EndContext();
}
)
#line 23 "Templates.cshtml"
Instrumentation.EndContext();
Instrumentation.BeginContext(467, 17, true);
WriteLiteralTo(__razor_template_writer, " of markup<br/>\r\n");
Instrumentation.EndContext();
}
)
));
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(485, 20, true);
WriteLiteral("\r\n</p>\r\n\r\n<ul>\r\n ");
Instrumentation.EndContext();
Instrumentation.BeginContext(506, 11, false);
Write(
#line 27 "Templates.cshtml"
Repeat(10,
#line default
#line hidden
item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(518, 20, true);
WriteLiteralTo(__razor_template_writer, "<li>\r\n Item #");
Instrumentation.EndContext();
Instrumentation.BeginContext(539, 4, false);
WriteTo(__razor_template_writer,
Write(Repeat(10, item => new Template((__razor_template_writer) => {
Instrumentation.BeginContext(518, 20, true);
WriteLiteralTo(__razor_template_writer, "<li>\r\n Item #");
Instrumentation.EndContext();
Instrumentation.BeginContext(539, 4, false);
#line 28 "Templates.cshtml"
item
WriteTo(__razor_template_writer, item);
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(543, 2, true);
WriteLiteralTo(__razor_template_writer, "\r\n");
Instrumentation.EndContext();
Instrumentation.EndContext();
Instrumentation.BeginContext(543, 2, true);
WriteLiteralTo(__razor_template_writer, "\r\n");
Instrumentation.EndContext();
#line 29 "Templates.cshtml"
@ -192,19 +156,16 @@ namespace TestOutput
#line default
#line hidden
Instrumentation.BeginContext(574, 93, true);
WriteLiteralTo(__razor_template_writer, "\r\n <ul>\r\n <li>Child Items... ?</li>\r\n \r\n </ul" +
Instrumentation.BeginContext(574, 93, true);
WriteLiteralTo(__razor_template_writer, "\r\n <ul>\r\n <li>Child Items... ?</li>\r\n \r\n </ul" +
">\r\n </li>");
Instrumentation.EndContext();
}
)
#line 34 "Templates.cshtml"
)
Instrumentation.EndContext();
}
)
));
#line default
#line hidden
);
Instrumentation.EndContext();
Instrumentation.BeginContext(715, 8, true);
WriteLiteral("\r\n</ul> ");