New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recursive resolving of generic arguments types in registration of methods in javascript translation #892
Merged
Merged
Recursive resolving of generic arguments types in registration of methods in javascript translation #892
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
2f47158
Implemented recognition of generic types in javascript translation me…
quigamdev 16b1715
Added another javascript method translation test
quigamdev 77250cc
Added recursive search of generic method overloads
quigamdev dce0a7d
NuGet package version 2.5.0-preview06-92421-gtr
937040f
Fixed resolution of order of generic types. Added tests for generic m…
quigamdev d69f1fc
ExpressionHelper - Renamed i to genericArgumentPosition
quigamdev e371cdb
ExpressionHelper - Comparison of generic arguments simplified
quigamdev 9e5c129
ExpressionHelper - Simplified resolution of arrays
quigamdev 57b453e
ExpressionHelper - arrays first level resolution
quigamdev 2d81699
Merge
quigamdev 91c9f71
ExpressionHelper - Added support for recursive resolution of arrays
quigamdev 32a70c4
Removed unnecessary condition in ExpressionHelper
quigamdev f9a39e0
ExpressionHelper - Added support for nested generic array types
quigamdev 728b9e3
ExpressionHelperTests - Uncommented array test
quigamdev 1e67666
Merge branch 'main' into generic-types-resolving
quigamdev 7d3c7df
Merge branch 'main' into generic-types-resolving
quigamdev File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
...mmon/ViewModels/FeatureSamples/JavascriptTranslation/GenericMethodTranslationViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using DotVVM.Framework.ViewModel; | ||
using DotVVM.Samples.BasicSamples; | ||
|
||
namespace DotVVM.Samples.Common.ViewModels.FeatureSamples.JavascriptTranslation | ||
{ | ||
public class GenericMethodTranslationViewModel : DotVVM.Samples.BasicSamples.ViewModels.ComplexSamples.SPA.SiteViewModel | ||
{ | ||
public JavascriptTranslationModel<string, JavascriptTranslationInnerTestModel<JavascriptTranslationInnerTestModel<int>>> Model { get; set; } = new JavascriptTranslationModel<string, JavascriptTranslationInnerTestModel<JavascriptTranslationInnerTestModel<int>>>() { VModel2 = "Some data", VModel = new JavascriptTranslationInnerTestModel<JavascriptTranslationInnerTestModel<int>>() { Value = new JavascriptTranslationInnerTestModel<int>() { Value = 20 } } }; | ||
public JavascriptTranslationModel<bool, JavascriptTranslationInnerTestModel<double[]>> Model2 { get; set; } | ||
= new JavascriptTranslationModel<bool, JavascriptTranslationInnerTestModel<double[]>>() { | ||
VModel2 = true, | ||
VModel = new JavascriptTranslationInnerTestModel<double[]>() { | ||
Value = new[] { 20d } } }; | ||
|
||
public JavascriptTranslationModel<bool> Model3 { get; set; } = new JavascriptTranslationModel<bool>() { Model = true }; | ||
|
||
public JavascriptTranslationModel<JavascriptTranslationInnerModel<bool>> Model4 { get; set; } | ||
= new JavascriptTranslationModel<JavascriptTranslationInnerModel<bool>>() { | ||
Model = new JavascriptTranslationInnerModel<bool>() { | ||
Model = false } }; | ||
|
||
public JavascriptTranslationModel<JavascriptTranslationInnerModel<string[]>[]> Model5 { get; set; } | ||
= new JavascriptTranslationModel<JavascriptTranslationInnerModel<string[]>[]>() { | ||
Model = new[]{ | ||
new JavascriptTranslationInnerModel<string[]>() { Model = new[] { "str1", "str2" } }, | ||
new JavascriptTranslationInnerModel<string[]>() { Model = new[] { "str3", "str4" } } | ||
} | ||
}; | ||
|
||
public override Task Load() | ||
{ | ||
var w1 = JavascriptTranslationTestMethods.Unwrap(Model, Model2); | ||
var w3 = JavascriptTranslationTestMethods.Unwrap(Model3); | ||
var w4 = JavascriptTranslationTestMethods.Unwrap(Model4); | ||
var w5 = JavascriptTranslationTestMethods.Unwrap(Model5); | ||
return base.Load(); | ||
} | ||
|
||
} | ||
public class JavascriptTranslationInnerTestModel<Tmodel> | ||
{ | ||
public Tmodel Value { get; set; } | ||
} | ||
public static class JavascriptTranslationTestMethods | ||
{ | ||
public static T2 Unwrap<T3, T2, T4, T>(JavascriptTranslationModel<T2, T> transferModel, JavascriptTranslationModel<T3, T4> transferModel2) | ||
{ | ||
return transferModel.VModel2; | ||
} | ||
|
||
public static T Unwrap<T>(JavascriptTranslationModel<T> transferModel) | ||
{ | ||
return transferModel.Model; | ||
} | ||
|
||
public static T Unwrap<T>(JavascriptTranslationModel<JavascriptTranslationInnerModel<T>> transferModel) | ||
{ | ||
return transferModel.Model.Model; | ||
} | ||
} | ||
public class JavascriptTranslationModel<T> | ||
{ | ||
public T Model { get; set; } | ||
|
||
} | ||
public class JavascriptTranslationInnerModel<T> | ||
{ | ||
public T Model { get; set; } | ||
} | ||
public class JavascriptTranslationInner2Model<T> | ||
{ | ||
public T Model { get; set; } | ||
} | ||
public class JavascriptTranslationModel<Tx, Ty> | ||
{ | ||
public Ty VModel { get; set; } | ||
public Tx VModel2 { get; set; } | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: This special case is not needed.