diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 04ec7bacb..bcf936b92 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 = "1"; public const string Build = "0"; - public const string Revision = "1291"; + public const string Revision = "1295"; 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 767bed279..83b832b52 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ %COREVERSION%=0 -%REVISION%=1291 +%REVISION%=1295 %MINOR%=1 %MAJOR%=3 diff --git a/InstallerSamples/!NewExecutors/Браузер1.pas b/InstallerSamples/!NewExecutors/Браузер1.pas new file mode 100644 index 000000000..585c26cfa --- /dev/null +++ b/InstallerSamples/!NewExecutors/Браузер1.pas @@ -0,0 +1,11 @@ +uses ГрафическиеИсполнители; + +begin + var КнопкаЯндекс := СоздатьКнопку('Яндекс'); + var КнопкаВКШ := СоздатьКнопку('ВКШ'); + + var Браузер := СоздатьБраузер; + + КнопкаЯндекс.ПриНажатии += Браузер.ОтобразитьСайт('http://www.yandex.ru'); + КнопкаВКШ.ПриНажатии += Браузер.ОтобразитьСайт('http://sunschool.mmcs.sfedu.ru'); +end. \ No newline at end of file diff --git a/InstallerSamples/!NewExecutors/ГрафическиеИсполнители.pas b/InstallerSamples/!NewExecutors/ГрафическиеИсполнители.pas new file mode 100644 index 000000000..a19f3f767 --- /dev/null +++ b/InstallerSamples/!NewExecutors/ГрафическиеИсполнители.pas @@ -0,0 +1,54 @@ +unit ГрафическиеИсполнители; + +uses FormsABC; + +type + WebBrowser2 = class(WebBrowser) + public + procedure Отобразить(адрес: string) := Navigate(адрес); + function ОтобразитьСайт(адрес: string): () -> () := + () -> Self.Отобразить(адрес); + end; + Button2 = class(Button) + private + procedure ppp(sender: Object; e: System.EventArgs); + public + event ПриНажатии: procedure; + constructor Create(text: string); + begin + inherited Create(text); + b.Click += ppp; + end; + end; + +procedure Button2.ppp(sender: Object; e: System.EventArgs); +begin + if ПриНажатии<>nil then + ПриНажатии +end; + + +procedure Init(); +begin + MainForm.SetSize(1024,768); +end; + +function СоздатьКнопку(Заголовок: string): Button2; +begin + ParentControl := MainPanel; + Result := new Button2(Заголовок); +end; + +function СоздатьБраузер: WebBrowser2; +begin + MainPanel.Dock := Dockstyle.Left; + MainPanel.Width := 130; + ParentControl := MainForm; + Result := new WebBrowser2; + Result.Dock := DockStyle.Fill; +end; + + +begin + Init(); +end. \ No newline at end of file diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index 82e4b22d6..b7aeff713 100644 Binary files a/Localization/DefaultLang.resources and b/Localization/DefaultLang.resources differ diff --git a/PascalABCNET.axml b/PascalABCNET.axml index f84661bbd..e0e6b861c 100644 --- a/PascalABCNET.axml +++ b/PascalABCNET.axml @@ -2,6 +2,258 @@ + + + + + + \TreeConverter\TreeConversion\convertion_data_and_alghoritms.cs + return AddError<function_node>(new SeveralFunctionsCanBeCalled(loc,set_of_possible_functions)); + + public function_node select_function ( expressions_list parameters , SymbolInfo functions , location loc , List < SyntaxTree . expression > syntax_nodes_parameters = null ) + public class convertion_data_and_alghoritms + namespace PascalABCCompiler . TreeConverter + + + + + + \TreeConverter\TreeConversion\convertion_data_and_alghoritms.cs + if (funcs.Count == 2) + + public function_node select_function ( expressions_list parameters , SymbolInfo functions , location loc , List < SyntaxTree . expression > syntax_nodes_parameters = null ) + public class convertion_data_and_alghoritms + namespace PascalABCCompiler . TreeConverter + + + + + + + + + + \codecompletion\domconverter.cs + if (pattern != null || pattern != "") + + public SymInfo [ ] GetTypeByPattern ( string pattern , int line , int col , bool all_names , int nest_level ) + public class DomConverter + namespace CodeCompletion + + + + + + \visualplugins\languageconverter\source\textformatter.cs + _word.Replace(specSymbol, ""); + + public string FormatWordWithKeyWord ( string _word , object _node ) + public class TextFormatter + namespace Converter + + + + + + \visualpascalabcnet\formsdesignerbinding\dependecies\src\main\base\project\src\services\refactoringservice\refactoringservice.cs + result.OrderBy(node => node.Content.FullyQualifiedName); + + static IEnumerable < ITreeNode < IClass > > FindDerivedClassesTree ( IClass baseClass , IEnumerable < IProjectContent > projectContents , HashSet < IClass > seenClasses ) + public static class RefactoringService + namespace ICSharpCode . SharpDevelop . Refactoring + + + + + + + + \treeconverter\treeconversion\syntax_tree_visitor.cs + if (_pascal_set_constant.values != null && _pascal_set_constant.values != null) + + public override void visit ( SyntaxTree . pascal_set_constant _pascal_set_constant ) + public class syntax_tree_visitor : SyntaxTree . AbstractVisitor + namespace PascalABCCompiler . TreeConverter + + + + + + \visualpascalabcnet\workbench\runnermanagerhandlers.cs + if (File.Exists(pdbFileName) && File.Exists(pdbFileName)) + + void WaitCallback_DeleteEXEAndPDB ( object state ) + public partial class WorkbenchRunService : VisualPascalABCPlugins . IWorkbenchRunService + namespace VisualPascalABC + + + + + + \visualpascalabcnet\formsdesignerbinding\dependecies\src\main\base\project\src\editor\codecompletion\nrefactoryinsightwindowhandler.cs + Вот здесь то место, где не учитывается один вариант открывающих скобок +Вместо одного из openBracketToken нужно написать openBracesToken + if (token.Kind == openParensToken || token.Kind == openBracketToken || token.Kind == openBracketToken) { + + public void InitializeOpenedInsightWindow ( ITextEditor editor , IInsightWindow insightWindow ) + public class NRefactoryInsightWindowHandler : IInsightWindowHandler + namespace ICSharpCode . SharpDevelop . Editor . CodeCompletion + + + + + + + + + + \treeconverter\systemlib\static_executors.cs + if (value >= int.MinValue && value <= int.MaxValue) + + private static int check_int_overflow ( location loc , int value ) + public static class static_executors + namespace PascalABCCompiler . SystemLibrary + + + + + + \treeconverter\systemlib\static_executors.cs + if (value >= long.MinValue && value <= long.MaxValue) + + private static long check_long_overflow ( location loc , long value ) + public static class static_executors + namespace PascalABCCompiler . SystemLibrary + + + + + + \NETGenerator\NETGenerator.cs + if (pos <= 255) il.Emit(OpCodes.Starg_S, pos); + + private void ConvertInc ( IExpressionNode e ) + public class ILConverter : AbstractVisitor + namespace PascalABCCompiler . NETGenerator + + + + + + \NETGenerator\NETGenerator.cs + if (pos <= 255) il.Emit(OpCodes.Starg_S, pos); + + private void ConvertDec ( IExpressionNode e ) + public class ILConverter : AbstractVisitor + namespace PascalABCCompiler . NETGenerator + + + + + + \NETGenerator\NETGenerator.cs + if (pos <= 255) il.Emit(OpCodes.Ldarga_S, pos); + + private void AddrOfParameterNode ( ICommonParameterReferenceNode value ) + public class ILConverter : AbstractVisitor + namespace PascalABCCompiler . NETGenerator + + + + + + + + \codecompletion\findreferences.cs + Двумя строчками ниже +(Здесь сказывается недостаток моего инструмента - если в методе есть две одинаковые строчки - переход осуществляется только на первую, а надо на вторую) + if (ret_tn != null) + + public override void visit ( indexer _indexer ) + public class ReferenceFinder : AbstractVisitor + namespace CodeCompletion + + + + + + \parsertools\syntaxtreevisitors\syntaxtreecomparer.cs + 597 и 631 строки в текущей версии + else if (left is int64_const) + + public void CompareInternal ( expression left , expression right ) + public class SyntaxTreeComparer + namespace PascalABCCompiler . SyntaxTree + + + + + + \parsertools\syntaxtreevisitors\syntaxtreecomparer.cs + 1599 +1611 +1615 строки + else if (left is case_node) + + public void CompareInternal ( statement left , statement right ) + public class SyntaxTreeComparer + namespace PascalABCCompiler . SyntaxTree + + + + + + + + + + \TreeConverter\TreeConversion\syntax_tree_visitor.cs + expression_node bfcint = make_read_call(si, _method_call.parameters, subloc2); + + internal void visit_method_call ( SyntaxTree . method_call _method_call ) + public class syntax_tree_visitor : SyntaxTree . AbstractVisitor + namespace PascalABCCompiler . TreeConverter + + + + + + \TreeConverter\TreeConversion\syntax_tree_visitor.cs + + private expression_node make_read_call ( SymbolInfo si , SyntaxTree . expression_list parameters , location loc ) + public class syntax_tree_visitor : SyntaxTree . AbstractVisitor + namespace PascalABCCompiler . TreeConverter + + + + + + \TreeConverter\TreeConversion\syntax_tree_visitor.cs + Это - непонятное место из-за которого происходит ошибка + readln_string_file = true; + + private expression_node make_read_call ( SymbolInfo si , SyntaxTree . expression_list parameters , location loc ) + public class syntax_tree_visitor : SyntaxTree . AbstractVisitor + namespace PascalABCCompiler . TreeConverter + + + + + + \TreeConverter\TreeConversion\syntax_tree_visitor.cs + if (!readln_string_file) + + private expression_node make_read_call ( SymbolInfo si , SyntaxTree . expression_list parameters , location loc ) + public class syntax_tree_visitor : SyntaxTree . AbstractVisitor + namespace PascalABCCompiler . TreeConverter + + + + + + + + @@ -616,263 +868,8 @@ - - - - \codecompletion\domconverter.cs - if (pattern != null || pattern != "") - - public SymInfo [ ] GetTypeByPattern ( string pattern , int line , int col , bool all_names , int nest_level ) - public class DomConverter - namespace CodeCompletion - - - - - - \visualplugins\languageconverter\source\textformatter.cs - _word.Replace(specSymbol, ""); - - public string FormatWordWithKeyWord ( string _word , object _node ) - public class TextFormatter - namespace Converter - - - - - - \visualpascalabcnet\formsdesignerbinding\dependecies\src\main\base\project\src\services\refactoringservice\refactoringservice.cs - result.OrderBy(node => node.Content.FullyQualifiedName); - - static IEnumerable < ITreeNode < IClass > > FindDerivedClassesTree ( IClass baseClass , IEnumerable < IProjectContent > projectContents , HashSet < IClass > seenClasses ) - public static class RefactoringService - namespace ICSharpCode . SharpDevelop . Refactoring - - - - - - - - \treeconverter\treeconversion\syntax_tree_visitor.cs - if (_pascal_set_constant.values != null && _pascal_set_constant.values != null) - - public override void visit ( SyntaxTree . pascal_set_constant _pascal_set_constant ) - public class syntax_tree_visitor : SyntaxTree . AbstractVisitor - namespace PascalABCCompiler . TreeConverter - - - - - - \visualpascalabcnet\workbench\runnermanagerhandlers.cs - if (File.Exists(pdbFileName) && File.Exists(pdbFileName)) - - void WaitCallback_DeleteEXEAndPDB ( object state ) - public partial class WorkbenchRunService : VisualPascalABCPlugins . IWorkbenchRunService - namespace VisualPascalABC - - - - - - \visualpascalabcnet\formsdesignerbinding\dependecies\src\main\base\project\src\editor\codecompletion\nrefactoryinsightwindowhandler.cs - Вот здесь то место, где не учитывается один вариант открывающих скобок -Вместо одного из openBracketToken нужно написать openBracesToken - if (token.Kind == openParensToken || token.Kind == openBracketToken || token.Kind == openBracketToken) { - - public void InitializeOpenedInsightWindow ( ITextEditor editor , IInsightWindow insightWindow ) - public class NRefactoryInsightWindowHandler : IInsightWindowHandler - namespace ICSharpCode . SharpDevelop . Editor . CodeCompletion - - - - - - - - - - \treeconverter\systemlib\static_executors.cs - if (value >= int.MinValue && value <= int.MaxValue) - - private static int check_int_overflow ( location loc , int value ) - public static class static_executors - namespace PascalABCCompiler . SystemLibrary - - - - - - \treeconverter\systemlib\static_executors.cs - if (value >= long.MinValue && value <= long.MaxValue) - - private static long check_long_overflow ( location loc , long value ) - public static class static_executors - namespace PascalABCCompiler . SystemLibrary - - - - - - \NETGenerator\NETGenerator.cs - if (pos <= 255) il.Emit(OpCodes.Starg_S, pos); - - private void ConvertInc ( IExpressionNode e ) - public class ILConverter : AbstractVisitor - namespace PascalABCCompiler . NETGenerator - - - - - - \NETGenerator\NETGenerator.cs - if (pos <= 255) il.Emit(OpCodes.Starg_S, pos); - - private void ConvertDec ( IExpressionNode e ) - public class ILConverter : AbstractVisitor - namespace PascalABCCompiler . NETGenerator - - - - - - \NETGenerator\NETGenerator.cs - if (pos <= 255) il.Emit(OpCodes.Ldarga_S, pos); - - private void AddrOfParameterNode ( ICommonParameterReferenceNode value ) - public class ILConverter : AbstractVisitor - namespace PascalABCCompiler . NETGenerator - - - - - - - - \codecompletion\findreferences.cs - Двумя строчками ниже -(Здесь сказывается недостаток моего инструмента - если в методе есть две одинаковые строчки - переход осуществляется только на первую, а надо на вторую) - if (ret_tn != null) - - public override void visit ( indexer _indexer ) - public class ReferenceFinder : AbstractVisitor - namespace CodeCompletion - - - - - - \parsertools\syntaxtreevisitors\syntaxtreecomparer.cs - 597 и 631 строки в текущей версии - else if (left is int64_const) - - public void CompareInternal ( expression left , expression right ) - public class SyntaxTreeComparer - namespace PascalABCCompiler . SyntaxTree - - - - - - \parsertools\syntaxtreevisitors\syntaxtreecomparer.cs - 1599 -1611 -1615 строки - else if (left is case_node) - - public void CompareInternal ( statement left , statement right ) - public class SyntaxTreeComparer - namespace PascalABCCompiler . SyntaxTree - - - - - - - - - - \TreeConverter\TreeConversion\syntax_tree_visitor.cs - expression_node bfcint = make_read_call(si, _method_call.parameters, subloc2); - - internal void visit_method_call ( SyntaxTree . method_call _method_call ) - public class syntax_tree_visitor : SyntaxTree . AbstractVisitor - namespace PascalABCCompiler . TreeConverter - - - - - - \TreeConverter\TreeConversion\syntax_tree_visitor.cs - - private expression_node make_read_call ( SymbolInfo si , SyntaxTree . expression_list parameters , location loc ) - public class syntax_tree_visitor : SyntaxTree . AbstractVisitor - namespace PascalABCCompiler . TreeConverter - - - - - - \TreeConverter\TreeConversion\syntax_tree_visitor.cs - Это - непонятное место из-за которого происходит ошибка - readln_string_file = true; - - private expression_node make_read_call ( SymbolInfo si , SyntaxTree . expression_list parameters , location loc ) - public class syntax_tree_visitor : SyntaxTree . AbstractVisitor - namespace PascalABCCompiler . TreeConverter - - - - - - \TreeConverter\TreeConversion\syntax_tree_visitor.cs - if (!readln_string_file) - - private expression_node make_read_call ( SymbolInfo si , SyntaxTree . expression_list parameters , location loc ) - public class syntax_tree_visitor : SyntaxTree . AbstractVisitor - namespace PascalABCCompiler . TreeConverter - - - - - - - - \treeconverter\treeconversion\syntax_tree_visitor.cs - visit_program_code(_block.program_code); - - public override void visit ( SyntaxTree . block _block ) - public class syntax_tree_visitor : SyntaxTree . AbstractVisitor - namespace PascalABCCompiler . TreeConverter - - - - - - \treeconverter\treeconversion\syntax_tree_visitor.cs - if (lab.is_defined) - - public override void visit ( SyntaxTree . labeled_statement _labeled_statement ) - public class syntax_tree_visitor : SyntaxTree . AbstractVisitor - namespace PascalABCCompiler . TreeConverter - - - - - - \SyntaxVisitors\YieldVisitors\ProcessYieldsCapturedVars.cs - public override void visit(procedure_definition pd) - - public override void visit ( procedure_definition pd ) - public class ProcessYieldCapturedVarsVisitor : BaseChangeVisitor - namespace SyntaxVisitors - - - - \Yield\YieldConversionSyntax\YieldDesugarSyntaxTreeConverter.cs root.visit(new ProcessYieldCapturedVarsVisitor()); @@ -884,6 +881,17 @@ + + \SyntaxVisitors\YieldVisitors\ProcessYieldsCapturedVars.cs + public override void visit(procedure_definition pd) + + public override void visit ( procedure_definition pd ) + public class ProcessYieldCapturedVarsVisitor : BaseChangeVisitor + namespace SyntaxVisitors + + + + @@ -1149,32 +1157,6 @@ - - - - \TreeConverter\TreeConversion\convertion_data_and_alghoritms.cs - return AddError<function_node>(new SeveralFunctionsCanBeCalled(loc,set_of_possible_functions)); - - public function_node select_function ( expressions_list parameters , SymbolInfo functions , location loc , List < SyntaxTree . expression > syntax_nodes_parameters = null ) - public class convertion_data_and_alghoritms - namespace PascalABCCompiler . TreeConverter - - - - - - \TreeConverter\TreeConversion\convertion_data_and_alghoritms.cs - if (funcs.Count == 2) - - public function_node select_function ( expressions_list parameters , SymbolInfo functions , location loc , List < SyntaxTree . expression > syntax_nodes_parameters = null ) - public class convertion_data_and_alghoritms - namespace PascalABCCompiler . TreeConverter - - - - - - @@ -1216,6 +1198,72 @@ + + + + \treeconverter\treeconversion\syntax_tree_visitor.cs + + public override void visit ( SyntaxTree . slice_expr sl ) + public class syntax_tree_visitor : SyntaxTree . AbstractVisitor + namespace PascalABCCompiler . TreeConverter + + + + + + + + + + \TreeConverter\SymbolTable\DSST\SymbolTable.cs + public class DSSymbolTable + + public class DSSymbolTable + namespace SymbolTable + + + + + public List < Scope > ScopeTable + private DSHashTable HashTable + internal bool CaseSensitive + private Scope LastScope + private Scope CurrentScope + public DSSymbolTable ( int hash_size , bool case_sensitive ) + public void Clear ( ) + public LambdaScope CreateLambdaScope ( Scope TopScope ) + public Scope CreateScope ( Scope TopScope ) + public ClassScope CreateClassScope ( Scope TopScope , Scope BaseClass ) + + + + + + + + \treeconverter\treeconversion\syntax_tree_visitor.cs + public override void visit(SyntaxTree.assign _assign) + + public override void visit ( SyntaxTree . assign _assign ) + public class syntax_tree_visitor : SyntaxTree . AbstractVisitor + namespace PascalABCCompiler . TreeConverter + + + + + + \treeconverter\treeconversion\syntax_tree_visitor.cs + public override void visit(SyntaxTree.function_lambda_definition _function_lambda_definition) + + public override void visit ( SyntaxTree . function_lambda_definition _function_lambda_definition ) + public class syntax_tree_visitor : SyntaxTree . AbstractVisitor + namespace PascalABCCompiler . TreeConverter + + + + + + \ No newline at end of file diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 499d0f844..67b26e89c 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.1.0.1291' +!define VERSION '3.1.0.1295' diff --git a/SyntaxVisitors/YieldVisitors/ProcessYieldsCapturedVars.cs b/SyntaxVisitors/YieldVisitors/ProcessYieldsCapturedVars.cs index 62f317476..a12be73bf 100644 --- a/SyntaxVisitors/YieldVisitors/ProcessYieldsCapturedVars.cs +++ b/SyntaxVisitors/YieldVisitors/ProcessYieldsCapturedVars.cs @@ -56,7 +56,7 @@ namespace SyntaxVisitors //PrintInfo = false; } - public override void Enter(syntax_tree_node st) + /*public override void Enter(syntax_tree_node st) { base.Enter(st); countNodesVisited++; @@ -66,7 +66,7 @@ namespace SyntaxVisitors { visitNode = false; // фильтр - куда не заходить } - } + }*/ /*public override void visit(class_members cm) { @@ -367,7 +367,7 @@ namespace SyntaxVisitors { // Объявление функции в классе? var classDef = UpperNode(3) as class_definition; - if ((UpperNode(3) as class_definition) != null) + if (classDef != null) { var td = UpperNode(4) as type_declaration; if (td != null) diff --git a/SyntaxVisitors/YieldVisitors/RenameSameBlockLocalVarsVisitor.cs b/SyntaxVisitors/YieldVisitors/RenameSameBlockLocalVarsVisitor.cs index 049e873d7..a81858601 100644 --- a/SyntaxVisitors/YieldVisitors/RenameSameBlockLocalVarsVisitor.cs +++ b/SyntaxVisitors/YieldVisitors/RenameSameBlockLocalVarsVisitor.cs @@ -68,6 +68,7 @@ namespace SyntaxVisitors { if (!first_time_visit_function_header) // чтобы в лямбдах не заходить в формальные параметры. Во вложенных тоже не зайдёт return; + // SSM переименование формальных параметров (нужно если мы их изменяем внутри) ++CurrentLevel; BlockNamesStack.Add(new Dictionary()); if (fp != null) diff --git a/TestSuite/CompilationSamples/FormsABC.pas b/TestSuite/CompilationSamples/FormsABC.pas index baf3bdacc..8e1be5e06 100644 --- a/TestSuite/CompilationSamples/FormsABC.pas +++ b/TestSuite/CompilationSamples/FormsABC.pas @@ -1,4 +1,4 @@ -// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt) +// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) unit FormsABC; @@ -70,7 +70,7 @@ type /// Кнопка Button = class - private + protected b := new System.Windows.Forms.Button; procedure BClick(sender: Object; e: EventArgs); public @@ -240,6 +240,11 @@ type private function GetText: string; procedure SetText(s: string); + function GetDocumentStream: System.IO.Stream := (f as System.Windows.Forms.WebBrowser).DocumentStream; + procedure SetDocumentStream(s: System.IO.Stream); + begin + (f as System.Windows.Forms.WebBrowser).DocumentStream := s; + end; function GetAddress: string; procedure WBDocumentCompleted(sender: Object; e: WebBrowserDocumentCompletedEventArgs); public @@ -251,6 +256,7 @@ type procedure GoForward; procedure GoHome; property Address: string read GetAddress; + property DocumentStream: System.IO.Stream read GetDocumentStream write SetDocumentStream; end; /// Окно для рисования @@ -998,6 +1004,7 @@ end; constructor WebBrowser.Create(); begin f := new System.Windows.Forms.WebBrowser; + (f as System.Windows.Forms.WebBrowser).ScriptErrorsSuppressed := True; ParentControl.Add(f); CurrentControl := f; (f as System.Windows.Forms.WebBrowser).DocumentCompleted += WBDocumentCompleted; diff --git a/TreeConverter/TreeConversion/motivation.cs b/TreeConverter/TreeConversion/motivation.cs index a5107ae4f..ad73df3d9 100644 --- a/TreeConverter/TreeConversion/motivation.cs +++ b/TreeConverter/TreeConversion/motivation.cs @@ -23,24 +23,29 @@ namespace PascalABCCompiler.TreeConverter _mot = motivation.expression_evaluation; } + /// + /// синоним reset() + /// + public void set_motivation_to_expect_expression_evaluation() + { + _mot=motivation.expression_evaluation; + } + public void set_motivation_to_expect_address() { _mot=motivation.address_reciving; } - public void set_motivation_to_except_semantic_node() + public void set_motivation_to_expect_semantic_node() { _mot=motivation.semantic_node_reciving; } public motivation motivation { - //(ssyy) Darkstar!!! Данный код провоцирует ложные переходы в режиме трассировки! get { - motivation temp=_mot; - _mot=motivation.expression_evaluation; - return temp; + return _mot; } } diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 87884bee0..3aacd5a1f 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -737,7 +737,7 @@ namespace PascalABCCompiler.TreeConverter #endif convertion_data_and_alghoritms.check_node_parser_error(tn); - motivation_keeper.set_motivation_to_except_semantic_node(); + motivation_keeper.set_motivation_to_expect_semantic_node(); return ret.visit(tn); } @@ -1722,7 +1722,10 @@ namespace PascalABCCompiler.TreeConverter public override void visit(SyntaxTree.inherited_message _inherited_message) { //throw new NotSupportedError(get_location(_inherited_message)); - switch (motivation_keeper.motivation) + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); + + switch (mot) { case motivation.expression_evaluation: return_value(inherited_message_value_reciving(_inherited_message)); break; //case motivation.symbol_info_reciving: return_symbol_value(blocks.find(_ident.name));break; @@ -1878,7 +1881,9 @@ namespace PascalABCCompiler.TreeConverter { if (_known_type_ident.type == PascalABCCompiler.SyntaxTree.known_type.string_type) { - switch (motivation_keeper.motivation) + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); + switch (mot) { case motivation.address_reciving: return_value(SystemLibrary.SystemLibrary.string_type); break; case motivation.expression_evaluation: return_value(SystemLibrary.SystemLibrary.string_type); break; @@ -2384,7 +2389,9 @@ namespace PascalABCCompiler.TreeConverter public override void visit(SyntaxTree.inherited_ident _inherited_ident) { inherited_ident_processing = true; - switch (motivation_keeper.motivation) + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); + switch (mot) { case motivation.address_reciving: return_addressed_value(inherited_ident_address_reciving(_inherited_ident)); break; case motivation.expression_evaluation: return_value(inherited_ident_value_reciving(_inherited_ident)); break; @@ -4691,7 +4698,8 @@ namespace PascalABCCompiler.TreeConverter } //throw new ArgumentNullException("test"); - motivation mot = motivation_keeper.motivation; + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); expression_node expr_node = null; expressions_list exprs = new expressions_list(); @@ -8145,8 +8153,8 @@ namespace PascalABCCompiler.TreeConverter foreach (SyntaxTree.expression s_expr in _with_statement.do_with.expressions) { //expression_node expr = ret.visit(s_expr); - motivation mot = motivation_keeper.motivation; - motivation_keeper.set_motivation_to_except_semantic_node(); + var mot = motivation_keeper.motivation; + motivation_keeper.set_motivation_to_expect_semantic_node(); semantic_node sn = ret.visit(s_expr as SyntaxTree.syntax_tree_node); motivation_keeper.reset(); expression_node expr = sn as expression_node; @@ -9225,7 +9233,7 @@ namespace PascalABCCompiler.TreeConverter public override void visit(SyntaxTree.dot_node _dot_node) { - motivation mot = motivation_keeper.motivation; + var mot = motivation_keeper.motivation; SyntaxTree.ident id_left = _dot_node.left as SyntaxTree.ident; SyntaxTree.ident id_right = _dot_node.right as SyntaxTree.ident; if (_dot_node.right is ident_with_templateparams) @@ -9238,6 +9246,7 @@ namespace PascalABCCompiler.TreeConverter visit(dotNodeToVisit); return; } + motivation_keeper.reset(); if (id_left != null) { @@ -14432,7 +14441,8 @@ namespace PascalABCCompiler.TreeConverter return; } - motivation mot = motivation_keeper.motivation; + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); SyntaxTree.ident idi = _indexer.dereferencing_value as SyntaxTree.ident; if (idi != null) { @@ -14559,13 +14569,9 @@ namespace PascalABCCompiler.TreeConverter public override void visit(SyntaxTree.roof_dereference _roof_dereference) { expression_node exp = null; - motivation mot = motivation_keeper.motivation; - /* - if (mot == motivation.address_reciving) - { - tmp = motivation_keeper.motivation; - } - */ + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); + exp = convert_strong(_roof_dereference.dereferencing_value); if (exp is typed_expression) exp = convert_typed_expression_to_function_call(exp as typed_expression); //Check this expression @@ -15472,7 +15478,9 @@ namespace PascalABCCompiler.TreeConverter public override void visit(SyntaxTree.ident _ident) { - switch (motivation_keeper.motivation) + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); + switch (mot) { case motivation.address_reciving: return_addressed_value(ident_address_reciving(_ident)); break; case motivation.expression_evaluation: return_value(ident_value_reciving(_ident)); break; @@ -15496,7 +15504,9 @@ namespace PascalABCCompiler.TreeConverter public override void visit(SyntaxTree.double_const _double_const) { expression_node en = new double_const_node(_double_const.val, get_location(_double_const)); - switch (motivation_keeper.motivation) + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); + switch (mot) { case motivation.address_reciving: throw new CompilerInternalError("Addres reciving from constant"); break; case motivation.expression_evaluation: return_value(en); break; @@ -15535,7 +15545,9 @@ namespace PascalABCCompiler.TreeConverter } */ en = SystemLibrary.static_executors.make_int_const(int32.val, get_location(int32)); - switch (motivation_keeper.motivation) + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); + switch (mot) { case motivation.address_reciving: throw new CompilerInternalError("Addres reciving from constant"); break; case motivation.expression_evaluation: return_value(en); break; @@ -15548,7 +15560,9 @@ namespace PascalABCCompiler.TreeConverter public override void visit(SyntaxTree.int64_const int64) { expression_node en = new long_const_node(int64.val, get_location(int64)); - switch (motivation_keeper.motivation) + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); + switch (mot) { case motivation.address_reciving: throw new CompilerInternalError("Addres reciving from constant"); break; case motivation.expression_evaluation: return_value(en); break; @@ -15564,7 +15578,9 @@ namespace PascalABCCompiler.TreeConverter // :-) //throw new CompilerInternalError("Числа UInt64 доступны только в PascalABC.NET Professional Edition"); expression_node en = new ulong_const_node(uint64.val, get_location(uint64)); - switch (motivation_keeper.motivation) + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); + switch (mot) { case motivation.address_reciving: throw new CompilerInternalError("Addres reciving from constant"); break; case motivation.expression_evaluation: return_value(en); break; @@ -15577,9 +15593,11 @@ namespace PascalABCCompiler.TreeConverter public override void visit(SyntaxTree.bool_const _bool_const) { expression_node en = new bool_const_node(_bool_const.val, get_location(_bool_const)); - switch (motivation_keeper.motivation) + var mot = motivation_keeper.motivation; + motivation_keeper.reset(); + switch (mot) { - case motivation.address_reciving: throw new CompilerInternalError("Address reciving from constant"); break; + case motivation.address_reciving: throw new CompilerInternalError("Address reciving from constant"); case motivation.expression_evaluation: return_value(en); break; case motivation.semantic_node_reciving: return_semantic_value(en); break; } diff --git a/Yield/YieldConversionSyntax/YieldDesugarSyntaxTreeConverter.cs b/Yield/YieldConversionSyntax/YieldDesugarSyntaxTreeConverter.cs index 5d62ea8ac..f2ed9c9b6 100644 --- a/Yield/YieldConversionSyntax/YieldDesugarSyntaxTreeConverter.cs +++ b/Yield/YieldConversionSyntax/YieldDesugarSyntaxTreeConverter.cs @@ -30,7 +30,7 @@ namespace YieldDesugarSyntaxTreeConverter #if DEBUG try { - root.visit(new SimplePrettyPrinterVisitor(@"d:\\zzz1.txt")); + //root.visit(new SimplePrettyPrinterVisitor(@"d:\\zzz1.txt")); } catch { diff --git a/bin/Lib/FormsABC.pas b/bin/Lib/FormsABC.pas index baf3bdacc..8e1be5e06 100644 --- a/bin/Lib/FormsABC.pas +++ b/bin/Lib/FormsABC.pas @@ -1,4 +1,4 @@ -// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt) +// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) unit FormsABC; @@ -70,7 +70,7 @@ type /// Кнопка Button = class - private + protected b := new System.Windows.Forms.Button; procedure BClick(sender: Object; e: EventArgs); public @@ -240,6 +240,11 @@ type private function GetText: string; procedure SetText(s: string); + function GetDocumentStream: System.IO.Stream := (f as System.Windows.Forms.WebBrowser).DocumentStream; + procedure SetDocumentStream(s: System.IO.Stream); + begin + (f as System.Windows.Forms.WebBrowser).DocumentStream := s; + end; function GetAddress: string; procedure WBDocumentCompleted(sender: Object; e: WebBrowserDocumentCompletedEventArgs); public @@ -251,6 +256,7 @@ type procedure GoForward; procedure GoHome; property Address: string read GetAddress; + property DocumentStream: System.IO.Stream read GetDocumentStream write SetDocumentStream; end; /// Окно для рисования @@ -998,6 +1004,7 @@ end; constructor WebBrowser.Create(); begin f := new System.Windows.Forms.WebBrowser; + (f as System.Windows.Forms.WebBrowser).ScriptErrorsSuppressed := True; ParentControl.Add(f); CurrentControl := f; (f as System.Windows.Forms.WebBrowser).DocumentCompleted += WBDocumentCompleted; diff --git a/bin/Lib/PABCRtl.dll b/bin/Lib/PABCRtl.dll index ccdf044a5..1c2a0f859 100644 Binary files a/bin/Lib/PABCRtl.dll and b/bin/Lib/PABCRtl.dll differ