Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drawman - увеличена толщина линий StandOutExprWithLambdaInForeachSequenceVisitor
- Loading branch information
Showing
15 changed files
with
116 additions
and
35 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
%MINOR%=2 | ||
%REVISION%=1334 | ||
%REVISION%=1336 | ||
%COREVERSION%=0 | ||
%MAJOR%=3 |
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 |
---|---|---|
@@ -1 +1 @@ | ||
!define VERSION '3.2.0.1334' | ||
!define VERSION '3.2.0.1336' |
59 changes: 59 additions & 0 deletions
59
StandardSyntaxTreeConverter/StandOutExprWithLambdaInForeachSequenceConverter.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,59 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using PascalABCCompiler.SyntaxTree; | ||
|
||
public class StandOutExprWithLambdaInForeachSequenceVisitor : BaseEnterExitVisitor | ||
{ | ||
public static StandOutExprWithLambdaInForeachSequenceVisitor New | ||
{ | ||
get | ||
{ | ||
return new StandOutExprWithLambdaInForeachSequenceVisitor(); | ||
} | ||
} | ||
|
||
private int GenIdNum = 0; | ||
public ident GenIdentName() | ||
{ | ||
GenIdNum++; | ||
return new ident("$GenContFE" + GenIdNum.ToString()); | ||
} | ||
|
||
public void ReplaceStatement(statement from, IEnumerable<statement> to) | ||
{ | ||
foreach (var x in to) | ||
x.Parent = from.Parent; | ||
var sl = from.Parent as statement_list; | ||
if (sl != null) | ||
{ | ||
sl.ReplaceInList(from, to); | ||
} | ||
else | ||
{ | ||
var l = new statement_list(); | ||
l.AddMany(to); | ||
l.source_context = from.source_context; | ||
from.Parent.Replace(from, l); | ||
} | ||
} | ||
|
||
|
||
public override void visit(foreach_stmt fe) | ||
{ | ||
if (fe.in_what.DescendantNodes().OfType<function_lambda_definition>().Count()>0) | ||
{ | ||
var id = GenIdentName(); | ||
id.Parent = fe; | ||
var ass = new var_statement(id, fe.in_what, fe.in_what.source_context); | ||
fe.in_what = id; | ||
var l = new List<statement>(); | ||
l.Add(ass); | ||
l.Add(fe); | ||
ReplaceStatement(fe, l); | ||
} | ||
|
||
base.visit(fe); | ||
} | ||
|
||
} |
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
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
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
Binary file not shown.
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