Assign tuple optimizer (#3147)
* branch init * add BindCollectLightSymInfo * moved lightsyminfo to syntaxVisitors * LIghtSymInfo fixes * binder 0.1 * Attributes -> SymbolAttributes * AssignTupleOptimizer -> AssignTupleDesugar * moved algorithm classes to AssignTupleDesugarAlgorithm namespace * fixes and refactoring * LightSymInfo rework * add rebuildDebug and build units * enable VarNamesInMethodsWithSameNameAsClassGenericParamsReplacer * remove CollectFullLightSymInfo call * bind now return BindResult * change BindResult path type * path testing * fix Current in BindCollectLightSymInfo * fix Current in BindCollectLightSymInfo * potential symomyms handling without assigns count minimization * assign count minimization * rename AssignTuplesDesugar * move NewAssignTupleDesugar * add optimization switch * delete AssignTupleDesugar project * remove comments * collect symbols from var tuples * optimize var_tuple_def_statement and assign_var_tuple * fix * fix Tuple Visitor * fix
This commit is contained in:
parent
54f8db8ce2
commit
d269c7ca20
|
|
@ -109,6 +109,21 @@ namespace AssignTupleDesugarAlgorithm
|
|||
}
|
||||
}
|
||||
|
||||
// if repeated assigns or pointers -> 2n
|
||||
for (int i = 0; i < left.Count(); i++)
|
||||
{
|
||||
if (left_visited.Find(it => it.StructurallyEquals(left[i])) != null
|
||||
|| right[i].type == Symbol.Type.POINTER
|
||||
|| left[i].type == Symbol.Type.POINTER)
|
||||
{
|
||||
var res = new AssignGraph();
|
||||
res.assignFirst = make2n(left, right);
|
||||
return res;
|
||||
}
|
||||
else
|
||||
left_visited.Add(left[i]);
|
||||
}
|
||||
|
||||
//handle expressions and var params
|
||||
for (int i = 0; i < left.Count(); i++)
|
||||
{
|
||||
|
|
@ -124,7 +139,7 @@ namespace AssignTupleDesugarAlgorithm
|
|||
|
||||
for (int i = left.Count - 1; i > -1; i--)
|
||||
{
|
||||
//delete loops
|
||||
//handle loops
|
||||
if (left[i].StructurallyEquals(right[i]))
|
||||
{
|
||||
var f = new SymbolNode(right[i]);
|
||||
|
|
@ -133,17 +148,6 @@ namespace AssignTupleDesugarAlgorithm
|
|||
left.RemoveAt(i);
|
||||
right.RemoveAt(i);
|
||||
}
|
||||
// if repeated assigns or pointers -> 2n
|
||||
else if (left_visited.Find(it => it.StructurallyEquals(left[i])) != null
|
||||
|| right[i].type == Symbol.Type.POINTER
|
||||
|| left[i].type == Symbol.Type.POINTER)
|
||||
{
|
||||
var res = new AssignGraph();
|
||||
res.assignFirst = make2n(left, right);
|
||||
return res;
|
||||
}
|
||||
else
|
||||
left_visited.Add(left[i]);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -151,7 +155,6 @@ namespace AssignTupleDesugarAlgorithm
|
|||
var nameToGraph = new Dictionary<string, SynonymsGraph>();
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < left.Count; i++)
|
||||
{
|
||||
if (left[i].type == Symbol.Type.INDEXER)
|
||||
|
|
|
|||
Loading…
Reference in a new issue