-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix minimized attributes when using 5.0 SDK with 3.x target #25307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mkArtakMSFT
merged 3 commits into
release/5.0
from
stevesa/fix-minimized-attributes-with-3x-target
Aug 28, 2020
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...t/IncludesMinimizedAttributeValueParameterBeforeLanguageVersion5/TestComponent.codegen.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // <auto-generated/> | ||
| #pragma warning disable 1591 | ||
| namespace Test | ||
| { | ||
| #line hidden | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.AspNetCore.Components; | ||
| public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBase | ||
| { | ||
| #pragma warning disable 219 | ||
| private void __RazorDirectiveTokenHelpers__() { | ||
| } | ||
| #pragma warning restore 219 | ||
| #pragma warning disable 0414 | ||
| private static System.Object __o = null; | ||
| #pragma warning restore 0414 | ||
| #pragma warning disable 1998 | ||
| protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) | ||
| { | ||
| __o = | ||
| #nullable restore | ||
| #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" | ||
| "val" | ||
|
|
||
| #line default | ||
| #line hidden | ||
| #nullable disable | ||
| ; | ||
| } | ||
| #pragma warning restore 1998 | ||
| } | ||
| } | ||
| #pragma warning restore 1591 |
22 changes: 22 additions & 0 deletions
22
...nTest/IncludesMinimizedAttributeValueParameterBeforeLanguageVersion5/TestComponent.ir.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| Document - | ||
| NamespaceDeclaration - - Test | ||
| UsingDirective - (3:1,1 [12] ) - System | ||
| UsingDirective - (18:2,1 [32] ) - System.Collections.Generic | ||
| UsingDirective - (53:3,1 [17] ) - System.Linq | ||
| UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks | ||
| UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components | ||
| ClassDeclaration - - public partial - TestComponent - Microsoft.AspNetCore.Components.ComponentBase - | ||
| DesignTimeDirective - | ||
| CSharpCode - | ||
| IntermediateToken - - CSharp - #pragma warning disable 0414 | ||
| CSharpCode - | ||
| IntermediateToken - - CSharp - private static System.Object __o = null; | ||
| CSharpCode - | ||
| IntermediateToken - - CSharp - #pragma warning restore 0414 | ||
| MethodDeclaration - - protected override - void - BuildRenderTree | ||
| MarkupElement - (0:0,0 [73] x:\dir\subdir\Test\TestComponent.cshtml) - elem | ||
| HtmlAttribute - (5:0,5 [23] x:\dir\subdir\Test\TestComponent.cshtml) - normal-attr=" - " | ||
| CSharpExpressionAttributeValue - (19:0,19 [8] x:\dir\subdir\Test\TestComponent.cshtml) - | ||
| LazyIntermediateToken - (21:0,21 [5] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "val" | ||
| HtmlAttribute - (28:0,28 [15] x:\dir\subdir\Test\TestComponent.cshtml) - minimized-attr - | ||
| HtmlAttribute - (43:0,43 [22] x:\dir\subdir\Test\TestComponent.cshtml) - empty-string-atttr=" - " |
5 changes: 5 additions & 0 deletions
5
...IncludesMinimizedAttributeValueParameterBeforeLanguageVersion5/TestComponent.mappings.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Source Location: (21:0,21 [5] x:\dir\subdir\Test\TestComponent.cshtml) | ||
| |"val"| | ||
| Generated Location: (893:25,21 [5] ) | ||
| |"val"| | ||
|
|
36 changes: 36 additions & 0 deletions
36
...signTimeCodeGenerationTest/OmitsMinimizedAttributeValueParameter/TestComponent.codegen.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // <auto-generated/> | ||
| #pragma warning disable 1591 | ||
| namespace Test | ||
| { | ||
| #line hidden | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.AspNetCore.Components; | ||
| public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBase | ||
| { | ||
| #pragma warning disable 219 | ||
| private void __RazorDirectiveTokenHelpers__() { | ||
| } | ||
| #pragma warning restore 219 | ||
| #pragma warning disable 0414 | ||
| private static System.Object __o = null; | ||
| #pragma warning restore 0414 | ||
| #pragma warning disable 1998 | ||
| protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) | ||
| { | ||
| __o = | ||
| #nullable restore | ||
| #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" | ||
| "val" | ||
|
|
||
| #line default | ||
| #line hidden | ||
| #nullable disable | ||
| ; | ||
| } | ||
| #pragma warning restore 1998 | ||
| } | ||
| } | ||
| #pragma warning restore 1591 |
22 changes: 22 additions & 0 deletions
22
...ntDesignTimeCodeGenerationTest/OmitsMinimizedAttributeValueParameter/TestComponent.ir.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| Document - | ||
| NamespaceDeclaration - - Test | ||
| UsingDirective - (3:1,1 [12] ) - System | ||
| UsingDirective - (18:2,1 [32] ) - System.Collections.Generic | ||
| UsingDirective - (53:3,1 [17] ) - System.Linq | ||
| UsingDirective - (73:4,1 [28] ) - System.Threading.Tasks | ||
| UsingDirective - (104:5,1 [37] ) - Microsoft.AspNetCore.Components | ||
| ClassDeclaration - - public partial - TestComponent - Microsoft.AspNetCore.Components.ComponentBase - | ||
| DesignTimeDirective - | ||
| CSharpCode - | ||
| IntermediateToken - - CSharp - #pragma warning disable 0414 | ||
| CSharpCode - | ||
| IntermediateToken - - CSharp - private static System.Object __o = null; | ||
| CSharpCode - | ||
| IntermediateToken - - CSharp - #pragma warning restore 0414 | ||
| MethodDeclaration - - protected override - void - BuildRenderTree | ||
| MarkupElement - (0:0,0 [73] x:\dir\subdir\Test\TestComponent.cshtml) - elem | ||
| HtmlAttribute - (5:0,5 [23] x:\dir\subdir\Test\TestComponent.cshtml) - normal-attr=" - " | ||
| CSharpExpressionAttributeValue - (19:0,19 [8] x:\dir\subdir\Test\TestComponent.cshtml) - | ||
| LazyIntermediateToken - (21:0,21 [5] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "val" | ||
| HtmlAttribute - (28:0,28 [15] x:\dir\subdir\Test\TestComponent.cshtml) - minimized-attr - | ||
| HtmlAttribute - (43:0,43 [22] x:\dir\subdir\Test\TestComponent.cshtml) - empty-string-atttr=" - " |
5 changes: 5 additions & 0 deletions
5
...gnTimeCodeGenerationTest/OmitsMinimizedAttributeValueParameter/TestComponent.mappings.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Source Location: (21:0,21 [5] x:\dir\subdir\Test\TestComponent.cshtml) | ||
| |"val"| | ||
| Generated Location: (893:25,21 [5] ) | ||
| |"val"| | ||
|
|
33 changes: 33 additions & 0 deletions
33
...t/IncludesMinimizedAttributeValueParameterBeforeLanguageVersion5/TestComponent.codegen.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // <auto-generated/> | ||
| #pragma warning disable 1591 | ||
| namespace Test | ||
| { | ||
| #line hidden | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Linq; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.AspNetCore.Components; | ||
| public partial class TestComponent : Microsoft.AspNetCore.Components.ComponentBase | ||
| { | ||
| #pragma warning disable 1998 | ||
| protected override void BuildRenderTree(Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) | ||
| { | ||
| __builder.OpenElement(0, "elem"); | ||
| __builder.AddAttribute(1, "normal-attr", | ||
| #nullable restore | ||
| #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" | ||
| "val" | ||
|
|
||
| #line default | ||
| #line hidden | ||
| #nullable disable | ||
| ); | ||
| __builder.AddAttribute(2, "minimized-attr", true); | ||
| __builder.AddAttribute(3, "empty-string-atttr", true); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The above two lines show the compiler output for 3.x language version. |
||
| __builder.CloseElement(); | ||
| } | ||
| #pragma warning restore 1998 | ||
| } | ||
| } | ||
| #pragma warning restore 1591 | ||
15 changes: 15 additions & 0 deletions
15
...nTest/IncludesMinimizedAttributeValueParameterBeforeLanguageVersion5/TestComponent.ir.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| Document - | ||
| NamespaceDeclaration - - Test | ||
| UsingDirective - (3:1,1 [14] ) - System | ||
| UsingDirective - (18:2,1 [34] ) - System.Collections.Generic | ||
| UsingDirective - (53:3,1 [19] ) - System.Linq | ||
| UsingDirective - (73:4,1 [30] ) - System.Threading.Tasks | ||
| UsingDirective - (104:5,1 [39] ) - Microsoft.AspNetCore.Components | ||
| ClassDeclaration - - public partial - TestComponent - Microsoft.AspNetCore.Components.ComponentBase - | ||
| MethodDeclaration - - protected override - void - BuildRenderTree | ||
| MarkupElement - (0:0,0 [73] x:\dir\subdir\Test\TestComponent.cshtml) - elem | ||
| HtmlAttribute - (5:0,5 [23] x:\dir\subdir\Test\TestComponent.cshtml) - normal-attr=" - " | ||
| CSharpExpressionAttributeValue - (19:0,19 [8] x:\dir\subdir\Test\TestComponent.cshtml) - | ||
| LazyIntermediateToken - (21:0,21 [5] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - "val" | ||
| HtmlAttribute - (28:0,28 [15] x:\dir\subdir\Test\TestComponent.cshtml) - minimized-attr - | ||
| HtmlAttribute - (43:0,43 [22] x:\dir\subdir\Test\TestComponent.cshtml) - empty-string-atttr=" - " |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've defined this new option, instead of using the
RazorLanguageVersiondirectly inside the code writer, because:RazorLanguageVersion(perhaps because of the philosophy mentioned above), and threading it through many layers would be quite disruptive, including to some public APIsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't have to address in this PR but might want to add a new
CodeGenerationFeatureFlagsproperty to contain these similar to this. That makes it cleaner if we introduce more code generation features in the future.