Add padding support to the functions directive.

Exposed the CreateCodeMapping method on the CSharpCodeVisitor.
This commit is contained in:
N. Taylor Mullen 2014-02-12 16:07:27 -08:00
parent 3afb31b78b
commit dcf35ca20b
2 changed files with 8 additions and 6 deletions

View File

@ -308,7 +308,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
Writer.WriteEndMethodInvocation();
}
private void CreateCodeMapping(string code, Chunk chunk)
public void CreateCodeMapping(string code, Chunk chunk)
{
using (CSharpLineMappingWriter mappingWriter = Writer.BuildLineMapping(chunk.Start, code.Length, Context.SourceFile))
{

View File

@ -4,17 +4,19 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{
public class CSharpTypeMemberVisitor : CodeVisitor<CSharpCodeWriter>
{
private CSharpCodeVisitor _csharpCodeVisitor;
public CSharpTypeMemberVisitor(CSharpCodeWriter writer, CodeGeneratorContext context)
: base(writer, context) { }
: base(writer, context)
{
_csharpCodeVisitor = new CSharpCodeVisitor(writer, context);
}
protected override void Visit(TypeMemberChunk chunk)
{
if (!String.IsNullOrEmpty(chunk.Code))
{
using (Writer.BuildLineMapping(chunk.Start, chunk.Code.Length, Context.SourceFile))
{
Writer.WriteLine(chunk.Code);
}
_csharpCodeVisitor.CreateCodeMapping(chunk.Code, chunk);
}
}
}