From cbda5e64652d9bbad9da53577be6069b207ca18f Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Thu, 20 Feb 2020 16:37:46 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B7=D1=80=D0=B5=D1=88=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=B0=D0=BC=20=D1=80?= =?UTF-8?q?=D0=B0=D1=81=D1=88=D0=B8=D1=80=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=81?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=BA=20=D0=BC=D0=B5=D0=BD=D1=8F=D1=82=D1=8C?= =?UTF-8?q?=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 4 ++-- Localization/DefaultLang.resources | Bin 92033 -> 92060 bytes Release/pabcversion.txt | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- .../CompilationSamples/PABCExtensions.pas | 8 ++++---- TestSuite/StringExtChange.pas | 10 ++++++++++ .../TreeConversion/syntax_tree_visitor.cs | 3 ++- bin/Lib/PABCExtensions.pas | 8 ++++---- bin/Lib/PABCSystem.pas | 11 +++++------ bin/Lib/__RedirectIOMode.pas | 2 ++ bin/Lib/__RunMode.pas | 4 +++- bin/Lng/Rus/SemanticErrors_ib.dat | 2 +- 13 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 TestSuite/StringExtChange.pas diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index ae81fcd83..c16b962e2 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 = "6"; public const string Build = "0"; - public const string Revision = "2352"; + public const string Revision = "2355"; 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 7c425d8f9..8e9373dc9 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%COREVERSION%=0 -%REVISION%=2352 %MINOR%=6 +%REVISION%=2355 +%COREVERSION%=0 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index 0fa83199e18b985c890dbe64e607004de551570b..9d20a1fd8697b5d0cd057e7cfd458e53c1589995 100644 GIT binary patch delta 47 zcmV+~0MP$|&jp;%1(4tYxUu0fgc~5|;2`Mn>g)dZ>%>!@8BSFbaH8KXR{N9 FZsMg<9HIaK delta 23 fcmbPpp0)8j>x2i4b2mOTYMH#KMQF1_Ys@16ix3N) diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index be62b4c43..586f6c5af 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.6.0.2352 +3.6.0.2355 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index f0f36c1eb..78d3d0503 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.6.0.2352' +!define VERSION '3.6.0.2355' diff --git a/TestSuite/CompilationSamples/PABCExtensions.pas b/TestSuite/CompilationSamples/PABCExtensions.pas index b44b09000..e1dedb55b 100644 --- a/TestSuite/CompilationSamples/PABCExtensions.pas +++ b/TestSuite/CompilationSamples/PABCExtensions.pas @@ -265,9 +265,9 @@ end; var __initialized: boolean; -procedure __InitModule; +{procedure __InitModule; begin -end; +end;} procedure __InitModule__; begin @@ -275,10 +275,10 @@ begin begin __initialized := true; __InitPABCSystem; - __InitModule; + //__InitModule; end; end; begin - __InitModule; + //__InitModule; end. \ No newline at end of file diff --git a/TestSuite/StringExtChange.pas b/TestSuite/StringExtChange.pas new file mode 100644 index 000000000..4cf27261a --- /dev/null +++ b/TestSuite/StringExtChange.pas @@ -0,0 +1,10 @@ +procedure p(var Self: string); extensionmethod; +begin + self[1] := self[1].ToUpper; +end; + +begin + var s := 'asd'; + s.p; + Assert(s[1]='A'); +end. \ No newline at end of file diff --git a/TreeConverter/TreeConversion/syntax_tree_visitor.cs b/TreeConverter/TreeConversion/syntax_tree_visitor.cs index 5c9f5ee33..be636bc54 100644 --- a/TreeConverter/TreeConversion/syntax_tree_visitor.cs +++ b/TreeConverter/TreeConversion/syntax_tree_visitor.cs @@ -13791,7 +13791,8 @@ namespace PascalABCCompiler.TreeConverter AddError(get_location(_procedure_attributes_list), "EXTENSION_ATTRIBUTE_ONLY_FOR_NAMESPACE_FUNCTIONS_ALLOWED"); if (context.top_function.parameters.Count == 0) AddError(context.top_function.loc, "EXTENSION_METHODS_MUST_HAVE_LEAST_ONE_PARAMETER"); - if (!context.top_function.IsOperator && context.top_function.parameters[0].parameter_type != SemanticTree.parameter_type.value) + if (!context.top_function.IsOperator && context.top_function.parameters[0].parameter_type != SemanticTree.parameter_type.value + && !(context.top_function.parameters[0].type is compiled_type_node ctn && ctn.compiled_type == typeof(string))) AddError(context.top_function.loc, "FIRST_PARAMETER_SHOULDBE_ONLY_VALUE_PARAMETER"); if (!context.top_function.IsOperator && context.top_function.parameters[0].name.ToLower() != compiler_string_consts.self_word) AddError(context.top_function.loc,"FIRST_PARAMETER_MUST_HAVE_NAME_SELF"); diff --git a/bin/Lib/PABCExtensions.pas b/bin/Lib/PABCExtensions.pas index 82d55fd76..b84bf34f2 100644 --- a/bin/Lib/PABCExtensions.pas +++ b/bin/Lib/PABCExtensions.pas @@ -265,9 +265,9 @@ end; var __initialized: boolean; -procedure __InitModule; +{procedure __InitModule; begin -end; +end;} procedure __InitModule__; begin @@ -275,10 +275,10 @@ begin begin __initialized := true; __InitPABCSystem; - __InitModule; + //__InitModule; end; end; begin - __InitModule; + //__InitModule; end. \ No newline at end of file diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 33a7b8c95..134f0f96d 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -2510,7 +2510,6 @@ implementation var rnd := new System.Random; - // ENCultureInfo: System.Globalization.CultureInfo; nfi: System.Globalization.NumberFormatInfo; LastReadChar := #0; AnsiOrdChrEncoding := Encoding.GetEncoding(1251); @@ -12521,7 +12520,7 @@ begin CommandLineArgs := new string[0]; CurrentIOSystem := new IOStandardSystem; - // ENCultureInfo := new System.Globalization.CultureInfo('en-US'); + var locale: object; var locale_str := 'ru-RU'; if __CONFIG__.TryGetValue('full_locale', locale) then @@ -12544,14 +12543,14 @@ begin // SSM 10/11/18 восстановил эту строку чтобы в главном потоке в вещественных была точка System.Threading.Thread.CurrentThread.CurrentCulture := new System.Globalization.CultureInfo('en-US'); - //rnd := new System.Random; + output := new TextFile(); input := new TextFile(); - //var tmp := __CONFIG__; - if (Environment.OSVersion.Platform = PlatformID.Unix) or (Environment.OSVersion.Platform = PlatformID.MacOSX) then + + {if (Environment.OSVersion.Platform = PlatformID.Unix) or (Environment.OSVersion.Platform = PlatformID.MacOSX) then foreach var listener in System.Diagnostics.Trace.Listeners do if listener is System.Diagnostics.DefaultTraceListener then - (listener as System.Diagnostics.DefaultTraceListener).AssertUiEnabled := true; + (listener as System.Diagnostics.DefaultTraceListener).AssertUiEnabled := true; } StartTime := DateTime.Now; end; diff --git a/bin/Lib/__RedirectIOMode.pas b/bin/Lib/__RedirectIOMode.pas index 682065a20..bfe379f15 100644 --- a/bin/Lib/__RedirectIOMode.pas +++ b/bin/Lib/__RedirectIOMode.pas @@ -131,10 +131,12 @@ begin begin WriteToProcessErrorStream(string.Format(CodePageCommandTemplate, 65001)); // IB 5.08.08 end; + var _a := new string[CommandLineArgs.Length-1]; for var i:=1 to CommandLineArgs.Length - 1 do _a[i-1] := CommandLineArgs[i]; CommandLineArgs := _a; + Console.OutputEncoding := System.Text.Encoding.UTF8; Console.InputEncoding := System.Text.Encoding.UTF8; end; diff --git a/bin/Lib/__RunMode.pas b/bin/Lib/__RunMode.pas index 1f76dabdd..0db0b4244 100644 --- a/bin/Lib/__RunMode.pas +++ b/bin/Lib/__RunMode.pas @@ -1,4 +1,4 @@ -// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) +// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) ///-- unit __RunMode; @@ -42,10 +42,12 @@ begin AppDomain.CurrentDomain.UnhandledException += DbgExceptionHandler; if IsConsoleApplication then Console.Title := ExtractFileName(GetEXEFileName); + var _a := new string[CommandLineArgs.Length-1]; for var i:=1 to CommandLineArgs.Length-1 do _a[i-1] := CommandLineArgs[i]; CommandLineArgs := _a; + end; end; diff --git a/bin/Lng/Rus/SemanticErrors_ib.dat b/bin/Lng/Rus/SemanticErrors_ib.dat index 9d8f37316..9af727883 100644 --- a/bin/Lng/Rus/SemanticErrors_ib.dat +++ b/bin/Lng/Rus/SemanticErrors_ib.dat @@ -102,7 +102,7 @@ OPERATORS_SHOULD_HAVE_1_OR_2_PARAMETERS=Ожидались 1 или 2 парам LEAST_ONE_PARAMETER_TYPE_SHOULD_EQ_DECLARING_TYPE_{0}=Один из параметров должен иметь тип {0} EXTENSION_ATTRIBUTE_ONLY_FOR_NAMESPACE_FUNCTIONS_ALLOWED=Атрибут extensionmethod допустим только для глобальных подпрограмм EXTENSION_METHODS_MUST_HAVE_LEAST_ONE_PARAMETER=Ожидался параметр с именем self, имеющий тип расширяемого типа -FIRST_PARAMETER_SHOULDBE_ONLY_VALUE_PARAMETER=Недопустимо использование var в первом параметре extension-метода +FIRST_PARAMETER_SHOULDBE_ONLY_VALUE_PARAMETER=Недопустимо использование var в первом параметре extension-метода за исключением типа string FIRST_PARAMETER_MUST_HAVE_NAME_SELF=Первый параметр должен иметь имя self EXTENSION_METHODS_FOR_CONSTRUCTED_TYPES_NOT_ALLOWED=Нельзя расширять этот тип EXTENSION_METHODS_IN_INTERFACE_PART_NOT_ALLOWED=Объявление extension-методов в интерфейсной части модуля недопустимо