Разрешил методам расширения строк менять строки
This commit is contained in:
parent
fa93d77b30
commit
cbda5e6465
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
%COREVERSION%=0
|
||||
%REVISION%=2352
|
||||
%MINOR%=6
|
||||
%REVISION%=2355
|
||||
%COREVERSION%=0
|
||||
%MAJOR%=3
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
3.6.0.2352
|
||||
3.6.0.2355
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
!define VERSION '3.6.0.2352'
|
||||
!define VERSION '3.6.0.2355'
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
10
TestSuite/StringExtChange.pas
Normal file
10
TestSuite/StringExtChange.pas
Normal file
|
|
@ -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.
|
||||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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-методов в интерфейсной части модуля недопустимо
|
||||
|
|
|
|||
Loading…
Reference in a new issue