Revert changes to CSharpDesignTimeHelpersVisitor.

Without the initial code tree acceptance you end up stack overflowing.  Also removed a validation check that ensures that there's always a base type (not true).
This commit is contained in:
N. Taylor Mullen 2014-02-04 11:59:50 -08:00
parent 57854b2cc0
commit 57e0ef4774
4 changed files with 4 additions and 5 deletions

View File

@ -42,7 +42,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
new CSharpHelperVisitor(writer, Context).Accept(Tree.Chunks); new CSharpHelperVisitor(writer, Context).Accept(Tree.Chunks);
new CSharpTypeMemberVisitor(writer, Context).Accept(Tree.Chunks); new CSharpTypeMemberVisitor(writer, Context).Accept(Tree.Chunks);
new CSharpDesignTimeHelpersVisitor(writer, Context).Accept(Tree.Chunks); new CSharpDesignTimeHelpersVisitor(writer, Context).AcceptTree(Tree);
// TODO: resolve variable declarations // TODO: resolve variable declarations

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
_context = context; _context = context;
} }
public override void Accept(System.Collections.Generic.IList<Chunk> chunks) public void AcceptTree(CodeTree tree)
{ {
if (_context.Host.DesignTimeMode) if (_context.Host.DesignTimeMode)
{ {
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler.CSharp
{ {
using (_writer.BuildDisableWarningScope()) using (_writer.BuildDisableWarningScope())
{ {
Accept(chunks); Accept(tree.Chunks);
} }
} }
} }

View File

@ -5,7 +5,7 @@ namespace Microsoft.AspNet.Razor.Generator.Compiler
{ {
public abstract class ChunkVisitor : IChunkVisitor public abstract class ChunkVisitor : IChunkVisitor
{ {
public virtual void Accept(IList<Chunk> chunks) public void Accept(IList<Chunk> chunks)
{ {
if (chunks == null) if (chunks == null)
{ {

View File

@ -114,7 +114,6 @@ namespace Microsoft.AspNet.Razor.Test.Generator
private static void ValidateCodeTreeContainsAll(string codeTreeCode, string codeDOMCode, string regex) private static void ValidateCodeTreeContainsAll(string codeTreeCode, string codeDOMCode, string regex)
{ {
var matches = Regex.Matches(codeDOMCode, regex); var matches = Regex.Matches(codeDOMCode, regex);
Assert.NotEmpty(matches);
for (int i = 0; i < matches.Count; i++) for (int i = 0; i < matches.Count; i++)
{ {