Skip to content
This repository was archived by the owner on Dec 19, 2018. It is now read-only.

Add TagHelper parse tree rewriter. #109

Conversation

NTaylorMullen
Copy link
Contributor

NOTE: This does not support malformed tag helpers. It expects all tags (that are tag helpers) are validly formed. That fix will come with: #104

Also I opened a separate test PR due to size here: #110

Issue: #71


using System.Collections.Generic;

namespace Microsoft.AspNet.Razor.Generator.Compiler
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This namespace will change once this is completed: #39 For now I've made it consistent with the other chunks.

@NTaylorMullen NTaylorMullen changed the title Add TagHelper parse tree visitor. [Design] Add TagHelper parse tree visitor. Aug 29, 2014
if (NextIs(HtmlSymbolType.ForwardSlash))
{
AcceptAndMoveNext();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this addition looks like an unrelated bug fix. what does it have to do with visiting the parse tree (and rewriting some elements as TagHelperBlocks)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, found an issue that I introduced in the HtmlBlock translation where the parser deadlocked in veryy edge case scenarios inside of script tags.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please send out a separate PR, preferably with tests of the edge case

@NTaylorMullen
Copy link
Contributor Author

/cc @anurse

@NTaylorMullen NTaylorMullen force-pushed the TagHelpers_ParseTreeRewriter branch from 5b494d1 to 858b88b Compare September 3, 2014 04:57
EditHandler = span.EditHandler,
Kind = span.Kind
};
var htmlSymbols = ((IEnumerable<HtmlSymbol>)span.Symbols).ToArray();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't have CSharpSymbol instances in this collection but probably still worth being careful: span.Symbols.OfType<HtmlSymbol>().ToArray()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that was a nit

@dougbu
Copy link
Member

dougbu commented Sep 9, 2014

@NTaylorMullen
Copy link
Contributor Author

Addressed comments.

BuildCurrentlyTrackedBlock();
}

private bool IsValidTagHelper(string tagName, Block childBlock)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IsPotentialTagHelper

attributeChildren.Parent = this;
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove trailing whitespace

@dougbu
Copy link
Member

dougbu commented Sep 11, 2014

:shipit: after addressing nits and my comments on comments

  • can decide later whether ParseSpan() could be simplified as I suggest since behaviour looks correct, just wasteful

@NTaylorMullen NTaylorMullen deleted the TagHelpers_ParseTreeRewriter branch September 11, 2014 21:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants