From 10bdab9fd68d233826f9c081da6b73d16b115da8 Mon Sep 17 00:00:00 2001 From: Javier Calvarro Nelson Date: Tue, 11 Oct 2022 22:32:12 +0200 Subject: [PATCH] [Blazor] Bind after changes (#363) Due to the way we decided to implement bind get,set,after, customers can run into situations where their components render many more times than expected, which results in confusion and performance degradation. This was due to the fact that we chose to rely on EventCallback to implement this feature and we did not realize there were some side effects associated with it. The APIs we are adding bypass the whole EventCallback infrastructure (simplifying the implementation too) and fix the issue. This change updates the compiler to rely on the new runtime APIs (cherry picked from commit 9ce52f1afbfb819fc8499a590385200b97b13f33) --- .../Components/ComponentBindLoweringPass.cs | 22 +- .../src/Components/ComponentsApi.cs | 1 + .../ComponentCodeGenerationTestBase.cs | 398 ++++++++++++++++-- .../TestComponent.codegen.cs | 3 +- .../TestComponent.ir.txt | 6 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 1 - .../TestComponent.ir.txt | 4 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 67 +++ .../TestComponent.ir.txt | 31 ++ .../TestComponent.mappings.txt | 23 + .../TestComponent.codegen.cs | 1 - .../TestComponent.ir.txt | 4 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 67 +++ .../TestComponent.ir.txt | 31 ++ .../TestComponent.mappings.txt | 23 + .../TestComponent.codegen.cs | 69 +++ .../TestComponent.ir.txt | 32 ++ .../TestComponent.mappings.txt | 18 + .../TestComponent.codegen.cs | 1 - .../TestComponent.ir.txt | 4 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 69 +++ .../TestComponent.ir.txt | 32 ++ .../TestComponent.mappings.txt | 18 + .../TestComponent.codegen.cs | 77 ++++ .../TestComponent.ir.txt | 32 ++ .../TestComponent.mappings.txt | 28 ++ .../TestComponent.codegen.cs | 1 - .../TestComponent.ir.txt | 4 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 77 ++++ .../TestComponent.ir.txt | 32 ++ .../TestComponent.mappings.txt | 28 ++ .../TestComponent.codegen.cs | 79 ++++ .../TestComponent.ir.txt | 33 ++ .../TestComponent.mappings.txt | 23 + .../TestComponent.codegen.cs | 1 - .../TestComponent.ir.txt | 4 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 79 ++++ .../TestComponent.ir.txt | 33 ++ .../TestComponent.mappings.txt | 23 + .../TestComponent.codegen.cs | 3 +- .../TestComponent.ir.txt | 6 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 1 - .../TestComponent.ir.txt | 4 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.ir.txt | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 42 ++ .../TestComponent.ir.txt | 22 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 1 - .../TestComponent.ir.txt | 4 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 42 ++ .../TestComponent.ir.txt | 22 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 53 +++ .../TestComponent.ir.txt | 23 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 1 - .../TestComponent.ir.txt | 4 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 53 +++ .../TestComponent.ir.txt | 23 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 42 ++ .../TestComponent.ir.txt | 22 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 1 - .../TestComponent.ir.txt | 4 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 42 ++ .../TestComponent.ir.txt | 22 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 53 +++ .../TestComponent.ir.txt | 23 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 1 - .../TestComponent.ir.txt | 4 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 53 +++ .../TestComponent.ir.txt | 23 + .../TestComponent.mappings.txt | 13 + ...ft.AspNetCore.Components.netstandard2.0.cs | 48 ++- .../TestComponent.codegen.cs | 67 +++ .../TestComponent.ir.txt | 31 ++ .../TestComponent.mappings.txt | 23 + .../TestComponent.codegen.cs | 67 +++ .../TestComponent.ir.txt | 31 ++ .../TestComponent.mappings.txt | 23 + .../TestComponent.codegen.cs | 68 +++ .../TestComponent.ir.txt | 32 ++ .../TestComponent.mappings.txt | 18 + .../TestComponent.codegen.cs | 68 +++ .../TestComponent.ir.txt | 32 ++ .../TestComponent.mappings.txt | 18 + .../TestComponent.codegen.cs | 77 ++++ .../TestComponent.ir.txt | 32 ++ .../TestComponent.mappings.txt | 28 ++ .../TestComponent.codegen.cs | 77 ++++ .../TestComponent.ir.txt | 32 ++ .../TestComponent.mappings.txt | 28 ++ .../TestComponent.codegen.cs | 78 ++++ .../TestComponent.ir.txt | 33 ++ .../TestComponent.mappings.txt | 23 + .../TestComponent.codegen.cs | 78 ++++ .../TestComponent.ir.txt | 33 ++ .../TestComponent.mappings.txt | 23 + .../TestComponent.codegen.cs | 42 ++ .../TestComponent.ir.txt | 22 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 42 ++ .../TestComponent.ir.txt | 22 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 53 +++ .../TestComponent.ir.txt | 23 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 53 +++ .../TestComponent.ir.txt | 23 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 42 ++ .../TestComponent.ir.txt | 22 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 42 ++ .../TestComponent.ir.txt | 22 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 53 +++ .../TestComponent.ir.txt | 23 + .../TestComponent.mappings.txt | 13 + .../TestComponent.codegen.cs | 53 +++ .../TestComponent.ir.txt | 23 + .../TestComponent.mappings.txt | 13 + 178 files changed, 3855 insertions(+), 210 deletions(-) create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt create mode 100644 src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentBindLoweringPass.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentBindLoweringPass.cs index 3084c5cb109..0561fe96ea6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentBindLoweringPass.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentBindLoweringPass.cs @@ -855,21 +855,21 @@ private void RewriteNodesForComponentEventCallbackBind( else if (setter == null && after != null) { // bind:after only - var afterToEventCallback = $"global::{ComponentsApi.EventCallback.FactoryAccessor}.{ComponentsApi.EventCallbackFactory.CreateMethod}(this, callback: {after.Content})"; + var afterContentInvocation = $"{ComponentsApi.RuntimeHelpers.InvokeAsynchronousDelegate}(callback: {after.Content})"; changeExpressionTokens.Add(new IntermediateToken() { - Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: __value => {{ {original.Content} = __value; return {afterToEventCallback}.InvokeAsync(); }}, value: {original.Content})", + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredBindSetter}(callback: __value => {{ {original.Content} = __value; return {afterContentInvocation}; }}, value: {original.Content})", Kind = TokenKind.CSharp }); } else { // bind:set and bind:after create the code even though we disallow this combination through a diagnostic - var setToEventCallback = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: {setter.Content}, value: {original.Content})"; - var afterToEventCallback = $"global::{ComponentsApi.EventCallback.FactoryAccessor}.{ComponentsApi.EventCallbackFactory.CreateMethod}(this, callback: {after.Content})"; + var setToEventCallback = $"{ComponentsApi.RuntimeHelpers.CreateInferredBindSetter}(callback: {setter.Content}, value: {original.Content})"; + var afterContentInvocation = $"{ComponentsApi.RuntimeHelpers.InvokeAsynchronousDelegate}(callback: {after.Content})"; changeExpressionTokens.Add(new IntermediateToken() { - Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: async __value => {{ await {setToEventCallback}.InvokeAsync(); await {afterToEventCallback}.InvokeAsync(); }}, value: {original.Content})", + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: async __value => {{ await {setToEventCallback}; await {afterContentInvocation}; }}, value: {original.Content})", Kind = TokenKind.CSharp }); } @@ -966,28 +966,28 @@ private void RewriteNodesForElementEventCallbackBind( // bind:set only changeExpressionTokens.Add(new IntermediateToken() { - Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: {setter.Content}, value: {original.Content})", + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredBindSetter}(callback: {setter.Content}, value: {original.Content})", Kind = TokenKind.CSharp }); } else if (setter == null && after != null) { // bind:after only - var afterToEventCallback = $"global::{ComponentsApi.EventCallback.FactoryAccessor}.{ComponentsApi.EventCallbackFactory.CreateMethod}(this, callback: {after.Content})"; + var afterContentInvocation = $"{ComponentsApi.RuntimeHelpers.InvokeAsynchronousDelegate}(callback: {after.Content})"; changeExpressionTokens.Add(new IntermediateToken() { - Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: __value => {{ {original.Content} = __value; return {afterToEventCallback}.InvokeAsync(); }}, value: {original.Content})", + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredBindSetter}(callback: __value => {{ {original.Content} = __value; return {afterContentInvocation}; }}, value: {original.Content})", Kind = TokenKind.CSharp }); } else { // bind:set and bind:after create the code even though we disallow this combination through a diagnostic - var setToEventCallback = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: {setter.Content}, value: {original.Content})"; - var afterToEventCallback = $"global::{ComponentsApi.EventCallback.FactoryAccessor}.{ComponentsApi.EventCallbackFactory.CreateMethod}(this, callback: {after.Content})"; + var setterContentInvocation = $"{ComponentsApi.RuntimeHelpers.CreateInferredBindSetter}(callback: {setter.Content}, value: {original.Content})"; + var afterContentInvocation = $"{ComponentsApi.RuntimeHelpers.InvokeAsynchronousDelegate}(callback: {after.Content})"; changeExpressionTokens.Add(new IntermediateToken() { - Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: async __value => {{ await {setToEventCallback}.InvokeAsync(); await {afterToEventCallback}.InvokeAsync(); }}, value: {original.Content})", + Content = $"{ComponentsApi.RuntimeHelpers.CreateInferredEventCallback}(this, callback: async __value => {{ await {setterContentInvocation}(); await {afterContentInvocation}; }}, value: {original.Content})", Kind = TokenKind.CSharp }); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentsApi.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentsApi.cs index ba139148bba..a7ce3fa5a8b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentsApi.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/src/Components/ComponentsApi.cs @@ -109,6 +109,7 @@ public static class RuntimeHelpers { public const string TypeCheck = "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck"; public const string CreateInferredEventCallback = "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback"; + public const string CreateInferredBindSetter = "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter"; public const string InvokeSynchronousDelegate = "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate"; public const string InvokeAsynchronousDelegate = "global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate"; } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs index 027e33bd78e..8f2f711714f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs @@ -1983,14 +1983,12 @@ public void BindToComponent_WithGetSet_EventCallback() AdditionalSyntaxTrees.Add(Parse(@" using System; using Microsoft.AspNetCore.Components; - namespace Test { public class MyComponent : ComponentBase { [Parameter] public int Value { get; set; } - [Parameter] public EventCallback ValueChanged { get; set; } } @@ -2001,14 +1999,17 @@ public class MyComponent : ComponentBase @code { public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } }"); // Assert AssertDocumentNodeMatchesBaseline(generated.CodeDocument); AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); - CompileToAssembly(generated); + var result = CompileToAssembly(generated, throwOnFailure: false); + + var error = Assert.Single(result.Diagnostics); + // Argument 1: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' to '...' (System.Action/System.Func) + Assert.Equal("CS1503", error.Id); } [Fact] @@ -2018,6 +2019,159 @@ public void BindToGenericComponent_InferredType_WithGetSet_EventCallback() AdditionalSyntaxTrees.Add(Parse(@" using System; using Microsoft.AspNetCore.Components; +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + [Parameter] + public EventCallback ValueChanged { get; set; } + } + public class CustomValue + { + } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public CustomValue ParentValue { get; set; } = new CustomValue(); + public EventCallback UpdateValue { get; set; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + var result = CompileToAssembly(generated, throwOnFailure: false); + + var error = Assert.Single(result.Diagnostics); + // Argument 1: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' to '...' (System.Action/System.Func) + Assert.Equal("CS1503", error.Id); + } + + [Fact] + public void BindToGenericComponent_ExplicitType_WithGetSet_EventCallback() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + [Parameter] + public EventCallback ValueChanged { get; set; } + } + public class CustomValue + { + } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public CustomValue ParentValue { get; set; } = new CustomValue(); + public EventCallback UpdateValue { get; set; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + var result = CompileToAssembly(generated, throwOnFailure: false); + + var error = Assert.Single(result.Diagnostics); + // Argument 1: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' to '...' (System.Action/System.Func) + Assert.Equal("CS1503", error.Id); + + } + + [Fact] + public void GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" +@typeparam TParam + +@code { + public TParam ParentValue { get; set; } = default; + public EventCallback UpdateValue { get; set; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + var result = CompileToAssembly(generated, throwOnFailure: false); + + var error = Assert.Single(result.Diagnostics); + // Argument 1: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' to '...' (System.Action/System.Func) + Assert.Equal("CS1503", error.Id); + } + + [Fact] + public void GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" +@typeparam TParam + +@code { + public TParam ParentValue { get; set; } = default; + public EventCallback UpdateValue { get; set; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + var result = CompileToAssembly(generated, throwOnFailure: false); + + var error = Assert.Single(result.Diagnostics); + // Argument 1: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' to '...' (System.Action/System.Func) + Assert.Equal("CS1503", error.Id); + } + + [Fact] + public void BindToGenericComponent_InferredType_WithGetSet_Action() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; namespace Test { @@ -2041,7 +2195,7 @@ public class CustomValue @code { public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } + public void UpdateValue(CustomValue value) => ParentValue = value; }"); // Assert @@ -2051,7 +2205,47 @@ public class CustomValue } [Fact] - public void BindToGenericComponent_ExplicitType_WithGetSet_EventCallback() + public void BindToGenericComponent_InferredType_WithGetSet_Function() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } + + public class CustomValue + { + } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + + [Fact] + public void BindToGenericComponent_ExplicitType_WithGetSet_Action() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" @@ -2080,7 +2274,7 @@ public class CustomValue @code { public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } + public void UpdateValue(CustomValue value) => ParentValue = value; }"); // Assert @@ -2090,7 +2284,46 @@ public class CustomValue } [Fact] - public void GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback() + public void BindToGenericComponent_ExplicitType_WithGetSet_Function() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } + + public class CustomValue + { + } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" @@ -2116,7 +2349,7 @@ @typeparam TParam @code { public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } + public void UpdateValue(TParam value) { ParentValue = value; } }"); // Assert @@ -2126,7 +2359,43 @@ @typeparam TParam } [Fact] - public void GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback() + public void GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" +@typeparam TParam + +@code { + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void GenericBindToGenericComponent_ExplicitType_WithGetSet_Action() { // Arrange AdditionalSyntaxTrees.Add(Parse(@" @@ -2152,7 +2421,43 @@ @typeparam TParam @code { public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } + public void UpdateValue(TParam value) { ParentValue = value; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + + [Fact] + public void GenericBindToGenericComponent_ExplicitType_WithGetSet_Function() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public TValue Value { get; set; } + + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" +@typeparam TParam + +@code { + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } }"); // Assert @@ -2229,6 +2534,42 @@ public class MyComponent : ComponentBase CompileToAssembly(generated); } + [Fact] + public void BindToComponent_WithAfter_EventCallback() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; +namespace Test +{ + public class MyComponent : ComponentBase + { + [Parameter] + public int Value { get; set; } + [Parameter] + public EventCallback ValueChanged { get; set; } + } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; + public EventCallback UpdateValue { get; set; } +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + var result = CompileToAssembly(generated, throwOnFailure: false); + + var error = Assert.Single(result.Diagnostics); + // Argument 1: cannot convert from 'Microsoft.AspNetCore.Components.EventCallback' to '...' (System.Action/System.Func) + Assert.Equal("CS1503", error.Id); + } + [Fact] public void BindToComponent_WithAfter_TaskReturningDelegate() { @@ -2509,41 +2850,6 @@ public class MyComponent : ComponentBase CompileToAssembly(generated); } - [Fact] - public void BindToComponent_WithAfter_EventCallback() - { - // Arrange - AdditionalSyntaxTrees.Add(Parse(@" -using System; -using Microsoft.AspNetCore.Components; - -namespace Test -{ - public class MyComponent : ComponentBase - { - [Parameter] - public int Value { get; set; } - - [Parameter] - public EventCallback ValueChanged { get; set; } - } -}")); - - // Act - var generated = CompileToCSharp(@" - -@code { - public int ParentValue { get; set; } = 42; - - public EventCallback UpdateValue { get; set; } -}"); - - // Assert - AssertDocumentNodeMatchesBaseline(generated.CodeDocument); - AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); - CompileToAssembly(generated); - } - [Fact] public void BindToComponent_WithAfter_EventCallback_ReceivesAction() { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs index 53932078bce..747a4bd2f2e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs @@ -30,7 +30,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #nullable disable ); __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue), ParentValue))); + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: UpdateValue); }, value: ParentValue), ParentValue))); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } )); @@ -47,7 +47,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt index f424f87ce35..dbdca3c8b6f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt @@ -21,9 +21,9 @@ Document - ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: UpdateValue); }, value: ParentValue) IntermediateToken - - CSharp - , ParentValue) HtmlContent - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n - CSharpCode - (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (86:1,7 [102] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (86:1,7 [102] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt index 260a23e98ee..025551a87f1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt @@ -3,16 +3,14 @@ Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) Generated Location: (1022:25,30 [11] ) |ParentValue| -Source Location: (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (86:1,7 [102] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } | -Generated Location: (2258:47,7 [104] ) +Generated Location: (2259:47,7 [102] ) | public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs index 97cb480e8c6..653800e07e5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs @@ -30,7 +30,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #nullable disable ); __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: () => { }).InvokeAsync(); }, value: ParentValue), ParentValue))); + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: () => { }); }, value: ParentValue), ParentValue))); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } )); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt index c071da3aed0..edbc06dd16e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt @@ -21,7 +21,7 @@ Document - ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: () => { }).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: () => { }); }, value: ParentValue) IntermediateToken - - CSharp - , ParentValue) HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt index 56e31e22803..51440d870b1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt @@ -7,7 +7,7 @@ Source Location: (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2256:47,7 [50] ) +Generated Location: (2257:47,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs index fd6cec9e933..fb8780085e1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs @@ -30,7 +30,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #nullable disable ); __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue), ParentValue))); + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: UpdateValue); }, value: ParentValue), ParentValue))); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } )); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt index a2a7f400cc4..69aea933485 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt @@ -21,7 +21,7 @@ Document - ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: UpdateValue); }, value: ParentValue) IntermediateToken - - CSharp - , ParentValue) HtmlContent - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (77:0,77 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt index a9594edf57b..7c1924cbe75 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt @@ -9,7 +9,7 @@ Source Location: (86:1,7 [106] x:\dir\subdir\Test\TestComponent.cshtml) public Task UpdateValue() => Task.CompletedTask; | -Generated Location: (2258:47,7 [106] ) +Generated Location: (2259:47,7 [106] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs index cd399bc9262..043d28698bd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -47,7 +47,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt index 3a9543d1d4f..b27dee4a123 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt @@ -25,5 +25,5 @@ Document - IntermediateToken - - CSharp - , ParentValue) HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n - CSharpCode - (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (84:1,7 [107] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [107] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt index 20a9e8fce4b..d35df074d3b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -3,16 +3,14 @@ Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) Generated Location: (1022:25,30 [11] ) |ParentValue| -Source Location: (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (84:1,7 [107] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } | -Generated Location: (1975:47,7 [109] ) +Generated Location: (1975:47,7 [107] ) | public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs index c3e96e6ea81..aba53bf799a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs @@ -29,7 +29,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue), ParentValue); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue), ParentValue); } #pragma warning restore 1998 #nullable restore diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt index dc9345adc2e..66dcd9f6bad 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt @@ -23,7 +23,7 @@ Document - HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue) IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt index 2f591a81c8f..2156d6f0136 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt @@ -9,7 +9,7 @@ Source Location: (73:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) public void UpdateValue(string value) => ParentValue = value; | -Generated Location: (1442:36,7 [124] ) +Generated Location: (1433:36,7 [124] ) | public string ParentValue { get; set; } = "hi"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs index ae0050a47bb..5abaf46dd46 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs @@ -36,7 +36,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue), ParentValue); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue), ParentValue); } #pragma warning restore 1998 #nullable restore diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt index 31c170b4c4c..176937a01cc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt @@ -26,7 +26,7 @@ Document - HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue) IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt index 93de31d6358..a456deb815c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt @@ -14,7 +14,7 @@ Source Location: (86:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) public void UpdateValue(string value) => ParentValue = value; | -Generated Location: (1608:43,7 [124] ) +Generated Location: (1599:43,7 [124] ) | public string ParentValue { get; set; } = "hi"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs index d72073724e0..48b766ca5be 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs @@ -29,7 +29,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue).InvokeAsync(); await global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: AfterUpdate).InvokeAsync(); }, value: ParentValue), ParentValue); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue)(); await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: AfterUpdate); }, value: ParentValue), ParentValue); } #pragma warning restore 1998 #nullable restore diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt index 07024aaa77c..5fc74c37c0b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt @@ -23,7 +23,7 @@ Document - HtmlAttribute - (16:0,16 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue).InvokeAsync(); await global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: AfterUpdate).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue)(); await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: AfterUpdate); }, value: ParentValue) IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt index 617b1b7c326..a59e90c18b1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt @@ -10,7 +10,7 @@ Source Location: (91:1,7 [159] x:\dir\subdir\Test\TestComponent.cshtml) public void UpdateValue(string value) => ParentValue = value; public void AfterUpdate() { } | -Generated Location: (1738:36,7 [159] ) +Generated Location: (1727:36,7 [159] ) | public string ParentValue { get; set; } = "hi"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs index d3daef8598e..c8d1ee97c74 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs @@ -29,7 +29,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: DoSomething).InvokeAsync(); }, value: ParentValue), ParentValue); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: DoSomething); }, value: ParentValue), ParentValue); } #pragma warning restore 1998 #nullable restore diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt index 1078a7b864a..63e287e3c8a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt @@ -25,7 +25,7 @@ Document - HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: DoSomething).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: DoSomething); }, value: ParentValue) IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt index 6d6041ab787..db022270e0e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (85:2,7 [131] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (1590:36,7 [131] ) +Generated Location: (1591:36,7 [131] ) | public string ParentValue { get; set; } = "hi"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs index abdf3d431a4..174d56d2bd9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs @@ -29,7 +29,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: ValueChanged, value: ParentValue), ParentValue); + __o = global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: ValueChanged, value: ParentValue), ParentValue); } #pragma warning restore 1998 #nullable restore diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt index cb53a16d953..0bbd54ff5a5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt @@ -25,7 +25,7 @@ Document - HtmlAttribute - (24:0,24 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: ValueChanged, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: ValueChanged, value: ParentValue) IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt index dcb360bcd99..7f3450b8ac3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (88:2,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (1449:36,7 [144] ) +Generated Location: (1440:36,7 [144] ) | public string ParentValue { get; set; } = "hi"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..f9b098915ff --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,67 @@ +// +#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 : global::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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CustomValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..0635e504516 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,31 @@ +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 - global::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 + Component - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CustomValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public void UpdateValue(CustomValue value) => ParentValue = value;\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..d848d206ef5 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|CustomValue| +Generated Location: (916:25,21 [11] ) +|CustomValue| + +Source Location: (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1231:34,51 [11] ) +|ParentValue| + +Source Location: (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| +Generated Location: (2168:56,7 [147] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs index b3a8292870d..86481204bed 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -56,7 +56,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt index 9b4a2f850ca..f6a0dc7d5b4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -27,5 +27,5 @@ Document - IntermediateToken - - CSharp - , ParentValue) HtmlContent - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n - CSharpCode - (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (105:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt index 394b5e1eb7a..071b9b3dc4a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -8,16 +8,14 @@ Source Location: (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) Generated Location: (1231:34,51 [11] ) |ParentValue| -Source Location: (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (105:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) | public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } | -Generated Location: (2168:56,7 [140] ) +Generated Location: (2168:56,7 [138] ) | public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..d001e496392 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,67 @@ +// +#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 : global::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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CustomValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..3995d88d7ff --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,31 @@ +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 - global::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 + Component - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CustomValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..33a60f71078 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|CustomValue| +Generated Location: (916:25,21 [11] ) +|CustomValue| + +Source Location: (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1231:34,51 [11] ) +|ParentValue| + +Source Location: (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (2168:56,7 [179] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..775cd471005 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,69 @@ +// +#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 : global::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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + var __typeInference_CreateMyComponent_0 = global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static global::Test.MyComponent CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + return default; + } + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..60132f11a1b --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,32 @@ +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 - global::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 + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public void UpdateValue(CustomValue value) => ParentValue = value;\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..ff6b6ee87bf --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1043:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| +Generated Location: (1638:43,7 [147] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs index 85c63746c6a..b36b85562ef 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -43,7 +43,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt index f4b4071e7b6..2dc87f9f1b5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -25,8 +25,8 @@ Document - IntermediateToken - - CSharp - , ParentValue) HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n - CSharpCode - (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (84:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n public EventCallback UpdateValue { get; set; }\n NamespaceDeclaration - - __Blazor.Test.TestComponent ClassDeclaration - - internal static - TypeInference - - ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt index b231c31607b..fdc4dbc2f57 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -3,16 +3,14 @@ Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) Generated Location: (1043:25,30 [11] ) |ParentValue| -Source Location: (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (84:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) | public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } | -Generated Location: (1638:43,7 [140] ) +Generated Location: (1638:43,7 [138] ) | public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..bade5952ac4 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,69 @@ +// +#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 : global::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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + var __typeInference_CreateMyComponent_0 = global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static global::Test.MyComponent CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + return default; + } + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..11aa93e2a3e --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,32 @@ +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 - global::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 + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..f5e8eb93b10 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1043:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1638:43,7 [175] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..39041821dc3 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,77 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + TParam + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..5a5f2ec15b4 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,32 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + 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 + Component - (19:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public void UpdateValue(TParam value) { ParentValue = value; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..a22c4c56c86 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,28 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (1143:35,21 [6] ) +|TParam| + +Source Location: (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1443:44,46 [11] ) +|ParentValue| + +Source Location: (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| +Generated Location: (2370:66,7 [128] ) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs index b21bfc9e986..917cbcf871b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -66,7 +66,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 3 "x:\dir\subdir\Test\TestComponent.cshtml" public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt index 90a5ddb3a4b..223bedbd24a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -28,5 +28,5 @@ Document - IntermediateToken - - CSharp - , ParentValue) HtmlContent - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n - CSharpCode - (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (119:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt index 1a08445a55c..72ba88bf76e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -13,16 +13,14 @@ Source Location: (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) Generated Location: (1443:44,46 [11] ) |ParentValue| -Source Location: (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (119:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) | public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } | -Generated Location: (2370:66,7 [120] ) +Generated Location: (2370:66,7 [118] ) | public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..19481343b50 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,77 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + TParam + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..379f1b2a9e6 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,32 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + 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 + Component - (19:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..5d5e5cf8363 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,28 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (1143:35,21 [6] ) +|TParam| + +Source Location: (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1443:44,46 [11] ) +|ParentValue| + +Source Location: (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (2370:66,7 [155] ) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..b7952802929 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,79 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + var __typeInference_CreateMyComponent_0 = global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static global::Test.MyComponent CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + return default; + } + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..d3d1f685678 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,33 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + 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 + Component - (19:1,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public void UpdateValue(TParam value) { ParentValue = value; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..3da0739c2ed --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1270:35,30 [11] ) +|ParentValue| + +Source Location: (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| +Generated Location: (1865:53,7 [128] ) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs index 1010bcf24ce..5790ba15be9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -53,7 +53,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 3 "x:\dir\subdir\Test\TestComponent.cshtml" public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt index 2a9526e963c..ad1ef39ac9a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -26,8 +26,8 @@ Document - IntermediateToken - - CSharp - , ParentValue) HtmlContent - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n - CSharpCode - (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (103:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n public EventCallback UpdateValue { get; set; }\n NamespaceDeclaration - - __Blazor.Test.TestComponent ClassDeclaration - - internal static - TypeInference - - ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt index de7ed538f51..319cd7cd865 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -8,16 +8,14 @@ Source Location: (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) Generated Location: (1270:35,30 [11] ) |ParentValue| -Source Location: (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (103:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) | public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } | -Generated Location: (1865:53,7 [120] ) +Generated Location: (1865:53,7 [118] ) | public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..7e337accfdc --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,79 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + var __typeInference_CreateMyComponent_0 = global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static global::Test.MyComponent CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + return default; + } + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..4fa31b4fdfe --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,33 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + 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 + Component - (19:1,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..0588c21b8be --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1270:35,30 [11] ) +|ParentValue| + +Source Location: (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1865:53,7 [155] ) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs index 177efc27b24..efadf8caa48 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.codegen.cs @@ -23,7 +23,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue), ParentValue)))); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: UpdateValue); }, value: ParentValue), ParentValue)))); __builder.CloseComponent(); } #pragma warning restore 1998 @@ -31,7 +31,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt index d08ff845801..5fbfdd60fcf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.ir.txt @@ -14,7 +14,7 @@ Document - ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: UpdateValue); }, value: ParentValue) IntermediateToken - - CSharp - , ParentValue) - CSharpCode - (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (86:1,7 [102] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (86:1,7 [102] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt index a9f99d1f9a9..48cb40c9c8d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback/TestComponent.mappings.txt @@ -1,13 +1,11 @@ -Source Location: (86:1,7 [104] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (86:1,7 [102] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } | -Generated Location: (1827:31,7 [104] ) +Generated Location: (1828:31,7 [102] ) | public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs index b4df1c8ebbe..4584fc78cd8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.codegen.cs @@ -23,7 +23,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: () => { }).InvokeAsync(); }, value: ParentValue), ParentValue)))); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: () => { }); }, value: ParentValue), ParentValue)))); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt index 8ef052b4beb..e3c92532e9e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.ir.txt @@ -14,7 +14,7 @@ Document - ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: () => { }).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: () => { }); }, value: ParentValue) IntermediateToken - - CSharp - , ParentValue) CSharpCode - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt index 4af886e41c2..30f67d9dff1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesAction/TestComponent.mappings.txt @@ -2,7 +2,7 @@ Source Location: (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1825:31,7 [50] ) +Generated Location: (1826:31,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs index 97526fe14bc..0fb43af67c4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.codegen.cs @@ -23,7 +23,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue), ParentValue)))); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: UpdateValue); }, value: ParentValue), ParentValue)))); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt index 18ff54c4174..3e2b6916ded 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.ir.txt @@ -14,7 +14,7 @@ Document - ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes CSharpExpression - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: UpdateValue).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: UpdateValue); }, value: ParentValue) IntermediateToken - - CSharp - , ParentValue) CSharpCode - (86:1,7 [106] x:\dir\subdir\Test\TestComponent.cshtml) LazyIntermediateToken - (86:1,7 [106] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public Task UpdateValue() => Task.CompletedTask;\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt index 6f73b7dc181..b6204d90fe4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_EventCallback_ReceivesFunction/TestComponent.mappings.txt @@ -4,7 +4,7 @@ Source Location: (86:1,7 [106] x:\dir\subdir\Test\TestComponent.cshtml) public Task UpdateValue() => Task.CompletedTask; | -Generated Location: (1827:31,7 [106] ) +Generated Location: (1828:31,7 [106] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs index 84fb66772ad..769c9ae917d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -31,7 +31,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt index f0ad6a1c204..5af77d02685 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.ir.txt @@ -16,5 +16,5 @@ Document - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, IntermediateToken - - CSharp - UpdateValue IntermediateToken - - CSharp - , ParentValue) - CSharpCode - (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (84:1,7 [107] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [107] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt index b5f0f6c8d64..d2167d902b8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -1,13 +1,11 @@ -Source Location: (84:1,7 [109] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (84:1,7 [107] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } | -Generated Location: (1544:31,7 [109] ) +Generated Location: (1544:31,7 [107] ) | public int ParentValue { get; set; } = 42; - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs index 8ad953adf23..217178a478f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.codegen.cs @@ -23,7 +23,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue), ParentValue)); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue), ParentValue)); __builder.SetUpdatesAttributeName("myvalue"); __builder.CloseElement(); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt index c34e4887d57..2676adf02b8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.ir.txt @@ -16,7 +16,7 @@ Document - HtmlAttribute - (18:0,18 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue) IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt index bcdcdec4f7e..0b8456cd8d9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindAndParamBindSet/TestComponent.mappings.txt @@ -4,7 +4,7 @@ Source Location: (73:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) public void UpdateValue(string value) => ParentValue = value; | -Generated Location: (1382:32,7 [124] ) +Generated Location: (1373:32,7 [124] ) | public string ParentValue { get; set; } = "hi"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs index baff0c05dc7..6837c7c34b6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.codegen.cs @@ -23,7 +23,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue), ParentValue)); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue), ParentValue)); __builder.SetUpdatesAttributeName("myvalue"); #nullable restore #line (1,39)-(1,50) 24 "x:\dir\subdir\Test\TestComponent.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt index e647ba231dd..3d2efdbd05d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.ir.txt @@ -19,7 +19,7 @@ Document - HtmlAttribute - (12:0,12 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue) IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt index 9fae1fac0e2..79591e4514f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingBindValueWithGetSet/TestComponent.mappings.txt @@ -4,7 +4,7 @@ Source Location: (86:1,7 [124] x:\dir\subdir\Test\TestComponent.cshtml) public void UpdateValue(string value) => ParentValue = value; | -Generated Location: (1550:39,7 [124] ) +Generated Location: (1541:39,7 [124] ) | public string ParentValue { get; set; } = "hi"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs index 1acaefc383b..c36076334f2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.codegen.cs @@ -23,7 +23,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue).InvokeAsync(); await global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: AfterUpdate).InvokeAsync(); }, value: ParentValue), ParentValue)); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue)(); await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: AfterUpdate); }, value: ParentValue), ParentValue)); __builder.SetUpdatesAttributeName("myvalue"); __builder.CloseElement(); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt index ab5cbb159f0..c6edc8cea84 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.ir.txt @@ -16,7 +16,7 @@ Document - HtmlAttribute - (16:0,16 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: UpdateValue, value: ParentValue).InvokeAsync(); await global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: AfterUpdate).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: async __value => { await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: UpdateValue, value: ParentValue)(); await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: AfterUpdate); }, value: ParentValue) IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt index 8d6028113b1..99be52c3b1a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_MixingSetWithAfter/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Source Location: (91:1,7 [159] x:\dir\subdir\Test\TestComponent.cshtml) public void UpdateValue(string value) => ParentValue = value; public void AfterUpdate() { } | -Generated Location: (1678:32,7 [159] ) +Generated Location: (1667:32,7 [159] ) | public string ParentValue { get; set; } = "hi"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs index 827d8a22097..75e3790c339 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.codegen.cs @@ -23,7 +23,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: DoSomething).InvokeAsync(); }, value: ParentValue), ParentValue)); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: DoSomething); }, value: ParentValue), ParentValue)); __builder.SetUpdatesAttributeName("myvalue"); __builder.CloseElement(); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt index a0fd4e682fb..78f8d2a91a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.ir.txt @@ -16,7 +16,7 @@ Document - HtmlAttribute - (20:0,20 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, callback: DoSomething).InvokeAsync(); }, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: __value => { ParentValue = __value; return global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate(callback: DoSomething); }, value: ParentValue) IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt index be455fc7936..f9383ce9864 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithBindAfterAndSuffix/TestComponent.mappings.txt @@ -7,7 +7,7 @@ Source Location: (85:2,7 [131] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (1530:32,7 [131] ) +Generated Location: (1531:32,7 [131] ) | public string ParentValue { get; set; } = "hi"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs index 53e1f4a82b8..c9b4b4ba52b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.codegen.cs @@ -23,7 +23,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: ValueChanged, value: ParentValue), ParentValue)); + __builder.AddAttribute(2, "myevent", global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: ValueChanged, value: ParentValue), ParentValue)); __builder.SetUpdatesAttributeName("myvalue"); __builder.CloseElement(); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt index bbbedfe59bf..f8ac6c0a2f6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.ir.txt @@ -16,7 +16,7 @@ Document - HtmlAttribute - (24:0,24 [12] x:\dir\subdir\Test\TestComponent.cshtml) - myevent=" - " CSharpExpressionAttributeValue - - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.EventCallback.Factory.CreateBinder(this, - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, callback: ValueChanged, value: ParentValue) + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredBindSetter(callback: ValueChanged, value: ParentValue) IntermediateToken - - CSharp - , IntermediateToken - - CSharp - ParentValue IntermediateToken - - CSharp - ) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt index fed5b9609dc..3432e2350ca 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToElement_WithGetSetAndSuffix/TestComponent.mappings.txt @@ -7,7 +7,7 @@ Source Location: (88:2,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) return Task.CompletedTask; } | -Generated Location: (1389:32,7 [144] ) +Generated Location: (1380:32,7 [144] ) | public string ParentValue { get; set; } = "hi"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..5b93d83e098 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..9bd57113609 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,22 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CustomValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public void UpdateValue(CustomValue value) => ParentValue = value;\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..b2f3954e34f --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| +Generated Location: (1551:31,7 [147] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs index b23ea6186b8..05e7e41b7d1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -31,7 +31,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt index 649e9ffee4d..0c3eefecd54 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -18,5 +18,5 @@ Document - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, IntermediateToken - - CSharp - UpdateValue IntermediateToken - - CSharp - , ParentValue) - CSharpCode - (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (105:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt index 95784a6d061..cdbe9ce48a4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -1,13 +1,11 @@ -Source Location: (105:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (105:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) | public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } | -Generated Location: (1551:31,7 [140] ) +Generated Location: (1551:31,7 [138] ) | public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..e2a657ef24b --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..d9aac9659f2 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,22 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CustomValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..cd4a05edb81 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1551:31,7 [179] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..a37a282514f --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..b6278237f3b --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,23 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public void UpdateValue(CustomValue value) => ParentValue = value;\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..6e248653230 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| +Generated Location: (1148:28,7 [147] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs index 398fc4b19e5..b3ebb3e3b3d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -28,7 +28,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt index 6c64a686ca6..45730c59c33 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -16,8 +16,8 @@ Document - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, IntermediateToken - - CSharp - UpdateValue IntermediateToken - - CSharp - , ParentValue) - CSharpCode - (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (84:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n public EventCallback UpdateValue { get; set; }\n NamespaceDeclaration - - __Blazor.Test.TestComponent ClassDeclaration - - internal static - TypeInference - - ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt index 6b9fc8079ce..395583dd456 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -1,13 +1,11 @@ -Source Location: (84:1,7 [140] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (84:1,7 [138] x:\dir\subdir\Test\TestComponent.cshtml) | public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } | -Generated Location: (1148:28,7 [140] ) +Generated Location: (1148:28,7 [138] ) | public CustomValue ParentValue { get; set; } = new CustomValue(); - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..0f44d9acc70 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..d897bc50ab9 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,23 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..9eacca75674 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1148:28,7 [175] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..a0b163c7292 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..a49a91d9cfb --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,22 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public void UpdateValue(TParam value) { ParentValue = value; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..e16681cf937 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| +Generated Location: (1534:31,7 [128] ) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs index 18d4a01c9c3..ad6ad746806 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -31,7 +31,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 3 "x:\dir\subdir\Test\TestComponent.cshtml" public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt index 00dda9fbf2b..7cb7cf2826d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -18,5 +18,5 @@ Document - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, IntermediateToken - - CSharp - UpdateValue IntermediateToken - - CSharp - , ParentValue) - CSharpCode - (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (119:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n public EventCallback UpdateValue { get; set; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt index fd9ab421537..9310a41acf2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -1,13 +1,11 @@ -Source Location: (119:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (119:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) | public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } | -Generated Location: (1534:31,7 [120] ) +Generated Location: (1534:31,7 [118] ) | public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..e4268292b79 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..8de0991253b --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,22 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..5c35b21a194 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1534:31,7 [155] ) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..e7bb47ba0d3 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..89d4f4fa915 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,23 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public void UpdateValue(TParam value) { ParentValue = value; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..7e4f0338b81 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| +Generated Location: (1156:28,7 [128] ) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs index 0ee61ee1af2..dce6a1c7919 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.codegen.cs @@ -28,7 +28,6 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line 3 "x:\dir\subdir\Test\TestComponent.cshtml" public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt index 685c03a3644..3dbe717b1c5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.ir.txt @@ -16,8 +16,8 @@ Document - IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, IntermediateToken - - CSharp - UpdateValue IntermediateToken - - CSharp - , ParentValue) - CSharpCode - (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - LazyIntermediateToken - (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public EventCallback UpdateValue { get; set; }\n + CSharpCode - (103:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n public EventCallback UpdateValue { get; set; }\n NamespaceDeclaration - - __Blazor.Test.TestComponent ClassDeclaration - - internal static - TypeInference - - ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt index 172dd783a1d..f24fed51fc8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_EventCallback/TestComponent.mappings.txt @@ -1,13 +1,11 @@ -Source Location: (103:2,7 [120] x:\dir\subdir\Test\TestComponent.cshtml) +Source Location: (103:2,7 [118] x:\dir\subdir\Test\TestComponent.cshtml) | public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } | -Generated Location: (1156:28,7 [120] ) +Generated Location: (1156:28,7 [118] ) | public TParam ParentValue { get; set; } = default; - public EventCallback UpdateValue { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..714b7405787 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..f345789363f --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,23 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..fddfe2ccee3 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1156:28,7 [155] ) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Compiler/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs b/src/Compiler/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs index 493dca1afb8..8da5b0c1590 100644 --- a/src/Compiler/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs +++ b/src/Compiler/test/Microsoft.AspNetCore.Razor.Test.ComponentShim/Microsoft.AspNetCore.Components.netstandard2.0.cs @@ -168,49 +168,49 @@ public EventCallbackFactory() { } public static partial class EventCallbackFactoryBinderExtensions { public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, bool existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, System.DateTimeOffset existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, System.DateTimeOffset existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, System.DateTime existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, System.DateTime existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, decimal existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, double existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, int existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, long existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, bool? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, System.DateTimeOffset? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, System.DateTimeOffset? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, System.DateTime? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, System.DateTime? existingValue, string format, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, decimal? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, double? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, int? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, long? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, float? existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, float existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, string existingValue, System.Globalization.CultureInfo culture = null) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Action setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, Microsoft.AspNetCore.Components.EventCallback setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; } + public static Microsoft.AspNetCore.Components.EventCallback CreateBinder(this Microsoft.AspNetCore.Components.EventCallbackFactory factory, object receiver, System.Func setter, T existingValue, System.Globalization.CultureInfo culture = null) { throw null; } } public static partial class EventCallbackFactoryEventArgsExtensions { @@ -416,8 +416,10 @@ public static partial class RuntimeHelpers public static System.Threading.Tasks.Task InvokeAsynchronousDelegate(System.Action callback) { throw null; } public static System.Threading.Tasks.Task InvokeAsynchronousDelegate(System.Func callback) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateInferredEventCallback(object receiver, System.Action callback, T value) { throw null; } - public static Microsoft.AspNetCore.Components.EventCallback CreateInferredEventCallback(object receiver, Microsoft.AspNetCore.Components.EventCallback callback, T value) { throw null; } public static Microsoft.AspNetCore.Components.EventCallback CreateInferredEventCallback(object receiver, System.Func callback, T value) { throw null; } + public static System.Func CreateInferredBindSetter(System.Action callback, T value) { throw null; } + public static System.Func CreateInferredBindSetter(System.Func callback, T value) { throw null; } + public static T TypeCheck(T value) { throw null; } } } diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..f9b098915ff --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,67 @@ +// +#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 : global::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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CustomValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..0635e504516 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,31 @@ +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 - global::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 + Component - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CustomValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public void UpdateValue(CustomValue value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..d848d206ef5 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|CustomValue| +Generated Location: (916:25,21 [11] ) +|CustomValue| + +Source Location: (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1231:34,51 [11] ) +|ParentValue| + +Source Location: (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| +Generated Location: (2168:56,7 [147] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..d001e496392 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,67 @@ +// +#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 : global::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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + CustomValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..3995d88d7ff --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,31 @@ +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 - global::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 + Component - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CustomValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (96:0,96 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..33a60f71078 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|CustomValue| +Generated Location: (916:25,21 [11] ) +|CustomValue| + +Source Location: (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1231:34,51 [11] ) +|ParentValue| + +Source Location: (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (2168:56,7 [179] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..b3520c525c5 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,68 @@ +// +#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 : global::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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..60132f11a1b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,32 @@ +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 - global::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 + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public void UpdateValue(CustomValue value) => ParentValue = value;\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..2c9ae668980 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1001:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| +Generated Location: (1596:43,7 [147] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..98698f106ad --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,68 @@ +// +#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 : global::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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..11aa93e2a3e --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,32 @@ +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 - global::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 + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (75:0,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..e51c6592235 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,18 @@ +Source Location: (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1001:25,30 [11] ) +|ParentValue| + +Source Location: (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1596:43,7 [175] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..39041821dc3 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,77 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + TParam + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..5a5f2ec15b4 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,32 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + 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 + Component - (19:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public void UpdateValue(TParam value) { ParentValue = value; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..a22c4c56c86 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,28 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (1143:35,21 [6] ) +|TParam| + +Source Location: (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1443:44,46 [11] ) +|ParentValue| + +Source Location: (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| +Generated Location: (2370:66,7 [128] ) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..19481343b50 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,77 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = typeof( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + TParam + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..379f1b2a9e6 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,32 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + 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 + Component - (19:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (110:1,91 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..5d5e5cf8363 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,28 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (1143:35,21 [6] ) +|TParam| + +Source Location: (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1443:44,46 [11] ) +|ParentValue| + +Source Location: (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (2370:66,7 [155] ) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..b8e44541c66 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,78 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..d3d1f685678 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,33 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + 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 + Component - (19:1,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public void UpdateValue(TParam value) { ParentValue = value; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..724cafc3a4f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1228:35,30 [11] ) +|ParentValue| + +Source Location: (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| +Generated Location: (1823:53,7 [128] ) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..4c90ed74362 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,78 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + ((System.Action)(() => { +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +global::System.Object TParam = null!; + +#line default +#line hidden +#nullable disable + } + ))(); + } + #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(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, -1, -1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , -1, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, + global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.MyComponent<>); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..4fa31b4fdfe --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,33 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + DesignTimeDirective - + DirectiveToken - (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TParam + 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 + Component - (19:1,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + HtmlContent - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (94:1,75 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..d3ba69cb6ea --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,23 @@ +Source Location: (11:0,11 [6] x:\dir\subdir\Test\TestComponent.cshtml) +|TParam| +Generated Location: (581:17,22 [6] ) +|TParam| + +Source Location: (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1228:35,30 [11] ) +|ParentValue| + +Source Location: (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1823:53,7 [155] ) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..5b93d83e098 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..9bd57113609 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,22 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CustomValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public void UpdateValue(CustomValue value) => ParentValue = value;\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..b2f3954e34f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (105:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| +Generated Location: (1551:31,7 [147] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..e2a657ef24b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..d9aac9659f2 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,22 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [96] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (21:0,21 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - CustomValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (51:0,51 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..cd4a05edb81 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (105:1,7 [179] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1551:31,7 [179] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..a37a282514f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..b6278237f3b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,23 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public void UpdateValue(CustomValue value) => ParentValue = value;\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..6e248653230 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (84:1,7 [147] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| +Generated Location: (1148:28,7 [147] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public void UpdateValue(CustomValue value) => ParentValue = value; +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..0f44d9acc70 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..d897bc50ab9 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,23 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (30:0,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public CustomValue ParentValue { get; set; } = new CustomValue();\n\n public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..9eacca75674 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (84:1,7 [175] x:\dir\subdir\Test\TestComponent.cshtml) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1148:28,7 [175] ) +| + public CustomValue ParentValue { get; set; } = new CustomValue(); + + public Task UpdateValue(CustomValue value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..a0b163c7292 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..a49a91d9cfb --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,22 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public void UpdateValue(TParam value) { ParentValue = value; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..e16681cf937 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (119:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| +Generated Location: (1534:31,7 [128] ) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..e4268292b79 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,42 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent>(0); + __builder.AddAttribute(1, "Value", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddAttribute(2, "ValueChanged", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue)))); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..8de0991253b --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,22 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [91] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentTypeArgument - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - TValue + LazyIntermediateToken - (40:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - TParam + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (65:1,46 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; }\n diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..5c35b21a194 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericBindToGenericComponent_ExplicitType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (119:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1534:31,7 [155] ) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs new file mode 100644 index 00000000000..e7bb47ba0d3 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt new file mode 100644 index 00000000000..89d4f4fa915 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.ir.txt @@ -0,0 +1,23 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public void UpdateValue(TParam value) { ParentValue = value; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt new file mode 100644 index 00000000000..7e4f0338b81 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Action/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (103:2,7 [128] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| +Generated Location: (1156:28,7 [128] ) +| + public TParam ParentValue { get; set; } = default; + + public void UpdateValue(TParam value) { ParentValue = value; } +| + diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs new file mode 100644 index 00000000000..714b7405787 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#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 : global::Microsoft.AspNetCore.Components.ComponentBase + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + global::__Blazor.Test.TestComponent.TypeInference.CreateMyComponent_0(__builder, 0, 1, +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + , 2, global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, UpdateValue, ParentValue))); + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } + +#line default +#line hidden +#nullable disable + } +} +namespace __Blazor.Test.TestComponent +{ + #line hidden + internal static class TypeInference + { + public static void CreateMyComponent_0(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder, int seq, int __seq0, TValue __arg0, int __seq1, global::Microsoft.AspNetCore.Components.EventCallback __arg1) + { + __builder.OpenComponent>(seq); + __builder.AddAttribute(__seq0, "Value", __arg0); + __builder.AddAttribute(__seq1, "ValueChanged", __arg1); + __builder.CloseComponent(); + } + } +} +#pragma warning restore 1591 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt new file mode 100644 index 00000000000..f345789363f --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.ir.txt @@ -0,0 +1,23 @@ +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 - global::Microsoft.AspNetCore.Components.ComponentBase - - TParam + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (19:1,0 [75] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (49:1,30 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, + IntermediateToken - - CSharp - UpdateValue + IntermediateToken - - CSharp - , ParentValue) + CSharpCode - (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public TParam ParentValue { get; set; } = default;\n\n public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; }\n + NamespaceDeclaration - - __Blazor.Test.TestComponent + ClassDeclaration - - internal static - TypeInference - - + ComponentTypeInferenceMethod - - __Blazor.Test.TestComponent.TypeInference - CreateMyComponent_0 diff --git a/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt new file mode 100644 index 00000000000..fddfe2ccee3 --- /dev/null +++ b/src/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericComponentBindToGenericComponent_InferredType_WithGetSet_Function/TestComponent.mappings.txt @@ -0,0 +1,13 @@ +Source Location: (103:2,7 [155] x:\dir\subdir\Test\TestComponent.cshtml) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| +Generated Location: (1156:28,7 [155] ) +| + public TParam ParentValue { get; set; } = default; + + public Task UpdateValue(TParam value) { ParentValue = value; return Task.CompletedTask; } +| +