Remove Snippet dependency

No need to have a snippet class when we only ever use the value of a snippet and only ever have one.
This commit is contained in:
N. Taylor Mullen 2014-02-04 14:53:52 -08:00
parent 57e0ef4774
commit a9d4cd9089
7 changed files with 8 additions and 52 deletions

View File

@ -3,7 +3,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
{ {
public class ExpressionChunk : Chunk public class ExpressionChunk : Chunk
{ {
public Snippet Code { get; set; } public string Code { get; set; }
public ExpressionRenderingMode RenderingMode { get; set; } public ExpressionRenderingMode RenderingMode { get; set; }
public override string ToString() public override string ToString()

View File

@ -4,7 +4,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
{ {
public class LiteralCodeAttributeChunk : ChunkBlock public class LiteralCodeAttributeChunk : ChunkBlock
{ {
public Snippet Code { get; set; } public string Code { get; set; }
public LocationTagged<string> Prefix { get; set; } public LocationTagged<string> Prefix { get; set; }
public LocationTagged<string> Value { get; set; } public LocationTagged<string> Value { get; set; }
public SourceLocation ValueLocation { get; set; } public SourceLocation ValueLocation { get; set; }

View File

@ -3,7 +3,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
{ {
public class StatementChunk : Chunk public class StatementChunk : Chunk
{ {
public Snippets Code { get; set; } public string Code { get; set; }
public override string ToString() public override string ToString()
{ {

View File

@ -3,6 +3,6 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
{ {
public class TypeMemberChunk : Chunk public class TypeMemberChunk : Chunk
{ {
public Snippets Code { get; set; } public string Code { get; set; }
} }
} }

View File

@ -55,7 +55,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
{ {
AddChunk(new ExpressionChunk AddChunk(new ExpressionChunk
{ {
Code = new Snippet(expression), Code = expression,
RenderingMode = renderingMode RenderingMode = renderingMode
}, association, context); }, association, context);
} }
@ -64,7 +64,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
{ {
AddChunk(new StatementChunk AddChunk(new StatementChunk
{ {
Code = new Snippets(code), Code = code,
}, association, context); }, association, context);
} }
@ -80,7 +80,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
{ {
AddChunk(new TypeMemberChunk AddChunk(new TypeMemberChunk
{ {
Code = new Snippets(code), Code = code,
}, association, context, topLevel: true); }, association, context, topLevel: true);
} }
@ -88,7 +88,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
{ {
AddChunk(new LiteralCodeAttributeChunk AddChunk(new LiteralCodeAttributeChunk
{ {
Code = new Snippet(code), Code = code,
}, association, context); }, association, context);
} }

View File

@ -1,17 +0,0 @@
using Microsoft.AspNet.Razor.Text;
namespace Microsoft.AspNet.Razor.Generator.Compiler
{
public class Snippet
{
public Snippet() {}
public Snippet(string value)
{
Value = value;
}
public string Value { get; set; }
public SourceSpan View { get; set; }
}
}

View File

@ -1,27 +0,0 @@
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.AspNet.Razor.Generator.Compiler
{
public class Snippets : List<Snippet>
{
public Snippets() {}
public Snippets(int capacity)
: base(capacity) {}
public Snippets(IEnumerable<Snippet> collection)
: base(collection) {}
public Snippets(Snippets collection)
: base(collection) {}
public Snippets(string value)
: base(new[] { new Snippet { Value = value } }) {}
public override string ToString()
{
return string.Concat(this.Select(s => s.Value).ToArray());
}
}
}