This commit is contained in:
Mikhalkovich Stanislav 2019-07-01 17:09:38 +03:00
parent 818bd7acd6
commit 323ba75b89
9 changed files with 58 additions and 7 deletions

View file

@ -15,7 +15,7 @@ internal static class RevisionClass
public const string Major = "3";
public const string Minor = "5";
public const string Build = "0";
public const string Revision = "2166";
public const string Revision = "2169";
public const string MainVersion = Major + "." + Minor;
public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision;

View file

@ -1,4 +1,4 @@
%COREVERSION%=0
%REVISION%=2166
%MINOR%=5
%REVISION%=2169
%COREVERSION%=0
%MAJOR%=3

View file

@ -1 +1 @@
!define VERSION '3.5.0.2166'
!define VERSION '3.5.0.2169'

View file

@ -901,6 +901,8 @@ procedure WritelnFormat(f: Text; formatstr: string; params args: array of object
///- procedure Print(a,b,...);
/// Выводит значения a,b,... на экран, после каждого значения выводит пробел
procedure Print(o: object);
///--
procedure Print(s: string);
///--
procedure Print(params args: array of object);
@ -6126,6 +6128,14 @@ begin
else Write(s)
end;
procedure Print(o: object);
begin
if PrintDelimDefault<>'' then
Write(o, PrintDelimDefault)
else
Write(o)
end;
procedure Print(params args: array of object);
begin
if args.Length = 0 then

View file

@ -0,0 +1,10 @@
function f: integer;
begin
result := 1;
end;
begin
var a: integer;
a := f + nil;
Print(a);
end.

View file

@ -1099,7 +1099,13 @@ namespace PascalABCCompiler.TreeConverter
else
{
ptc = type_table.get_convertions(factparams[i].type, formal_param_type);
if (ptc.first==null)
if (factparams[i] is null_const_node && !type_table.is_with_nil_allowed(formal_param_type) && !formal_param_type.IsPointer) // SSM 01.07.19 - nil не может быть преобразована за счёт вызова функции
{
ptc.first = null;
}
if (ptc.first==null)
{
if (type_table.is_derived(formal_param_type, factparams[i].type))
{

View file

@ -1082,6 +1082,7 @@ namespace PascalABCCompiler.TreeConverter
throw new CompilerInternalError("Invalid operator name");
}
#endif
// Видимо, это сделано для присваивания, т.к. несимметрично. Но странно - f = nil должно возвращать boolean !
if (right.semantic_node_type == semantic_node_type.null_const_node)
{
if ( !type_table.is_with_nil_allowed(left.type) && !left.type.IsPointer)
@ -1089,6 +1090,13 @@ namespace PascalABCCompiler.TreeConverter
right = null_const_node.get_const_node_with_type(left.type, (null_const_node)right);
}
/*if (left.semantic_node_type == semantic_node_type.null_const_node)
{
if (!type_table.is_with_nil_allowed(right.type) && !right.type.IsPointer)
AddError(left.location, "NIL_WITH_VALUE_TYPES_NOT_ALLOWED");
left = null_const_node.get_const_node_with_type(right.type, (null_const_node)left);
}*/
type_node left_type = left.type;
type_node right_type = right.type;
@ -1136,6 +1144,7 @@ namespace PascalABCCompiler.TreeConverter
if (name == "+" && right_type != SystemLibrary.SystemLibrary.string_type && left_type == SystemLibrary.SystemLibrary.char_type)
no_search_in_extension_methods = false;
sil2 = right_type.find_in_type(name, right_type.Scope, null, no_search_in_extension_methods);
if ((sil != null) && (sil2 != null))
{
//Важная проверка. Возможно один и тот же оператор с одними и теми же типами определен в двух разных классах.
@ -1288,6 +1297,8 @@ namespace PascalABCCompiler.TreeConverter
}
// После этой точки right_type и left_type не используются!
expressions_list pars = null;
function_node fnsel = null;
if (sil != null)

View file

@ -196,6 +196,9 @@ namespace PascalABCCompiler.TreeRealization
}
}
/// <summary>
/// В частности, процедурная переменная
/// </summary>
public virtual bool IsDelegate
{
get
@ -4259,8 +4262,9 @@ namespace PascalABCCompiler.TreeRealization
}
}
//Псевдотип. Не идет в выходное дерево. Используется как промежуточный при работе с делегатами.
/// <summary>
/// Псевдотип. Не идет в выходное дерево. Используется как промежуточный при работе с делегатами. Этому типу принадлежат имена функций
/// </summary>
[Serializable]
public class delegated_methods : wrapped_type
{

View file

@ -901,6 +901,8 @@ procedure WritelnFormat(f: Text; formatstr: string; params args: array of object
///- procedure Print(a,b,...);
/// Выводит значения a,b,... на экран, после каждого значения выводит пробел
procedure Print(o: object);
///--
procedure Print(s: string);
///--
procedure Print(params args: array of object);
@ -6126,6 +6128,14 @@ begin
else Write(s)
end;
procedure Print(o: object);
begin
if PrintDelimDefault<>'' then
Write(o, PrintDelimDefault)
else
Write(o)
end;
procedure Print(params args: array of object);
begin
if args.Length = 0 then