Minor text tag fix

\n\nCommit migrated from 5787d1e7d4
This commit is contained in:
Ajay Bhargav Baaskaran 2018-12-14 16:34:03 -08:00
parent e8a584729f
commit 9fc340553f
1 changed files with 12 additions and 20 deletions

View File

@ -712,35 +712,27 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy
AcceptAndMoveNext(); AcceptAndMoveNext();
var bookmark = CurrentStart.AbsoluteIndex; AcceptWhile(IsSpacingToken(includeNewLines: false));
var tokens = ReadWhile(IsSpacingToken(includeNewLines: true)); if (At(SyntaxKind.CloseAngle) ||
var selfClosing = At(SyntaxKind.ForwardSlash); (At(SyntaxKind.ForwardSlash) && NextIs(SyntaxKind.CloseAngle)))
if (selfClosing)
{ {
tagMode = MarkupTagMode.SelfClosing; if (At(SyntaxKind.ForwardSlash))
Accept(tokens); {
Assert(SyntaxKind.ForwardSlash); tagMode = MarkupTagMode.SelfClosing;
AcceptAndMoveNext(); AcceptAndMoveNext(); // '/'
bookmark = CurrentStart.AbsoluteIndex; }
tokens = ReadWhile(IsSpacingToken(includeNewLines: true));
}
if (!At(SyntaxKind.CloseAngle)) AcceptAndMoveNext(); // '>'
SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None;
}
else
{ {
Context.Source.Position = bookmark;
NextToken();
Context.ErrorSink.OnError( Context.ErrorSink.OnError(
RazorDiagnosticFactory.CreateParsing_TextTagCannotContainAttributes( RazorDiagnosticFactory.CreateParsing_TextTagCannotContainAttributes(
new SourceSpan(textLocation, contentLength: 4 /* text */))); new SourceSpan(textLocation, contentLength: 4 /* text */)));
RecoverTextTag(); RecoverTextTag();
} }
else
{
Accept(tokens);
TryAccept(SyntaxKind.CloseAngle);
SpanContext.EditHandler.AcceptedCharacters = AcceptedCharactersInternal.None;
}
isWellFormed = true; isWellFormed = true;
SpanContext.ChunkGenerator = SpanChunkGenerator.Null; SpanContext.ChunkGenerator = SpanChunkGenerator.Null;