From b0b4ac4f3f12299ec1c9301f0c7f67c7646e1c63 Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Mon, 1 Jun 2015 10:42:46 -0700 Subject: [PATCH] Enable TagHelper attributes to render in the order they were originally. - This was accomplished by changing when/how TagHelper attributes are rendered. Previously they were rendered: Bound => Unbound. Now they're rendered in the order that they exist on the TagHelperChunk. - Regenerated test files to account for new re-ordering of TagHelper attributes. - Added duplicate, unbound HTML attribute, unminimized same name test to ComplexTagHelpers. - Did not add additional tests (other than the one noted above) since the current tests seem to be heavily impacted by the re-organization of code rendering; effectively showcasing the fix. #225 --- .../CSharpTagHelperCodeRenderer.cs | 363 +++++++-------- .../CSharpTagHelperRenderingTest.cs | 435 +++++++++++++----- ...AttributeTargetingTagHelpers.DesignTime.cs | 6 +- .../Output/AttributeTargetingTagHelpers.cs | 12 +- ...TagHelpers.CustomAttributeCodeGenerator.cs | 10 +- .../Output/BasicTagHelpers.DesignTime.cs | 6 +- .../BasicTagHelpers.Prefixed.DesignTime.cs | 2 +- .../Output/BasicTagHelpers.Prefixed.cs | 4 +- .../CodeGenerator/Output/BasicTagHelpers.cs | 10 +- .../Output/ComplexTagHelpers.DesignTime.cs | 12 +- .../CodeGenerator/Output/ComplexTagHelpers.cs | 34 +- .../Output/DuplicateTargetTagHelper.cs | 6 +- .../EmptyAttributeTagHelpers.DesignTime.cs | 4 +- .../Output/EmptyAttributeTagHelpers.cs | 8 +- .../Output/EscapedTagHelpers.DesignTime.cs | 2 +- .../CodeGenerator/Output/EscapedTagHelpers.cs | 4 +- .../Output/MinimizedTagHelpers.DesignTime.cs | 6 +- .../Output/MinimizedTagHelpers.cs | 24 +- .../PrefixedAttributeTagHelpers.DesignTime.cs | 26 +- .../PrefixedAttributeTagHelpers.Reversed.cs | 92 ++-- .../Output/PrefixedAttributeTagHelpers.cs | 100 ++-- .../CodeGenerator/Output/SingleTagHelper.cs | 2 +- .../Source/ComplexTagHelpers.cshtml | 4 +- 23 files changed, 693 insertions(+), 479 deletions(-) diff --git a/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs index b87f813cea..b8040cd794 100644 --- a/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs +++ b/src/Microsoft.AspNet.Razor/CodeGenerators/CSharpTagHelperCodeRenderer.cs @@ -69,13 +69,7 @@ namespace Microsoft.AspNet.Razor.CodeGenerators RenderTagHelpersCreation(chunk, tagHelperDescriptors); - // Determine what attributes exist in the element and divide them up. - var htmlAttributes = chunk.Attributes; - var attributeDescriptors = tagHelperDescriptors.SelectMany(descriptor => descriptor.Attributes).ToArray(); - var unboundHtmlAttributes = htmlAttributes.Where(attribute => !attributeDescriptors.Any( - attributeDescriptor => attributeDescriptor.IsNameMatch(attribute.Key))); - - RenderUnboundHTMLAttributes(unboundHtmlAttributes); + RenderAttributes(chunk.Attributes, tagHelperDescriptors); // No need to run anything in design time mode. if (!_designTimeMode) @@ -172,74 +166,37 @@ namespace Microsoft.AspNet.Razor.CodeGenerators tagHelperDescriptor.TypeName) .WriteEndMethodInvocation(); - // Execution contexts are a runtime feature. - if (!_designTimeMode) + // Execution contexts and throwing errors for null dictionary properties are a runtime feature. + if (_designTimeMode) { - _writer.WriteInstanceMethodInvocation(ExecutionContextVariableName, - _tagHelperContext.ExecutionContextAddMethodName, - tagHelperVariableName); - } - - // Render all of the bound attribute values for the tag helper. - RenderBoundHTMLAttributes( - chunk.Attributes, - tagHelperDescriptor.TypeName, - tagHelperVariableName, - tagHelperDescriptor.Attributes, - htmlAttributeValues); - } - } - - private void RenderBoundHTMLAttributes( - IList> chunkAttributes, - string tagHelperTypeName, - string tagHelperVariableName, - IEnumerable attributeDescriptors, - Dictionary htmlAttributeValues) - { - // Track dictionary properties we have confirmed are non-null. - var confirmedDictionaries = new HashSet(StringComparer.Ordinal); - - // First attribute wins, even if there are duplicates. - var distinctAttributes = chunkAttributes.Distinct(KeyValuePairKeyComparer.Default); - - // Go through the HTML attributes in source order, assigning to properties or indexers as we go. - foreach (var attributeKeyValuePair in distinctAttributes) - { - var attributeName = attributeKeyValuePair.Key; - var attributeValueChunk = attributeKeyValuePair.Value; - if (attributeValueChunk == null) - { - // Minimized attributes are not valid for bound attributes. TagHelperBlockRewriter has already - // logged an error if it was a bound attribute; so we can skip. continue; } - // Find the matching TagHelperAttributeDescriptor. - var attributeDescriptor = attributeDescriptors.FirstOrDefault( - descriptor => descriptor.IsNameMatch(attributeName)); - if (attributeDescriptor == null) - { - // Attribute is not bound to a property or indexer in this tag helper. - continue; - } + _writer.WriteInstanceMethodInvocation( + ExecutionContextVariableName, + _tagHelperContext.ExecutionContextAddMethodName, + tagHelperVariableName); - // We capture the tag helper's property value accessor so we can retrieve it later (if we need to). - var valueAccessor = string.Format( - CultureInfo.InvariantCulture, - "{0}.{1}", - tagHelperVariableName, - attributeDescriptor.PropertyName); + // Track dictionary properties we have confirmed are non-null. + var confirmedDictionaries = new HashSet(StringComparer.Ordinal); - if (attributeDescriptor.IsIndexer) + // Ensure that all created TagHelpers have initialized dictionary bound properties which are used + // via TagHelper indexers. + foreach (var chunkAttribute in chunk.Attributes) { - // Need a different valueAccessor in this case. But first need to throw a reasonable Exception at - // runtime if the property is null. The check is not required at design time. - if (!_designTimeMode && confirmedDictionaries.Add(attributeDescriptor.PropertyName)) + var associatedAttributeDescriptor = tagHelperDescriptor.Attributes.FirstOrDefault( + attributeDescriptor => attributeDescriptor.IsNameMatch(chunkAttribute.Key)); + + if (associatedAttributeDescriptor != null && + associatedAttributeDescriptor.IsIndexer && + confirmedDictionaries.Add(associatedAttributeDescriptor.PropertyName)) { + // Throw a reasonable Exception at runtime if the dictionary property is null. _writer .Write("if (") - .Write(valueAccessor) + .Write(tagHelperVariableName) + .Write(".") + .Write(associatedAttributeDescriptor.PropertyName) .WriteLine(" == null)"); using (_writer.BuildScope()) { @@ -249,73 +206,141 @@ namespace Microsoft.AspNet.Razor.CodeGenerators .Write("throw ") .WriteStartNewObject(nameof(InvalidOperationException)) .WriteStartMethodInvocation(_tagHelperContext.FormatInvalidIndexerAssignmentMethodName) - .WriteStringLiteral(attributeName) + .WriteStringLiteral(chunkAttribute.Key) .WriteParameterSeparator() - .WriteStringLiteral(tagHelperTypeName) + .WriteStringLiteral(tagHelperDescriptor.TypeName) .WriteParameterSeparator() - .WriteStringLiteral(attributeDescriptor.PropertyName) + .WriteStringLiteral(associatedAttributeDescriptor.PropertyName) .WriteEndMethodInvocation(endLine: false) // End of method call .WriteEndMethodInvocation(endLine: true); // End of new expression / throw statement } } - - var dictionaryKey = attributeName.Substring(attributeDescriptor.Name.Length); - valueAccessor = string.Format( - CultureInfo.InvariantCulture, - "{0}.{1}[\"{2}\"]", - tagHelperVariableName, - attributeDescriptor.PropertyName, - dictionaryKey); } + } + } - // If we haven't recorded this attribute value before then we need to record its value. - var attributeValueRecorded = htmlAttributeValues.ContainsKey(attributeName); - if (!attributeValueRecorded) + private void RenderAttributes( + IList> chunkAttributes, + IEnumerable tagHelperDescriptors) + { + var renderedBoundAttributeNames = new HashSet(StringComparer.OrdinalIgnoreCase); + + // Go through the HTML attributes in source order, assigning to properties or indexers or adding to + // TagHelperExecutionContext.HTMLAttributes' as we go. + foreach (var attribute in chunkAttributes) + { + var attributeName = attribute.Key; + var attributeValueChunk = attribute.Value; + var associatedDescriptors = tagHelperDescriptors.Where(descriptor => + descriptor.Attributes.Any(attributeDescriptor => attributeDescriptor.IsNameMatch(attributeName))); + + + // Bound attributes have associated descriptors. + if (associatedDescriptors.Any()) { - // We only need to create attribute values once per HTML element (not once per tag helper). - // We're saving the value accessor so we can retrieve it later if there are more tag - // helpers that need the value. - htmlAttributeValues.Add(attributeName, valueAccessor); - - // Bufferable attributes are attributes that can have Razor code inside of them. Such - // attributes have string values and may be calculated using a temporary TextWriter or other - // buffer. - var bufferableAttribute = attributeDescriptor.IsStringProperty; - - RenderNewAttributeValueAssignment( - attributeDescriptor, - bufferableAttribute, - attributeValueChunk, - valueAccessor); - - // Execution contexts are a runtime feature. - if (_designTimeMode) + if (!renderedBoundAttributeNames.Add(attributeName)) { + // First attribute value wins if there are duplicates. continue; } - // We need to inform the context of the attribute value. - _writer - .WriteStartInstanceMethodInvocation( - ExecutionContextVariableName, - _tagHelperContext.ExecutionContextAddTagHelperAttributeMethodName) - .WriteStringLiteral(attributeName) - .WriteParameterSeparator() - .Write(valueAccessor) - .WriteEndMethodInvocation(); + if (attributeValueChunk == null) + { + // Minimized attributes are not valid for bound attributes. TagHelperBlockRewriter has already + // logged an error if it was a bound attribute; so we can skip. + continue; + } + + // We need to capture the tag helper's property value accessor so we can retrieve it later + // if there are more tag helpers that need the value. + string valueAccessor = null; + + foreach (var associatedDescriptor in associatedDescriptors) + { + var associatedAttributeDescriptor = associatedDescriptor.Attributes.First( + attributeDescriptor => attributeDescriptor.IsNameMatch(attributeName)); + var tagHelperVariableName = GetVariableName(associatedDescriptor); + + valueAccessor = RenderBoundAttribute( + attributeName, + attributeValueChunk, + tagHelperVariableName, + valueAccessor, + associatedAttributeDescriptor); + } } else { - // The attribute value has already been recorded, lets retrieve it from the stored value - // accessors. - _writer - .WriteStartAssignment(valueAccessor) - .Write(htmlAttributeValues[attributeName]) - .WriteLine(";"); + RenderUnboundAttribute(attributeName, attributeValueChunk); } } } + private string RenderBoundAttribute( + string attributeName, + Chunk attributeValueChunk, + string tagHelperVariableName, + string previousValueAccessor, + TagHelperAttributeDescriptor attributeDescriptor) + { + var currentValueAccessor = string.Format( + CultureInfo.InvariantCulture, + "{0}.{1}", + tagHelperVariableName, + attributeDescriptor.PropertyName); + + if (attributeDescriptor.IsIndexer) + { + var dictionaryKey = attributeName.Substring(attributeDescriptor.Name.Length); + currentValueAccessor += $"[\"{dictionaryKey}\"]"; + } + + // If this attribute value has not been seen before, need to record its value. + if (previousValueAccessor == null) + { + // Bufferable attributes are attributes that can have Razor code inside of them. Such + // attributes have string values and may be calculated using a temporary TextWriter or other + // buffer. + var bufferableAttribute = attributeDescriptor.IsStringProperty; + + RenderNewAttributeValueAssignment( + attributeDescriptor, + bufferableAttribute, + attributeValueChunk, + currentValueAccessor); + + if (_designTimeMode) + { + // Execution contexts are a runtime feature. + return currentValueAccessor; + } + + // We need to inform the context of the attribute value. + _writer + .WriteStartInstanceMethodInvocation( + ExecutionContextVariableName, + _tagHelperContext.ExecutionContextAddTagHelperAttributeMethodName) + .WriteStringLiteral(attributeName) + .WriteParameterSeparator() + .Write(currentValueAccessor) + .WriteEndMethodInvocation(); + + return currentValueAccessor; + } + else + { + // The attribute value has already been determined and accessor was passed to us as + // previousValueAccessor, we don't want to evaluate the value twice so lets just use the + // previousValueLocation. + _writer + .WriteStartAssignment(currentValueAccessor) + .Write(previousValueAccessor) + .WriteLine(";"); + + return previousValueAccessor; + } + } + // Render assignment of attribute value to the value accessor. private void RenderNewAttributeValueAssignment( TagHelperAttributeDescriptor attributeDescriptor, @@ -389,67 +414,63 @@ namespace Microsoft.AspNet.Razor.CodeGenerators } } - private void RenderUnboundHTMLAttributes(IEnumerable> unboundHTMLAttributes) + private void RenderUnboundAttribute(string attributeName, Chunk attributeValueChunk) { - // Build out the unbound HTML attributes for the tag builder - foreach (var htmlAttribute in unboundHTMLAttributes) + string textValue = null; + var isPlainTextValue = false; + + // A null attribute value means the HTML attribute is minimized. + if (attributeValueChunk != null) { - string textValue = null; - var isPlainTextValue = false; - var attributeValue = htmlAttribute.Value; + isPlainTextValue = TryGetPlainTextValue(attributeValueChunk, out textValue); - // A null attribute value means the HTML attribute is minimized. - if (attributeValue != null) + // HTML attributes are always strings. So if this value is not plain text i.e. if the value contains + // C# code, then we need to buffer it. + if (!isPlainTextValue) { - isPlainTextValue = TryGetPlainTextValue(attributeValue, out textValue); - - // HTML attributes are always strings. So if this value is not plain text i.e. if the value contains - // C# code, then we need to buffer it. - if (!isPlainTextValue) - { - BuildBufferedWritingScope(attributeValue, htmlEncodeValues: true); - } + BuildBufferedWritingScope(attributeValueChunk, htmlEncodeValues: true); } + } - // Execution contexts are a runtime feature, therefore no need to add anything to them. - if (_designTimeMode) - { - continue; - } + // Execution contexts are a runtime feature, therefore no need to add anything to them. + if (_designTimeMode) + { + return; + } - // If we have a minimized attribute there is no value - if (attributeValue == null) + // If we have a minimized attribute there is no value + if (attributeValueChunk == null) + { + _writer + .WriteStartInstanceMethodInvocation( + ExecutionContextVariableName, + _tagHelperContext.ExecutionContextAddMinimizedHtmlAttributeMethodName) + .WriteStringLiteral(attributeName) + .WriteEndMethodInvocation(); + } + else + { + _writer + .WriteStartInstanceMethodInvocation( + ExecutionContextVariableName, + _tagHelperContext.ExecutionContextAddHtmlAttributeMethodName) + .WriteStringLiteral(attributeName) + .WriteParameterSeparator() + .WriteStartMethodInvocation(_tagHelperContext.MarkAsHtmlEncodedMethodName); + + // If it's a plain text value then we need to surround the value with quotes. + if (isPlainTextValue) { - _writer - .WriteStartInstanceMethodInvocation( - ExecutionContextVariableName, - _tagHelperContext.ExecutionContextAddMinimizedHtmlAttributeMethodName) - .WriteStringLiteral(htmlAttribute.Key) - .WriteEndMethodInvocation(); + _writer.WriteStringLiteral(textValue); } else { - _writer - .WriteStartInstanceMethodInvocation( - ExecutionContextVariableName, - _tagHelperContext.ExecutionContextAddHtmlAttributeMethodName) - .WriteStringLiteral(htmlAttribute.Key) - .WriteParameterSeparator() - .WriteStartMethodInvocation(_tagHelperContext.MarkAsHtmlEncodedMethodName); - - // If it's a plain text value then we need to surround the value with quotes. - if (isPlainTextValue) - { - _writer.WriteStringLiteral(textValue); - } - else - { - RenderBufferedAttributeValueAccessor(_writer); - } - - _writer.WriteEndMethodInvocation(endLine: false) - .WriteEndMethodInvocation(); + RenderBufferedAttributeValueAccessor(_writer); } + + _writer + .WriteEndMethodInvocation(endLine: false) + .WriteEndMethodInvocation(); } } @@ -627,26 +648,6 @@ namespace Microsoft.AspNet.Razor.CodeGenerators return true; } - // An IEqualityComparer for string -> Chunk mappings which compares only the Key. - private class KeyValuePairKeyComparer : IEqualityComparer> - { - public static KeyValuePairKeyComparer Default = new KeyValuePairKeyComparer(); - - private KeyValuePairKeyComparer() - { - } - - public bool Equals(KeyValuePair keyValuePairX, KeyValuePair keyValuePairY) - { - return string.Equals(keyValuePairX.Key, keyValuePairY.Key, StringComparison.OrdinalIgnoreCase); - } - - public int GetHashCode(KeyValuePair keyValuePair) - { - return keyValuePair.Key.GetHashCode(); - } - } - // A CSharpCodeVisitor which does not HTML encode values. Used when rendering bound string attribute values. private class CSharpLiteralCodeVisitor : CSharpCodeVisitor { diff --git a/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs index 8a369b17fc..c8c34f91fd 100644 --- a/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs +++ b/test/Microsoft.AspNet.Razor.Test/CodeGenerators/CSharpTagHelperRenderingTest.cs @@ -396,25 +396,28 @@ namespace Microsoft.AspNet.Razor.Test.Generator DefaultPAndInputTagHelperDescriptors, new List { - BuildLineMapping(documentAbsoluteIndex: 14, - documentLineIndex: 0, - generatedAbsoluteIndex: 475, - generatedLineIndex: 15, - characterOffsetIndex: 14, - contentLength: 17), - BuildLineMapping(documentAbsoluteIndex: 202, - documentLineIndex: 5, - documentCharacterOffsetIndex: 38, - generatedAbsoluteIndex: 1300, - generatedLineIndex: 40, - generatedCharacterOffsetIndex: 6, - contentLength: 23), - BuildLineMapping(documentAbsoluteIndex: 287, - documentLineIndex: 6, - generatedAbsoluteIndex: 1677, - generatedLineIndex: 49, - characterOffsetIndex: 40, - contentLength: 4) + BuildLineMapping( + documentAbsoluteIndex: 14, + documentLineIndex: 0, + generatedAbsoluteIndex: 475, + generatedLineIndex: 15, + characterOffsetIndex: 14, + contentLength: 17), + BuildLineMapping( + documentAbsoluteIndex: 202, + documentLineIndex: 5, + documentCharacterOffsetIndex: 38, + generatedAbsoluteIndex: 1194, + generatedLineIndex: 38, + generatedCharacterOffsetIndex: 6, + contentLength: 23), + BuildLineMapping( + documentAbsoluteIndex: 287, + documentLineIndex: 6, + generatedAbsoluteIndex: 1677, + generatedLineIndex: 49, + characterOffsetIndex: 40, + contentLength: 4), } }, { @@ -449,36 +452,236 @@ namespace Microsoft.AspNet.Razor.Test.Generator DefaultPAndInputTagHelperDescriptors, new List { - BuildLineMapping(14, 0, 479, 15, 14, 17), - BuildLineMapping(36, 2, 1, 1001, 35, 0, 48), - BuildLineMapping(211, 9, 1119, 44, 0, 12), - BuildLineMapping(224, 9, 13, 1215, 50, 12, 27), - BuildLineMapping(352, 12, 1613, 62, 0, 48), - BuildLineMapping(446, 15, 46, 1804, 71, 6, 8), - BuildLineMapping(463, 15, 2127, 79, 63, 4), - BuildLineMapping(507, 16, 31, 2334, 86, 6, 30), - BuildLineMapping(574, 17, 30, 2683, 95, 0, 10), - BuildLineMapping(606, 17, 62, 2765, 101, 0, 1), - BuildLineMapping(607, 17, 63, 2838, 107, 0, 8), - BuildLineMapping(637, 17, 93, 2918, 113, 0, 1), - BuildLineMapping(638, 17, 94, 2991, 119, 0, 1), - BuildLineMapping(645, 18, 0, 3245, 128, 0, 15), - BuildLineMapping(163, 7, 32, 3394, 135, 6, 12), - BuildLineMapping(725, 21, 0, 3477, 140, 0, 12), - BuildLineMapping(739, 21, 14, 3575, 146, 14, 21), - BuildLineMapping(793, 22, 30, 3832, 154, 28, 7), - BuildLineMapping(691, 20, 17, 3988, 160, 19, 23), - BuildLineMapping(714, 20, 40, 4011, 160, 42, 7), - BuildLineMapping(903, 25, 30, 4253, 167, 28, 30), - BuildLineMapping(837, 24, 16, 4432, 173, 19, 8), - BuildLineMapping(846, 24, 25, 4440, 173, 27, 23), - BuildLineMapping(1032, 28, 28, 4698, 180, 28, 30), - BuildLineMapping(970, 27, 16, 4877, 186, 19, 30), - BuildLineMapping(1162, 31, 28, 5142, 193, 28, 3), - BuildLineMapping(1167, 31, 33, 5145, 193, 31, 27), - BuildLineMapping(1195, 31, 61, 5172, 193, 58, 10), - BuildLineMapping(1100, 30, 18, 5331, 199, 19, 29), - BuildLineMapping(1237, 34, 0, 5431, 204, 0, 1), + BuildLineMapping( + documentAbsoluteIndex: 14, + documentLineIndex: 0, + generatedAbsoluteIndex: 479, + generatedLineIndex: 15, + characterOffsetIndex: 14, + contentLength: 17), + BuildLineMapping( + documentAbsoluteIndex: 36, + documentLineIndex: 2, + documentCharacterOffsetIndex: 1, + generatedAbsoluteIndex: 1001, + generatedLineIndex: 35, + generatedCharacterOffsetIndex: 0, + contentLength: 48), + BuildLineMapping( + documentAbsoluteIndex: 211, + documentLineIndex: 9, + generatedAbsoluteIndex: 1119, + generatedLineIndex: 44, + characterOffsetIndex: 0, + contentLength: 12), + BuildLineMapping( + documentAbsoluteIndex: 224, + documentLineIndex: 9, + documentCharacterOffsetIndex: 13, + generatedAbsoluteIndex: 1215, + generatedLineIndex: 50, + generatedCharacterOffsetIndex: 12, + contentLength: 27), + BuildLineMapping( + documentAbsoluteIndex: 352, + documentLineIndex: 12, + generatedAbsoluteIndex: 1613, + generatedLineIndex: 62, + characterOffsetIndex: 0, + contentLength: 48), + BuildLineMapping( + documentAbsoluteIndex: 446, + documentLineIndex: 15, + documentCharacterOffsetIndex: 46, + generatedAbsoluteIndex: 1873, + generatedLineIndex: 72, + generatedCharacterOffsetIndex: 6, + contentLength: 8), + BuildLineMapping( + documentAbsoluteIndex: 463, + documentLineIndex: 15, + generatedAbsoluteIndex: 2127, + generatedLineIndex: 79, + characterOffsetIndex: 63, + contentLength: 4), + BuildLineMapping( + documentAbsoluteIndex: 507, + documentLineIndex: 16, + documentCharacterOffsetIndex: 31, + generatedAbsoluteIndex: 2403, + generatedLineIndex: 87, + generatedCharacterOffsetIndex: 6, + contentLength: 30), + BuildLineMapping( + documentAbsoluteIndex: 574, + documentLineIndex: 17, + documentCharacterOffsetIndex: 30, + generatedAbsoluteIndex: 2752, + generatedLineIndex: 96, + generatedCharacterOffsetIndex: 0, + contentLength: 10), + BuildLineMapping( + documentAbsoluteIndex: 606, + documentLineIndex: 17, + documentCharacterOffsetIndex: 62, + generatedAbsoluteIndex: 2834, + generatedLineIndex: 102, + generatedCharacterOffsetIndex: 0, + contentLength: 1), + BuildLineMapping( + documentAbsoluteIndex: 607, + documentLineIndex: 17, + documentCharacterOffsetIndex: 63, + generatedAbsoluteIndex: 2907, + generatedLineIndex: 108, + generatedCharacterOffsetIndex: 0, + contentLength: 8), + BuildLineMapping( + documentAbsoluteIndex: 637, + documentLineIndex: 17, + documentCharacterOffsetIndex: 93, + generatedAbsoluteIndex: 2987, + generatedLineIndex: 114, + generatedCharacterOffsetIndex: 0, + contentLength: 1), + BuildLineMapping( + documentAbsoluteIndex: 638, + documentLineIndex: 17, + documentCharacterOffsetIndex: 94, + generatedAbsoluteIndex: 3060, + generatedLineIndex: 120, + generatedCharacterOffsetIndex: 0, + contentLength: 1), + BuildLineMapping( + documentAbsoluteIndex: 645, + documentLineIndex: 18, + generatedAbsoluteIndex: 3245, + generatedLineIndex: 128, + characterOffsetIndex: 0, + contentLength: 15), + BuildLineMapping( + documentAbsoluteIndex: 163, + documentLineIndex: 7, + documentCharacterOffsetIndex: 32, + generatedAbsoluteIndex: 3394, + generatedLineIndex: 135, + generatedCharacterOffsetIndex: 6, + contentLength: 12), + BuildLineMapping( + documentAbsoluteIndex: 771, + documentLineIndex: 21, + generatedAbsoluteIndex: 3477, + generatedLineIndex: 140, + characterOffsetIndex: 0, + contentLength: 12), + BuildLineMapping( + documentAbsoluteIndex: 785, + documentLineIndex: 21, + generatedAbsoluteIndex: 3575, + generatedLineIndex: 146, + characterOffsetIndex: 14, + contentLength: 21), + BuildLineMapping( + documentAbsoluteIndex: 839, + documentLineIndex: 22, + documentCharacterOffsetIndex: 30, + generatedAbsoluteIndex: 3832, + generatedLineIndex: 154, + generatedCharacterOffsetIndex: 28, + contentLength: 7), + BuildLineMapping( + documentAbsoluteIndex: 713, + documentLineIndex: 20, + documentCharacterOffsetIndex: 39, + generatedAbsoluteIndex: 4007, + generatedLineIndex: 160, + generatedCharacterOffsetIndex: 38, + contentLength: 23), + BuildLineMapping( + documentAbsoluteIndex: 736, + documentLineIndex: 20, + documentCharacterOffsetIndex: 62, + generatedAbsoluteIndex: 4030, + generatedLineIndex: 160, + generatedCharacterOffsetIndex: 61, + contentLength: 7), + BuildLineMapping( + documentAbsoluteIndex: 981, + documentLineIndex: 25, + documentCharacterOffsetIndex: 62, + generatedAbsoluteIndex: 4304, + generatedLineIndex: 167, + generatedCharacterOffsetIndex: 60, + contentLength: 30), + BuildLineMapping( + documentAbsoluteIndex: 883, + documentLineIndex: 24, + documentCharacterOffsetIndex: 16, + generatedAbsoluteIndex: 4483, + generatedLineIndex: 173, + generatedCharacterOffsetIndex: 19, + contentLength: 8), + BuildLineMapping( + documentAbsoluteIndex: 892, + documentLineIndex: 24, + documentCharacterOffsetIndex: 25, + generatedAbsoluteIndex: 4491, + generatedLineIndex: 173, + generatedCharacterOffsetIndex: 27, + contentLength: 23), + BuildLineMapping( + documentAbsoluteIndex: 1110, + documentLineIndex: 28, + generatedAbsoluteIndex: 4749, + generatedLineIndex: 180, + characterOffsetIndex: 28, + contentLength: 30), + BuildLineMapping( + documentAbsoluteIndex: 1048, + documentLineIndex: 27, + documentCharacterOffsetIndex: 16, + generatedAbsoluteIndex: 4928, + generatedLineIndex: 186, + generatedCharacterOffsetIndex: 19, + contentLength: 30), + BuildLineMapping( + documentAbsoluteIndex: 1240, + documentLineIndex: 31, + generatedAbsoluteIndex: 5193, + generatedLineIndex: 193, + characterOffsetIndex: 28, + contentLength: 3), + BuildLineMapping( + documentAbsoluteIndex: 1245, + documentLineIndex: 31, + documentCharacterOffsetIndex: 33, + generatedAbsoluteIndex: 5196, + generatedLineIndex: 193, + generatedCharacterOffsetIndex: 31, + contentLength: 27), + BuildLineMapping( + documentAbsoluteIndex: 1273, + documentLineIndex: 31, + documentCharacterOffsetIndex: 61, + generatedAbsoluteIndex: 5223, + generatedLineIndex: 193, + generatedCharacterOffsetIndex: 58, + contentLength: 10), + BuildLineMapping( + documentAbsoluteIndex: 1178, + documentLineIndex: 30, + documentCharacterOffsetIndex: 18, + generatedAbsoluteIndex: 5382, + generatedLineIndex: 199, + generatedCharacterOffsetIndex: 19, + contentLength: 29), + BuildLineMapping( + documentAbsoluteIndex: 1315, + documentLineIndex: 34, + generatedAbsoluteIndex: 5482, + generatedLineIndex: 204, + characterOffsetIndex: 0, + contentLength: 1), } }, { @@ -521,31 +724,35 @@ namespace Microsoft.AspNet.Razor.Test.Generator DefaultPAndInputTagHelperDescriptors, new List { - BuildLineMapping(documentAbsoluteIndex: 14, - documentLineIndex: 0, - generatedAbsoluteIndex: 479, - generatedLineIndex: 15, - characterOffsetIndex: 14, - contentLength: 11), - BuildLineMapping(documentAbsoluteIndex: 102, - documentLineIndex: 3, - generatedAbsoluteIndex: 975, - generatedLineIndex: 34, - characterOffsetIndex: 29, - contentLength: 12), - BuildLineMapping(documentAbsoluteIndex: 200, - documentLineIndex: 5, - documentCharacterOffsetIndex: 51, - generatedAbsoluteIndex: 1130, - generatedLineIndex: 40, - generatedCharacterOffsetIndex: 6, - contentLength: 12), - BuildLineMapping(documentAbsoluteIndex: 223, - documentLineIndex: 5, - generatedAbsoluteIndex: 1467, - generatedLineIndex: 48, - characterOffsetIndex: 74, - contentLength: 4) + BuildLineMapping( + documentAbsoluteIndex: 14, + documentLineIndex: 0, + generatedAbsoluteIndex: 479, + generatedLineIndex: 15, + characterOffsetIndex: 14, + contentLength: 11), + BuildLineMapping( + documentAbsoluteIndex: 102, + documentLineIndex: 3, + generatedAbsoluteIndex: 975, + generatedLineIndex: 34, + characterOffsetIndex: 29, + contentLength: 12), + BuildLineMapping( + documentAbsoluteIndex: 200, + documentLineIndex: 5, + documentCharacterOffsetIndex: 51, + generatedAbsoluteIndex: 1199, + generatedLineIndex: 41, + generatedCharacterOffsetIndex: 6, + contentLength: 12), + BuildLineMapping( + documentAbsoluteIndex: 223, + documentLineIndex: 5, + generatedAbsoluteIndex: 1467, + generatedLineIndex: 48, + characterOffsetIndex: 74, + contentLength: 4), } }, { @@ -554,25 +761,27 @@ namespace Microsoft.AspNet.Razor.Test.Generator AttributeTargetingTagHelperDescriptors, new List { - BuildLineMapping(documentAbsoluteIndex: 14, - documentLineIndex: 0, - generatedAbsoluteIndex: 501, - generatedLineIndex: 15, - characterOffsetIndex: 14, - contentLength: 14), - BuildLineMapping(documentAbsoluteIndex: 186, - documentLineIndex: 5, - generatedAbsoluteIndex: 1460, - generatedLineIndex: 41, - characterOffsetIndex: 36, - contentLength: 4), - BuildLineMapping(documentAbsoluteIndex: 232, - documentLineIndex: 6, - documentCharacterOffsetIndex: 36, - generatedAbsoluteIndex: 1827, - generatedLineIndex: 50, - generatedCharacterOffsetIndex: 36, - contentLength: 4) + BuildLineMapping( + documentAbsoluteIndex: 14, + documentLineIndex: 0, + generatedAbsoluteIndex: 501, + generatedLineIndex: 15, + characterOffsetIndex: 14, + contentLength: 14), + BuildLineMapping( + documentAbsoluteIndex: 186, + documentLineIndex: 5, + generatedAbsoluteIndex: 1460, + generatedLineIndex: 41, + characterOffsetIndex: 36, + contentLength: 4), + BuildLineMapping( + documentAbsoluteIndex: 232, + documentLineIndex: 6, + generatedAbsoluteIndex: 1900, + generatedLineIndex: 51, + characterOffsetIndex: 36, + contentLength: 4), } }, { @@ -598,74 +807,74 @@ namespace Microsoft.AspNet.Razor.Test.Generator BuildLineMapping( documentAbsoluteIndex: 370, documentLineIndex: 15, - generatedAbsoluteIndex: 1430, - generatedLineIndex: 50, + generatedAbsoluteIndex: 1499, + generatedLineIndex: 51, characterOffsetIndex: 43, contentLength: 13), BuildLineMapping( documentAbsoluteIndex: 404, documentLineIndex: 15, - generatedAbsoluteIndex: 1601, - generatedLineIndex: 55, + generatedAbsoluteIndex: 1766, + generatedLineIndex: 57, characterOffsetIndex: 77, contentLength: 16), BuildLineMapping( documentAbsoluteIndex: 468, documentLineIndex: 16, - generatedAbsoluteIndex: 2077, - generatedLineIndex: 64, + generatedAbsoluteIndex: 2146, + generatedLineIndex: 65, characterOffsetIndex: 43, contentLength: 13), BuildLineMapping( documentAbsoluteIndex: 502, documentLineIndex: 16, - generatedAbsoluteIndex: 2248, - generatedLineIndex: 69, + generatedAbsoluteIndex: 2413, + generatedLineIndex: 71, characterOffsetIndex: 77, contentLength: 2), BuildLineMapping( documentAbsoluteIndex: 526, documentLineIndex: 16, - generatedAbsoluteIndex: 2432, - generatedLineIndex: 74, + generatedAbsoluteIndex: 2713, + generatedLineIndex: 77, characterOffsetIndex: 101, contentLength: 2), BuildLineMapping( documentAbsoluteIndex: 590, documentLineIndex: 18, documentCharacterOffsetIndex: 31, - generatedAbsoluteIndex: 2994, - generatedLineIndex: 84, + generatedAbsoluteIndex: 3063, + generatedLineIndex: 85, generatedCharacterOffsetIndex: 32, contentLength: 2), BuildLineMapping( documentAbsoluteIndex: 611, documentLineIndex: 18, - generatedAbsoluteIndex: 3129, - generatedLineIndex: 89, + generatedAbsoluteIndex: 3295, + generatedLineIndex: 91, characterOffsetIndex: 52, contentLength: 2), BuildLineMapping( documentAbsoluteIndex: 634, documentLineIndex: 18, - generatedAbsoluteIndex: 3287, - generatedLineIndex: 94, + generatedAbsoluteIndex: 3565, + generatedLineIndex: 97, characterOffsetIndex: 75, contentLength: 2), BuildLineMapping( documentAbsoluteIndex: 783, documentLineIndex: 20, documentCharacterOffsetIndex: 42, - generatedAbsoluteIndex: 3521, - generatedLineIndex: 101, + generatedAbsoluteIndex: 4142, + generatedLineIndex: 107, generatedCharacterOffsetIndex: 6, contentLength: 8), BuildLineMapping( documentAbsoluteIndex: 826, documentLineIndex: 21, documentCharacterOffsetIndex: 29, - generatedAbsoluteIndex: 4552, - generatedLineIndex: 115, + generatedAbsoluteIndex: 4621, + generatedLineIndex: 116, generatedCharacterOffsetIndex: 51, contentLength: 2), } diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.DesignTime.cs index 8895517051..881ec9204b 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.DesignTime.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.DesignTime.cs @@ -35,8 +35,8 @@ namespace TestOutput { __CatchAllTagHelper = CreateTagHelper(); __InputTagHelper = CreateTagHelper(); - __InputTagHelper.Type = "checkbox"; __InputTagHelper2 = CreateTagHelper(); + __InputTagHelper.Type = "checkbox"; __InputTagHelper2.Type = __InputTagHelper.Type; #line 6 "AttributeTargetingTagHelpers.cshtml" __InputTagHelper2.Checked = true; @@ -44,15 +44,15 @@ namespace TestOutput #line default #line hidden __InputTagHelper = CreateTagHelper(); - __InputTagHelper.Type = "checkbox"; __InputTagHelper2 = CreateTagHelper(); + __CatchAllTagHelper = CreateTagHelper(); + __InputTagHelper.Type = "checkbox"; __InputTagHelper2.Type = __InputTagHelper.Type; #line 7 "AttributeTargetingTagHelpers.cshtml" __InputTagHelper2.Checked = true; #line default #line hidden - __CatchAllTagHelper = CreateTagHelper(); __PTagHelper = CreateTagHelper(); } #pragma warning restore 1998 diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs index 6b474956de..4a26806d47 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/AttributeTargetingTagHelpers.cs @@ -48,10 +48,10 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.Type = "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + __InputTagHelper.Type = "checkbox"; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2.Type = __InputTagHelper.Type; #line 6 "AttributeTargetingTagHelpers.cshtml" __InputTagHelper2.Checked = true; @@ -68,10 +68,12 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.Type = "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + __CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__CatchAllTagHelper); + __InputTagHelper.Type = "checkbox"; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2.Type = __InputTagHelper.Type; #line 7 "AttributeTargetingTagHelpers.cshtml" __InputTagHelper2.Checked = true; @@ -79,8 +81,6 @@ namespace TestOutput #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper2.Checked); - __CatchAllTagHelper = CreateTagHelper(); - __tagHelperExecutionContext.Add(__CatchAllTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("catchAll", Html.Raw("hi")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs index f5a204d50b..314b84e2c2 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.CustomAttributeCodeGenerator.cs @@ -44,11 +44,8 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.Type = **From custom attribute code renderer**: "text"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); - __InputTagHelper2.Type = __InputTagHelper.Type; StartTagHelperWritingScope(); WriteLiteral("2000 + "); #line 6 "BasicTagHelpers.cshtml" @@ -59,6 +56,9 @@ Write(ViewBag.DefaultInterval); WriteLiteral(" + 1"); __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __tagHelperExecutionContext.AddHtmlAttribute("data-interval", Html.Raw(__tagHelperStringValueBuffer.ToString())); + __InputTagHelper.Type = **From custom attribute code renderer**: "text"; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); + __InputTagHelper2.Type = __InputTagHelper.Type; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); @@ -68,10 +68,10 @@ Write(ViewBag.DefaultInterval); , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.Type = **From custom attribute code renderer**: "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + __InputTagHelper.Type = **From custom attribute code renderer**: "checkbox"; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2.Type = __InputTagHelper.Type; #line 7 "BasicTagHelpers.cshtml" __InputTagHelper2.Checked = **From custom attribute code renderer**: true; diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.DesignTime.cs index 299eab8d4a..88dc1992a9 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.DesignTime.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.DesignTime.cs @@ -34,17 +34,17 @@ namespace TestOutput { __PTagHelper = CreateTagHelper(); __InputTagHelper = CreateTagHelper(); - __InputTagHelper.Type = "text"; __InputTagHelper2 = CreateTagHelper(); - __InputTagHelper2.Type = __InputTagHelper.Type; #line 6 "BasicTagHelpers.cshtml" __o = ViewBag.DefaultInterval; #line default #line hidden + __InputTagHelper.Type = "text"; + __InputTagHelper2.Type = __InputTagHelper.Type; __InputTagHelper = CreateTagHelper(); - __InputTagHelper.Type = "checkbox"; __InputTagHelper2 = CreateTagHelper(); + __InputTagHelper.Type = "checkbox"; __InputTagHelper2.Type = __InputTagHelper.Type; #line 7 "BasicTagHelpers.cshtml" __InputTagHelper2.Checked = true; diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.DesignTime.cs index 64ff193777..18306d1af9 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.DesignTime.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.DesignTime.cs @@ -40,8 +40,8 @@ namespace TestOutput public override async Task ExecuteAsync() { __InputTagHelper = CreateTagHelper(); - __InputTagHelper.Type = "checkbox"; __InputTagHelper2 = CreateTagHelper(); + __InputTagHelper.Type = "checkbox"; __InputTagHelper2.Type = __InputTagHelper.Type; #line 8 "BasicTagHelpers.Prefixed.cshtml" __InputTagHelper2.Checked = true; diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs index 5d99c24a86..dc5b722366 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.Prefixed.cs @@ -36,10 +36,10 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.Type = "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + __InputTagHelper.Type = "checkbox"; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2.Type = __InputTagHelper.Type; #line 8 "BasicTagHelpers.Prefixed.cshtml" __InputTagHelper2.Checked = true; diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs index ad20384e5c..86c96276f5 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/BasicTagHelpers.cs @@ -45,11 +45,8 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.Type = "text"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); - __InputTagHelper2.Type = __InputTagHelper.Type; StartTagHelperWritingScope(); WriteLiteral("2000 + "); #line 6 "BasicTagHelpers.cshtml" @@ -60,6 +57,9 @@ Write(ViewBag.DefaultInterval); WriteLiteral(" + 1"); __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __tagHelperExecutionContext.AddHtmlAttribute("data-interval", Html.Raw(__tagHelperStringValueBuffer.ToString())); + __InputTagHelper.Type = "text"; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); + __InputTagHelper2.Type = __InputTagHelper.Type; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); @@ -69,10 +69,10 @@ Write(ViewBag.DefaultInterval); , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.Type = "checkbox"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + __InputTagHelper.Type = "checkbox"; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2.Type = __InputTagHelper.Type; #line 7 "BasicTagHelpers.cshtml" __InputTagHelper2.Checked = true; diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.DesignTime.cs index 952252b91a..dfcdb0e3f3 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.DesignTime.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.DesignTime.cs @@ -55,8 +55,8 @@ if (true) #line hidden __InputTagHelper = CreateTagHelper(); - __InputTagHelper.Type = "text"; __InputTagHelper2 = CreateTagHelper(); + __InputTagHelper.Type = "text"; __InputTagHelper2.Type = __InputTagHelper.Type; __PTagHelper = CreateTagHelper(); #line 13 "ComplexTagHelpers.cshtml" @@ -68,13 +68,13 @@ if (true) #line hidden __InputTagHelper = CreateTagHelper(); + __InputTagHelper2 = CreateTagHelper(); #line 16 "ComplexTagHelpers.cshtml" __o = checkbox; #line default #line hidden __InputTagHelper.Type = string.Empty; - __InputTagHelper2 = CreateTagHelper(); __InputTagHelper2.Type = __InputTagHelper.Type; #line 16 "ComplexTagHelpers.cshtml" __InputTagHelper2.Checked = true; @@ -83,15 +83,16 @@ __o = checkbox; #line hidden __PTagHelper = CreateTagHelper(); __InputTagHelper = CreateTagHelper(); + __InputTagHelper2 = CreateTagHelper(); #line 17 "ComplexTagHelpers.cshtml" __o = true ? "checkbox" : "anything"; #line default #line hidden __InputTagHelper.Type = string.Empty; - __InputTagHelper2 = CreateTagHelper(); __InputTagHelper2.Type = __InputTagHelper.Type; __InputTagHelper = CreateTagHelper(); + __InputTagHelper2 = CreateTagHelper(); #line 18 "ComplexTagHelpers.cshtml" if(true) { @@ -123,7 +124,6 @@ if(true) { #line hidden __InputTagHelper.Type = string.Empty; - __InputTagHelper2 = CreateTagHelper(); __InputTagHelper2.Type = __InputTagHelper.Type; #line 19 "ComplexTagHelpers.cshtml" } @@ -158,14 +158,14 @@ __InputTagHelper2.Checked = @object; #line hidden __PTagHelper = CreateTagHelper(); #line 21 "ComplexTagHelpers.cshtml" -__PTagHelper.Age = DateTimeOffset.Now.Year - 1970; + __PTagHelper.Age = DateTimeOffset.Now.Year - 1970; #line default #line hidden __InputTagHelper = CreateTagHelper(); __InputTagHelper2 = CreateTagHelper(); #line 26 "ComplexTagHelpers.cshtml" -__InputTagHelper2.Checked = DateTimeOffset.Now.Year > 2014; + __InputTagHelper2.Checked = DateTimeOffset.Now.Year > 2014; #line default #line hidden diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs index 70180ee131..02b1d8ff0f 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/ComplexTagHelpers.cs @@ -1,4 +1,4 @@ -#pragma checksum "ComplexTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "5832e3fc8fa5fa77f49c7bdb26fb90a1dd2d6eb0" +#pragma checksum "ComplexTagHelpers.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "ece1d34a29b5cfd4b3ed96c16b3546e5a44eb260" namespace TestOutput { using Microsoft.AspNet.Razor.Runtime.TagHelpers; @@ -64,10 +64,10 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.Type = "text"; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + __InputTagHelper.Type = "text"; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2.Type = __InputTagHelper.Type; __tagHelperExecutionContext.AddHtmlAttribute("value", Html.Raw("")); __tagHelperExecutionContext.AddHtmlAttribute("placeholder", Html.Raw("Enter in a new time...")); @@ -98,6 +98,8 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); + __InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper2); StartTagHelperWritingScope(); #line 16 "ComplexTagHelpers.cshtml" WriteLiteral(checkbox); @@ -107,8 +109,6 @@ WriteLiteral(checkbox); __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __InputTagHelper.Type = __tagHelperStringValueBuffer.ToString(); __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); - __InputTagHelper2 = CreateTagHelper(); - __tagHelperExecutionContext.Add(__InputTagHelper2); __InputTagHelper2.Type = __InputTagHelper.Type; #line 16 "ComplexTagHelpers.cshtml" __InputTagHelper2.Checked = true; @@ -132,6 +132,8 @@ WriteLiteral(checkbox); , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); + __InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper2); StartTagHelperWritingScope(); #line 17 "ComplexTagHelpers.cshtml" WriteLiteral(true ? "checkbox" : "anything"); @@ -141,8 +143,6 @@ WriteLiteral(true ? "checkbox" : "anything"); __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __InputTagHelper.Type = __tagHelperStringValueBuffer.ToString(); __tagHelperExecutionContext.AddTagHelperAttribute("tYPe", __InputTagHelper.Type); - __InputTagHelper2 = CreateTagHelper(); - __tagHelperExecutionContext.Add(__InputTagHelper2); __InputTagHelper2.Type = __InputTagHelper.Type; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); @@ -153,6 +153,8 @@ WriteLiteral(true ? "checkbox" : "anything"); , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); + __InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper2); StartTagHelperWritingScope(); #line 18 "ComplexTagHelpers.cshtml" if(true) { @@ -189,8 +191,6 @@ if(true) { __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __InputTagHelper.Type = __tagHelperStringValueBuffer.ToString(); __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); - __InputTagHelper2 = CreateTagHelper(); - __tagHelperExecutionContext.Add(__InputTagHelper2); __InputTagHelper2.Type = __InputTagHelper.Type; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); @@ -258,16 +258,18 @@ __InputTagHelper2.Checked = @object; , StartTagHelperWritingScope, EndTagHelperWritingScope); __PTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__PTagHelper); + __tagHelperExecutionContext.AddHtmlAttribute("unbound", Html.Raw("first value")); #line 21 "ComplexTagHelpers.cshtml" -__PTagHelper.Age = DateTimeOffset.Now.Year - 1970; + __PTagHelper.Age = DateTimeOffset.Now.Year - 1970; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age); + __tagHelperExecutionContext.AddHtmlAttribute("unbound", Html.Raw("second value")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); - Instrumentation.BeginContext(819, 10, true); + Instrumentation.BeginContext(865, 10, true); WriteLiteral("\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", false, "test", async() => { @@ -279,8 +281,10 @@ __PTagHelper.Age = DateTimeOffset.Now.Year - 1970; __tagHelperExecutionContext.Add(__InputTagHelper); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + __tagHelperExecutionContext.AddHtmlAttribute("unbound", Html.Raw("hello")); + __tagHelperExecutionContext.AddHtmlAttribute("unbound", Html.Raw("world")); #line 26 "ComplexTagHelpers.cshtml" -__InputTagHelper2.Checked = DateTimeOffset.Now.Year > 2014; + __InputTagHelper2.Checked = DateTimeOffset.Now.Year > 2014; #line default #line hidden @@ -302,7 +306,7 @@ __PTagHelper.Age = -1970 + DateTimeOffset.Now.Year; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); - Instrumentation.BeginContext(952, 10, true); + Instrumentation.BeginContext(1030, 10, true); WriteLiteral("\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", false, "test", async() => { @@ -337,7 +341,7 @@ __PTagHelper.Age = DateTimeOffset.Now.Year - 1970; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); - Instrumentation.BeginContext(1080, 10, true); + Instrumentation.BeginContext(1158, 10, true); WriteLiteral("\r\n "); Instrumentation.EndContext(); __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", false, "test", async() => { @@ -372,7 +376,7 @@ __PTagHelper.Age = "My age is this long.".Length; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); - Instrumentation.BeginContext(1223, 14, true); + Instrumentation.BeginContext(1301, 14, true); WriteLiteral("\r\n \r\n"); Instrumentation.EndContext(); #line 35 "ComplexTagHelpers.cshtml" diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs index 37d53acfb5..efaddf38c5 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/DuplicateTargetTagHelper.cs @@ -33,17 +33,17 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); + __CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__CatchAllTagHelper); __InputTagHelper.Type = "checkbox"; __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); + __CatchAllTagHelper.Type = __InputTagHelper.Type; #line 3 "DuplicateTargetTagHelper.cshtml" __InputTagHelper.Checked = true; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("checked", __InputTagHelper.Checked); - __CatchAllTagHelper = CreateTagHelper(); - __tagHelperExecutionContext.Add(__CatchAllTagHelper); - __CatchAllTagHelper.Type = __InputTagHelper.Type; __CatchAllTagHelper.Checked = __InputTagHelper.Checked; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.DesignTime.cs index 931181397d..8dd7632564 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.DesignTime.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.DesignTime.cs @@ -33,8 +33,8 @@ namespace TestOutput public override async Task ExecuteAsync() { __InputTagHelper = CreateTagHelper(); - __InputTagHelper.Type = ""; __InputTagHelper2 = CreateTagHelper(); + __InputTagHelper.Type = ""; __InputTagHelper2.Type = __InputTagHelper.Type; #line 4 "EmptyAttributeTagHelpers.cshtml" __InputTagHelper2.Checked = ; @@ -42,8 +42,8 @@ __InputTagHelper2.Checked = ; #line default #line hidden __InputTagHelper = CreateTagHelper(); - __InputTagHelper.Type = ""; __InputTagHelper2 = CreateTagHelper(); + __InputTagHelper.Type = ""; __InputTagHelper2.Type = __InputTagHelper.Type; #line 6 "EmptyAttributeTagHelpers.cshtml" __InputTagHelper2.Checked = ; diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs index 0ec84634f2..358d1df2e1 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EmptyAttributeTagHelpers.cs @@ -34,10 +34,10 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.Type = ""; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + __InputTagHelper.Type = ""; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2.Type = __InputTagHelper.Type; #line 4 "EmptyAttributeTagHelpers.cshtml" __InputTagHelper2.Checked = ; @@ -59,10 +59,10 @@ __InputTagHelper2.Checked = ; , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.Type = ""; - __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + __InputTagHelper.Type = ""; + __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); __InputTagHelper2.Type = __InputTagHelper.Type; #line 6 "EmptyAttributeTagHelpers.cshtml" __InputTagHelper2.Checked = ; diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.DesignTime.cs index 5f98ce4899..b9fe61f0cb 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.DesignTime.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.DesignTime.cs @@ -37,13 +37,13 @@ namespace TestOutput #line default #line hidden __InputTagHelper = CreateTagHelper(); + __InputTagHelper2 = CreateTagHelper(); #line 6 "EscapedTagHelpers.cshtml" __o = DateTime.Now; #line default #line hidden __InputTagHelper.Type = string.Empty; - __InputTagHelper2 = CreateTagHelper(); __InputTagHelper2.Type = __InputTagHelper.Type; #line 6 "EscapedTagHelpers.cshtml" __InputTagHelper2.Checked = true; diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs index 5b1980f3cc..518e08f95a 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/EscapedTagHelpers.cs @@ -43,6 +43,8 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); + __InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper2); StartTagHelperWritingScope(); #line 6 "EscapedTagHelpers.cshtml" WriteLiteral(DateTime.Now); @@ -52,8 +54,6 @@ WriteLiteral(DateTime.Now); __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __InputTagHelper.Type = __tagHelperStringValueBuffer.ToString(); __tagHelperExecutionContext.AddTagHelperAttribute("type", __InputTagHelper.Type); - __InputTagHelper2 = CreateTagHelper(); - __tagHelperExecutionContext.Add(__InputTagHelper2); __InputTagHelper2.Type = __InputTagHelper.Type; #line 6 "EscapedTagHelpers.cshtml" __InputTagHelper2.Checked = true; diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.DesignTime.cs index dc4e928a67..b1bfeb0bb9 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.DesignTime.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.DesignTime.cs @@ -33,15 +33,15 @@ namespace TestOutput { __CatchAllTagHelper = CreateTagHelper(); __InputTagHelper = CreateTagHelper(); - __InputTagHelper.BoundRequiredString = "hello"; __CatchAllTagHelper = CreateTagHelper(); + __InputTagHelper.BoundRequiredString = "hello"; __InputTagHelper = CreateTagHelper(); - __InputTagHelper.BoundRequiredString = "hello2"; __CatchAllTagHelper = CreateTagHelper(); __CatchAllTagHelper.BoundRequiredString = "world"; + __InputTagHelper.BoundRequiredString = "hello2"; __InputTagHelper = CreateTagHelper(); - __InputTagHelper.BoundRequiredString = "world"; __CatchAllTagHelper = CreateTagHelper(); + __InputTagHelper.BoundRequiredString = "world"; __CatchAllTagHelper = CreateTagHelper(); } #pragma warning restore 1998 diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs index 050b8f6b52..1556df3e6a 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/MinimizedTagHelpers.cs @@ -46,13 +46,13 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); + __CatchAllTagHelper = CreateTagHelper(); + __tagHelperExecutionContext.Add(__CatchAllTagHelper); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn")); + __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); + __tagHelperExecutionContext.AddMinimizedHtmlAttribute("input-unbound-required"); __InputTagHelper.BoundRequiredString = "hello"; __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString); - __CatchAllTagHelper = CreateTagHelper(); - __tagHelperExecutionContext.Add(__CatchAllTagHelper); - __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn")); - __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); - __tagHelperExecutionContext.AddMinimizedHtmlAttribute("input-unbound-required"); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); @@ -62,15 +62,15 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.BoundRequiredString = "hello2"; - __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString); __CatchAllTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__CatchAllTagHelper); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn")); + __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); + __tagHelperExecutionContext.AddMinimizedHtmlAttribute("input-unbound-required"); __CatchAllTagHelper.BoundRequiredString = "world"; __tagHelperExecutionContext.AddTagHelperAttribute("catchall-bound-string", __CatchAllTagHelper.BoundRequiredString); - __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn")); - __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); - __tagHelperExecutionContext.AddMinimizedHtmlAttribute("input-unbound-required"); + __InputTagHelper.BoundRequiredString = "hello2"; + __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); @@ -80,14 +80,14 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper); - __InputTagHelper.BoundRequiredString = "world"; - __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString); __CatchAllTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__CatchAllTagHelper); __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("btn")); __tagHelperExecutionContext.AddHtmlAttribute("catchall-unbound-required", Html.Raw("hello")); __tagHelperExecutionContext.AddHtmlAttribute("input-unbound-required", Html.Raw("hello2")); __tagHelperExecutionContext.AddMinimizedHtmlAttribute("catchall-unbound-required"); + __InputTagHelper.BoundRequiredString = "world"; + __tagHelperExecutionContext.AddTagHelperAttribute("input-bound-required-string", __InputTagHelper.BoundRequiredString); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.DesignTime.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.DesignTime.cs index 86282df3b5..e8bd799836 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.DesignTime.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.DesignTime.cs @@ -47,79 +47,79 @@ namespace TestOutput #line hidden __InputTagHelper1 = CreateTagHelper(); + __InputTagHelper2 = CreateTagHelper(); #line 16 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty = intDictionary; #line default #line hidden + __InputTagHelper2.IntDictionaryProperty = __InputTagHelper1.IntDictionaryProperty; #line 16 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.StringDictionaryProperty = stringDictionary; #line default #line hidden - __InputTagHelper2 = CreateTagHelper(); - __InputTagHelper2.IntDictionaryProperty = __InputTagHelper1.IntDictionaryProperty; __InputTagHelper2.StringDictionaryProperty = __InputTagHelper1.StringDictionaryProperty; __InputTagHelper1 = CreateTagHelper(); + __InputTagHelper2 = CreateTagHelper(); #line 17 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty = intDictionary; #line default #line hidden + __InputTagHelper2.IntDictionaryProperty = __InputTagHelper1.IntDictionaryProperty; #line 17 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty["garlic"] = 37; #line default #line hidden + __InputTagHelper2.IntDictionaryProperty["garlic"] = __InputTagHelper1.IntDictionaryProperty["garlic"]; #line 17 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntProperty = 42; #line default #line hidden - __InputTagHelper2 = CreateTagHelper(); - __InputTagHelper2.IntDictionaryProperty = __InputTagHelper1.IntDictionaryProperty; - __InputTagHelper2.IntDictionaryProperty["garlic"] = __InputTagHelper1.IntDictionaryProperty["garlic"]; __InputTagHelper2.IntDictionaryProperty["grabber"] = __InputTagHelper1.IntProperty; __InputTagHelper1 = CreateTagHelper(); + __InputTagHelper2 = CreateTagHelper(); #line 19 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntProperty = 42; #line default #line hidden + __InputTagHelper2.IntDictionaryProperty["grabber"] = __InputTagHelper1.IntProperty; #line 19 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty["salt"] = 37; #line default #line hidden + __InputTagHelper2.IntDictionaryProperty["salt"] = __InputTagHelper1.IntDictionaryProperty["salt"]; #line 19 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty["pepper"] = 98; #line default #line hidden + __InputTagHelper2.IntDictionaryProperty["pepper"] = __InputTagHelper1.IntDictionaryProperty["pepper"]; __InputTagHelper1.StringProperty = "string"; + __InputTagHelper2.StringDictionaryProperty["grabber"] = __InputTagHelper1.StringProperty; __InputTagHelper1.StringDictionaryProperty["paprika"] = "another string"; + __InputTagHelper2.StringDictionaryProperty["paprika"] = __InputTagHelper1.StringDictionaryProperty["paprika"]; #line 21 "PrefixedAttributeTagHelpers.cshtml" __o = literate; #line default #line hidden __InputTagHelper1.StringDictionaryProperty["cumin"] = string.Empty; - __InputTagHelper2 = CreateTagHelper(); - __InputTagHelper2.IntDictionaryProperty["grabber"] = __InputTagHelper1.IntProperty; - __InputTagHelper2.IntDictionaryProperty["salt"] = __InputTagHelper1.IntDictionaryProperty["salt"]; - __InputTagHelper2.IntDictionaryProperty["pepper"] = __InputTagHelper1.IntDictionaryProperty["pepper"]; - __InputTagHelper2.StringDictionaryProperty["grabber"] = __InputTagHelper1.StringProperty; - __InputTagHelper2.StringDictionaryProperty["paprika"] = __InputTagHelper1.StringDictionaryProperty["paprika"]; __InputTagHelper2.StringDictionaryProperty["cumin"] = __InputTagHelper1.StringDictionaryProperty["cumin"]; __InputTagHelper1 = CreateTagHelper(); + __InputTagHelper2 = CreateTagHelper(); #line 22 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty["value"] = 37; #line default #line hidden - __InputTagHelper1.StringDictionaryProperty["thyme"] = "string"; - __InputTagHelper2 = CreateTagHelper(); __InputTagHelper2.IntDictionaryProperty["value"] = __InputTagHelper1.IntDictionaryProperty["value"]; + __InputTagHelper1.StringDictionaryProperty["thyme"] = "string"; __InputTagHelper2.StringDictionaryProperty["thyme"] = __InputTagHelper1.StringDictionaryProperty["thyme"]; } #pragma warning restore 1998 diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs index 9849fcec09..09df5c176b 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.Reversed.cs @@ -51,23 +51,23 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + __InputTagHelper1 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper1); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("checkbox")); #line 16 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper2.IntDictionaryProperty = intDictionary; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __InputTagHelper2.IntDictionaryProperty); + __InputTagHelper1.IntDictionaryProperty = __InputTagHelper2.IntDictionaryProperty; #line 16 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper2.StringDictionaryProperty = stringDictionary; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("string-dictionary", __InputTagHelper2.StringDictionaryProperty); - __InputTagHelper1 = CreateTagHelper(); - __tagHelperExecutionContext.Add(__InputTagHelper1); - __InputTagHelper1.IntDictionaryProperty = __InputTagHelper2.IntDictionaryProperty; __InputTagHelper1.StringDictionaryProperty = __InputTagHelper2.StringDictionaryProperty; - __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("checkbox")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); @@ -79,38 +79,38 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); + if (__InputTagHelper2.IntDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-garlic", "InputTagHelper2", "IntDictionaryProperty")); + } + __InputTagHelper1 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper1); + if (__InputTagHelper1.IntDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-garlic", "InputTagHelper1", "IntDictionaryProperty")); + } + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("password")); #line 17 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper2.IntDictionaryProperty = intDictionary; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __InputTagHelper2.IntDictionaryProperty); - if (__InputTagHelper2.IntDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-garlic", "InputTagHelper2", "IntDictionaryProperty")); - } + __InputTagHelper1.IntDictionaryProperty = __InputTagHelper2.IntDictionaryProperty; #line 17 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper2.IntDictionaryProperty["garlic"] = 37; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-garlic", __InputTagHelper2.IntDictionaryProperty["garlic"]); + __InputTagHelper1.IntDictionaryProperty["garlic"] = __InputTagHelper2.IntDictionaryProperty["garlic"]; #line 17 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper2.IntDictionaryProperty["grabber"] = 42; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __InputTagHelper2.IntDictionaryProperty["grabber"]); - __InputTagHelper1 = CreateTagHelper(); - __tagHelperExecutionContext.Add(__InputTagHelper1); - __InputTagHelper1.IntDictionaryProperty = __InputTagHelper2.IntDictionaryProperty; - if (__InputTagHelper1.IntDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-garlic", "InputTagHelper1", "IntDictionaryProperty")); - } - __InputTagHelper1.IntDictionaryProperty["garlic"] = __InputTagHelper2.IntDictionaryProperty["garlic"]; __InputTagHelper1.IntProperty = __InputTagHelper2.IntDictionaryProperty["grabber"]; - __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("password")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); @@ -126,32 +126,48 @@ namespace TestOutput { throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-grabber", "InputTagHelper2", "IntDictionaryProperty")); } + if (__InputTagHelper2.StringDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-grabber", "InputTagHelper2", "StringDictionaryProperty")); + } + __InputTagHelper1 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper1); + if (__InputTagHelper1.IntDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-salt", "InputTagHelper1", "IntDictionaryProperty")); + } + if (__InputTagHelper1.StringDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-paprika", "InputTagHelper1", "StringDictionaryProperty")); + } + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("radio")); #line 19 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper2.IntDictionaryProperty["grabber"] = 42; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __InputTagHelper2.IntDictionaryProperty["grabber"]); + __InputTagHelper1.IntProperty = __InputTagHelper2.IntDictionaryProperty["grabber"]; #line 19 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper2.IntDictionaryProperty["salt"] = 37; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-salt", __InputTagHelper2.IntDictionaryProperty["salt"]); + __InputTagHelper1.IntDictionaryProperty["salt"] = __InputTagHelper2.IntDictionaryProperty["salt"]; #line 19 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper2.IntDictionaryProperty["pepper"] = 98; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-pepper", __InputTagHelper2.IntDictionaryProperty["pepper"]); - if (__InputTagHelper2.StringDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-grabber", "InputTagHelper2", "StringDictionaryProperty")); - } + __InputTagHelper1.IntDictionaryProperty["pepper"] = __InputTagHelper2.IntDictionaryProperty["pepper"]; __InputTagHelper2.StringDictionaryProperty["grabber"] = "string"; __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-grabber", __InputTagHelper2.StringDictionaryProperty["grabber"]); + __InputTagHelper1.StringProperty = __InputTagHelper2.StringDictionaryProperty["grabber"]; __InputTagHelper2.StringDictionaryProperty["paprika"] = "another string"; __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-paprika", __InputTagHelper2.StringDictionaryProperty["paprika"]); + __InputTagHelper1.StringDictionaryProperty["paprika"] = __InputTagHelper2.StringDictionaryProperty["paprika"]; StartTagHelperWritingScope(); WriteLiteral("literate "); #line 21 "PrefixedAttributeTagHelpers.cshtml" @@ -163,23 +179,7 @@ WriteLiteral(literate); __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __InputTagHelper2.StringDictionaryProperty["cumin"] = __tagHelperStringValueBuffer.ToString(); __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-cumin", __InputTagHelper2.StringDictionaryProperty["cumin"]); - __InputTagHelper1 = CreateTagHelper(); - __tagHelperExecutionContext.Add(__InputTagHelper1); - __InputTagHelper1.IntProperty = __InputTagHelper2.IntDictionaryProperty["grabber"]; - if (__InputTagHelper1.IntDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-salt", "InputTagHelper1", "IntDictionaryProperty")); - } - __InputTagHelper1.IntDictionaryProperty["salt"] = __InputTagHelper2.IntDictionaryProperty["salt"]; - __InputTagHelper1.IntDictionaryProperty["pepper"] = __InputTagHelper2.IntDictionaryProperty["pepper"]; - __InputTagHelper1.StringProperty = __InputTagHelper2.StringDictionaryProperty["grabber"]; - if (__InputTagHelper1.StringDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-paprika", "InputTagHelper1", "StringDictionaryProperty")); - } - __InputTagHelper1.StringDictionaryProperty["paprika"] = __InputTagHelper2.StringDictionaryProperty["paprika"]; __InputTagHelper1.StringDictionaryProperty["cumin"] = __InputTagHelper2.StringDictionaryProperty["cumin"]; - __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("radio")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); @@ -195,29 +195,29 @@ WriteLiteral(literate); { throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-value", "InputTagHelper2", "IntDictionaryProperty")); } -#line 22 "PrefixedAttributeTagHelpers.cshtml" -__InputTagHelper2.IntDictionaryProperty["value"] = 37; - -#line default -#line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-value", __InputTagHelper2.IntDictionaryProperty["value"]); if (__InputTagHelper2.StringDictionaryProperty == null) { throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-thyme", "InputTagHelper2", "StringDictionaryProperty")); } - __InputTagHelper2.StringDictionaryProperty["thyme"] = "string"; - __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-thyme", __InputTagHelper2.StringDictionaryProperty["thyme"]); __InputTagHelper1 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper1); if (__InputTagHelper1.IntDictionaryProperty == null) { throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-value", "InputTagHelper1", "IntDictionaryProperty")); } - __InputTagHelper1.IntDictionaryProperty["value"] = __InputTagHelper2.IntDictionaryProperty["value"]; if (__InputTagHelper1.StringDictionaryProperty == null) { throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-thyme", "InputTagHelper1", "StringDictionaryProperty")); } +#line 22 "PrefixedAttributeTagHelpers.cshtml" +__InputTagHelper2.IntDictionaryProperty["value"] = 37; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-value", __InputTagHelper2.IntDictionaryProperty["value"]); + __InputTagHelper1.IntDictionaryProperty["value"] = __InputTagHelper2.IntDictionaryProperty["value"]; + __InputTagHelper2.StringDictionaryProperty["thyme"] = "string"; + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-thyme", __InputTagHelper2.StringDictionaryProperty["thyme"]); __InputTagHelper1.StringDictionaryProperty["thyme"] = __InputTagHelper2.StringDictionaryProperty["thyme"]; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs index 754755d444..815eaae2e4 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/PrefixedAttributeTagHelpers.cs @@ -51,23 +51,23 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper1 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper1); + __InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper2); + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("checkbox")); #line 16 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty = intDictionary; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __InputTagHelper1.IntDictionaryProperty); + __InputTagHelper2.IntDictionaryProperty = __InputTagHelper1.IntDictionaryProperty; #line 16 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.StringDictionaryProperty = stringDictionary; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("string-dictionary", __InputTagHelper1.StringDictionaryProperty); - __InputTagHelper2 = CreateTagHelper(); - __tagHelperExecutionContext.Add(__InputTagHelper2); - __InputTagHelper2.IntDictionaryProperty = __InputTagHelper1.IntDictionaryProperty; __InputTagHelper2.StringDictionaryProperty = __InputTagHelper1.StringDictionaryProperty; - __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("checkbox")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); @@ -79,38 +79,38 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper1 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper1); + if (__InputTagHelper1.IntDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-garlic", "InputTagHelper1", "IntDictionaryProperty")); + } + __InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper2); + if (__InputTagHelper2.IntDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-garlic", "InputTagHelper2", "IntDictionaryProperty")); + } + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("password")); #line 17 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty = intDictionary; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-dictionary", __InputTagHelper1.IntDictionaryProperty); - if (__InputTagHelper1.IntDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-garlic", "InputTagHelper1", "IntDictionaryProperty")); - } + __InputTagHelper2.IntDictionaryProperty = __InputTagHelper1.IntDictionaryProperty; #line 17 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty["garlic"] = 37; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-garlic", __InputTagHelper1.IntDictionaryProperty["garlic"]); + __InputTagHelper2.IntDictionaryProperty["garlic"] = __InputTagHelper1.IntDictionaryProperty["garlic"]; #line 17 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntProperty = 42; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __InputTagHelper1.IntProperty); - __InputTagHelper2 = CreateTagHelper(); - __tagHelperExecutionContext.Add(__InputTagHelper2); - __InputTagHelper2.IntDictionaryProperty = __InputTagHelper1.IntDictionaryProperty; - if (__InputTagHelper2.IntDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-garlic", "InputTagHelper2", "IntDictionaryProperty")); - } - __InputTagHelper2.IntDictionaryProperty["garlic"] = __InputTagHelper1.IntDictionaryProperty["garlic"]; __InputTagHelper2.IntDictionaryProperty["grabber"] = __InputTagHelper1.IntProperty; - __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("password")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); @@ -122,36 +122,52 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __InputTagHelper1 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper1); + if (__InputTagHelper1.IntDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-salt", "InputTagHelper1", "IntDictionaryProperty")); + } + if (__InputTagHelper1.StringDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-paprika", "InputTagHelper1", "StringDictionaryProperty")); + } + __InputTagHelper2 = CreateTagHelper(); + __tagHelperExecutionContext.Add(__InputTagHelper2); + if (__InputTagHelper2.IntDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-grabber", "InputTagHelper2", "IntDictionaryProperty")); + } + if (__InputTagHelper2.StringDictionaryProperty == null) + { + throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-grabber", "InputTagHelper2", "StringDictionaryProperty")); + } + __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("radio")); #line 19 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntProperty = 42; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-grabber", __InputTagHelper1.IntProperty); - if (__InputTagHelper1.IntDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-salt", "InputTagHelper1", "IntDictionaryProperty")); - } + __InputTagHelper2.IntDictionaryProperty["grabber"] = __InputTagHelper1.IntProperty; #line 19 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty["salt"] = 37; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-salt", __InputTagHelper1.IntDictionaryProperty["salt"]); + __InputTagHelper2.IntDictionaryProperty["salt"] = __InputTagHelper1.IntDictionaryProperty["salt"]; #line 19 "PrefixedAttributeTagHelpers.cshtml" __InputTagHelper1.IntDictionaryProperty["pepper"] = 98; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-pepper", __InputTagHelper1.IntDictionaryProperty["pepper"]); + __InputTagHelper2.IntDictionaryProperty["pepper"] = __InputTagHelper1.IntDictionaryProperty["pepper"]; __InputTagHelper1.StringProperty = "string"; __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-grabber", __InputTagHelper1.StringProperty); - if (__InputTagHelper1.StringDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-paprika", "InputTagHelper1", "StringDictionaryProperty")); - } + __InputTagHelper2.StringDictionaryProperty["grabber"] = __InputTagHelper1.StringProperty; __InputTagHelper1.StringDictionaryProperty["paprika"] = "another string"; __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-paprika", __InputTagHelper1.StringDictionaryProperty["paprika"]); + __InputTagHelper2.StringDictionaryProperty["paprika"] = __InputTagHelper1.StringDictionaryProperty["paprika"]; StartTagHelperWritingScope(); WriteLiteral("literate "); #line 21 "PrefixedAttributeTagHelpers.cshtml" @@ -163,23 +179,7 @@ WriteLiteral(literate); __tagHelperStringValueBuffer = EndTagHelperWritingScope(); __InputTagHelper1.StringDictionaryProperty["cumin"] = __tagHelperStringValueBuffer.ToString(); __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-cumin", __InputTagHelper1.StringDictionaryProperty["cumin"]); - __InputTagHelper2 = CreateTagHelper(); - __tagHelperExecutionContext.Add(__InputTagHelper2); - if (__InputTagHelper2.IntDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-grabber", "InputTagHelper2", "IntDictionaryProperty")); - } - __InputTagHelper2.IntDictionaryProperty["grabber"] = __InputTagHelper1.IntProperty; - __InputTagHelper2.IntDictionaryProperty["salt"] = __InputTagHelper1.IntDictionaryProperty["salt"]; - __InputTagHelper2.IntDictionaryProperty["pepper"] = __InputTagHelper1.IntDictionaryProperty["pepper"]; - if (__InputTagHelper2.StringDictionaryProperty == null) - { - throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-grabber", "InputTagHelper2", "StringDictionaryProperty")); - } - __InputTagHelper2.StringDictionaryProperty["grabber"] = __InputTagHelper1.StringProperty; - __InputTagHelper2.StringDictionaryProperty["paprika"] = __InputTagHelper1.StringDictionaryProperty["paprika"]; __InputTagHelper2.StringDictionaryProperty["cumin"] = __InputTagHelper1.StringDictionaryProperty["cumin"]; - __tagHelperExecutionContext.AddHtmlAttribute("type", Html.Raw("radio")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); @@ -195,29 +195,29 @@ WriteLiteral(literate); { throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-value", "InputTagHelper1", "IntDictionaryProperty")); } -#line 22 "PrefixedAttributeTagHelpers.cshtml" -__InputTagHelper1.IntDictionaryProperty["value"] = 37; - -#line default -#line hidden - __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-value", __InputTagHelper1.IntDictionaryProperty["value"]); if (__InputTagHelper1.StringDictionaryProperty == null) { throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-thyme", "InputTagHelper1", "StringDictionaryProperty")); } - __InputTagHelper1.StringDictionaryProperty["thyme"] = "string"; - __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-thyme", __InputTagHelper1.StringDictionaryProperty["thyme"]); __InputTagHelper2 = CreateTagHelper(); __tagHelperExecutionContext.Add(__InputTagHelper2); if (__InputTagHelper2.IntDictionaryProperty == null) { throw new InvalidOperationException(FormatInvalidIndexerAssignment("int-prefix-value", "InputTagHelper2", "IntDictionaryProperty")); } - __InputTagHelper2.IntDictionaryProperty["value"] = __InputTagHelper1.IntDictionaryProperty["value"]; if (__InputTagHelper2.StringDictionaryProperty == null) { throw new InvalidOperationException(FormatInvalidIndexerAssignment("string-prefix-thyme", "InputTagHelper2", "StringDictionaryProperty")); } +#line 22 "PrefixedAttributeTagHelpers.cshtml" +__InputTagHelper1.IntDictionaryProperty["value"] = 37; + +#line default +#line hidden + __tagHelperExecutionContext.AddTagHelperAttribute("int-prefix-value", __InputTagHelper1.IntDictionaryProperty["value"]); + __InputTagHelper2.IntDictionaryProperty["value"] = __InputTagHelper1.IntDictionaryProperty["value"]; + __InputTagHelper1.StringDictionaryProperty["thyme"] = "string"; + __tagHelperExecutionContext.AddTagHelperAttribute("string-prefix-thyme", __InputTagHelper1.StringDictionaryProperty["thyme"]); __InputTagHelper2.StringDictionaryProperty["thyme"] = __InputTagHelper1.StringDictionaryProperty["thyme"]; __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs index 94490c4238..0fe4619c00 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Output/SingleTagHelper.cs @@ -33,13 +33,13 @@ namespace TestOutput , StartTagHelperWritingScope, EndTagHelperWritingScope); __PTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__PTagHelper); + __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("Hello World")); #line 3 "SingleTagHelper.cshtml" __PTagHelper.Age = 1337; #line default #line hidden __tagHelperExecutionContext.AddTagHelperAttribute("age", __PTagHelper.Age); - __tagHelperExecutionContext.AddHtmlAttribute("class", Html.Raw("Hello World")); __tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); await WriteTagHelperAsync(__tagHelperExecutionContext); __tagHelperExecutionContext = __tagHelperScopeManager.End(); diff --git a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ComplexTagHelpers.cshtml b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ComplexTagHelpers.cshtml index 99ed598233..39659f0875 100644 --- a/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ComplexTagHelpers.cshtml +++ b/test/Microsoft.AspNet.Razor.Test/TestFiles/CodeGenerator/Source/ComplexTagHelpers.cshtml @@ -18,12 +18,12 @@ }

-

+

@{ var @object = false;}

- +