В [cache] Tuple заменен на ValueTuple если таковой имеется. Это проверяется во время компиляции.

Это позволило ускорить кеширование функций с 2 параметрами и более примерно в 3 раза
This commit is contained in:
Mikhalkovich Stanislav 2022-05-09 20:29:04 +03:00
parent 8b60c3ced5
commit 3b8e54fe1e
5 changed files with 12 additions and 6 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "8";
public const string Build = "3";
public const string Revision = "3119";
public const string Revision = "3121";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%MINOR%=8
%REVISION%=3119
%REVISION%=3121
%COREVERSION%=3
%MAJOR%=3

View file

@ -1 +1 @@
3.8.3.3119
3.8.3.3121

View file

@ -1 +1 @@
!define VERSION '3.8.3.3119'
!define VERSION '3.8.3.3121'

View file

@ -76,12 +76,18 @@ namespace SyntaxVisitors.SugarVisitors
// var @tpar := Tuple.Create(все параметры)
var tupleIdent = new ident("@tpar" + UniqueNumStr());
// SSM 08.05.22 - один параметр не надо оборачивать в кортеж
// SSM 09.05.22 - для реализации кортежа используется ValueTuple если он определен
var TupleName = "Tuple";
if (System.Type.GetType("System.ValueTuple") != null)
TupleName = "ValueTuple";
var_statement vs;
if (pp.Length == 1)
vs = new var_statement(tupleIdent, pp[0].Item1 as expression);
else vs = new var_statement(tupleIdent,
new method_call(
new dot_node(new dot_node("?System", "Tuple"),new ident("Create")),
new dot_node(new dot_node("?System", TupleName),new ident("Create")),
new expression_list(pp.Select(pair => pair.Item1 as expression).ToList())
)
);
@ -103,7 +109,7 @@ namespace SyntaxVisitors.SugarVisitors
if (pp.Length == 1)
ttr_tuple = pp[0].Item2 as type_definition;
else
ttr_tuple = new template_type_reference(new named_type_reference(new List<ident> { new ident("System"), new ident("Tuple") }),
ttr_tuple = new template_type_reference(new named_type_reference(new List<ident> { new ident("System"), new ident(TupleName) }),
ttp
);