diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index b4f38d3d5..6fc89b8ce 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "9"; public const string Build = "0"; - public const string Revision = "3417"; + public const string Revision = "3418"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index b8fe50267..963a31e86 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=9 -%REVISION%=3417 %COREVERSION%=0 +%REVISION%=3418 +%MINOR%=9 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index 69518271b..5378709db 100644 Binary files a/Localization/DefaultLang.resources and b/Localization/DefaultLang.resources differ diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index c574e9eee..3e1dca446 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.9.0.3417 +3.9.0.3418 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 88ab84c22..db1338198 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.9.0.3417' +!define VERSION '3.9.0.3418' diff --git a/SyntaxTreeConverters/StandardSyntaxConverter.cs b/SyntaxTreeConverters/StandardSyntaxConverter.cs index 011649493..f664df914 100644 --- a/SyntaxTreeConverters/StandardSyntaxConverter.cs +++ b/SyntaxTreeConverters/StandardSyntaxConverter.cs @@ -27,7 +27,7 @@ namespace PascalABCCompiler.SyntaxTreeConverters // stat.ProcessNode(root); #endif // SSM 02.01.24 - LetExprVisitor.New.ProcessNode(root); + //LetExprVisitor.New.ProcessNode(root); // new range - до всего! До выноса выражения с лямбдой из foreach. 11.07 добавил поиск yields и присваивание pd.HasYield NewRangeDesugarAndFindHasYieldVisitor.New.ProcessNode(root); diff --git a/TestSuite/CompilationSamples/Tasks1Loops.pas b/TestSuite/CompilationSamples/Tasks1Loops.pas index 91f79360c..2c5c7c786 100644 --- a/TestSuite/CompilationSamples/Tasks1Loops.pas +++ b/TestSuite/CompilationSamples/Tasks1Loops.pas @@ -528,7 +528,7 @@ begin end; 'Min3': begin CheckData(InitialInput := |cRe|*3); - Generatetests(10,tRe(1,100)*2); + Generatetests(10,tRe(1,100)*3); CheckOutput(Min(Re(0),Re(1),Re(2))); end; 'SeriesMin2': begin diff --git a/TestSuite/CompilationSamples/TasksStr.pas b/TestSuite/CompilationSamples/TasksStr.pas index 805ca318d..a849171a0 100644 --- a/TestSuite/CompilationSamples/TasksStr.pas +++ b/TestSuite/CompilationSamples/TasksStr.pas @@ -282,7 +282,7 @@ begin end; 'Insert2': begin CheckData(Input := Empty); - CheckOutput('Петр первый был великим русским императором'); + CheckOutput('Петр Первый был великим русским императором'); end; 'StrChange1': begin CheckData(Input := Empty); @@ -306,7 +306,7 @@ begin end; 'StrSlice2': begin CheckData(Input := Empty); - CheckOutputSeq(Arr('клад зарыт на юго западе', 'клад зарыт на юго западе')); + CheckOutputSeq(Arr('клад зарыт на юго западе', 'зашифрованное сообщение')); end; 'StrSlice4': begin CheckData(Input := Empty); diff --git a/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs b/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs index 445b45afb..b3ddc5efb 100644 --- a/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs +++ b/TreeConverter/LambdaExpressions/Closure/CapturedVariablesTreeBuilder.cs @@ -95,6 +95,18 @@ namespace TreeConverter.LambdaExpressions.Closure } } + + // SSM 2024.01.09 + public override void visit(let_var_expr letVarExpr) + { + ProcessNode(letVarExpr.ex); + + _visitor.ProcessNode(letVarExpr); + + SymbolInfo si = _visitor.context.find_first(letVarExpr.id.name); + _currentTreeNode.VariablesDefinedInScope.Add(new CapturedVariablesTreeNode.CapturedSymbolInfo(letVarExpr, si)); + } + public override void visit(statement_list stmtList) { if (stmtList.IsInternal) // просто обойти как продолжение объемлющего statement_list diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 14fead5d6..664c6e1bd 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -19807,6 +19807,36 @@ namespace PascalABCCompiler.TreeConverter ret.reset(); // SSM 19.01.17 не возвращать семантическое значение т.к. ничего не нужно добавлять в текущий список операторов!! } + // создать словарик чтобы для одного _visitor.context.CurrentScope.ScopeNum и для одного letVarExpr + // мы заходили в этот visit один раз + private Dictionary> letDict = new Dictionary>(); + + // можно попробовать в одно ПИ не добавлять дважды - хранить словарь (let-переменная, номера ПИ в кот добавлена) + public override void visit(SyntaxTree.let_var_expr let_expr) + { + if (letDict.ContainsKey(let_expr) && letDict[let_expr].Contains(context.CurrentScope.ScopeNum)) + return; + + if (!letDict.ContainsKey(let_expr)) + letDict[let_expr] = new List(); + letDict[let_expr].Add(context.CurrentScope.ScopeNum); + + var exn = (expression_node)convert_strong(let_expr.ex); + var sav = new semantic_addr_value(exn); + var vds = new var_statement(let_expr.id, sav, let_expr.source_context); + if (let_expr.visit_var) + { + visit(vds.var_def); + //let_expr.visit_var = false; + } + else + { + + } + return_value(exn); + } + + public override void visit(SyntaxTree.expression_as_statement node) { return_value((statement_node)convert_strong(node.expr)); diff --git a/bin/Lib/Tasks1Loops.pas b/bin/Lib/Tasks1Loops.pas index 91f79360c..2c5c7c786 100644 --- a/bin/Lib/Tasks1Loops.pas +++ b/bin/Lib/Tasks1Loops.pas @@ -528,7 +528,7 @@ begin end; 'Min3': begin CheckData(InitialInput := |cRe|*3); - Generatetests(10,tRe(1,100)*2); + Generatetests(10,tRe(1,100)*3); CheckOutput(Min(Re(0),Re(1),Re(2))); end; 'SeriesMin2': begin diff --git a/bin/Lib/TasksStr.pas b/bin/Lib/TasksStr.pas index 805ca318d..a849171a0 100644 --- a/bin/Lib/TasksStr.pas +++ b/bin/Lib/TasksStr.pas @@ -282,7 +282,7 @@ begin end; 'Insert2': begin CheckData(Input := Empty); - CheckOutput('Петр первый был великим русским императором'); + CheckOutput('Петр Первый был великим русским императором'); end; 'StrChange1': begin CheckData(Input := Empty); @@ -306,7 +306,7 @@ begin end; 'StrSlice2': begin CheckData(Input := Empty); - CheckOutputSeq(Arr('клад зарыт на юго западе', 'клад зарыт на юго западе')); + CheckOutputSeq(Arr('клад зарыт на юго западе', 'зашифрованное сообщение')); end; 'StrSlice4': begin CheckData(Input := Empty);