This commit is contained in:
miks1965 2016-12-12 21:57:41 +03:00
parent 5516a10ce1
commit d676ba3267
12 changed files with 54 additions and 18 deletions

View file

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

View file

@ -1,4 +1,4 @@
%COREVERSION%=0
%REVISION%=1359
%MINOR%=2
%REVISION%=1360
%COREVERSION%=0
%MAJOR%=3

View file

@ -2,7 +2,7 @@
// This CSharp output file generated by Gardens Point LEX
// Version: 1.1.3.301
// Machine: DESKTOP-8EAQPI9
// DateTime: 04.12.2016 9:22:22
// DateTime: 12.12.2016 11:36:35
// UserName: ?????????
// GPLEX input file <ABCPascal.lex>
// GPLEX frame file <embedded resource>

View file

@ -2,7 +2,7 @@
// GPPG version 1.3.6
// Machine: DESKTOP-8EAQPI9
// DateTime: 04.12.2016 9:22:23
// DateTime: 12.12.2016 11:36:36
// UserName: ?????????
// Input file <J:\PascalABC.NET\!PABC_Git\Parsers\PascalABCParserNewSaushkin\ABCPascal.y>

View file

@ -152,5 +152,6 @@ script=

View file

@ -1 +1 @@
!define VERSION '3.2.0.1359'
!define VERSION '3.2.0.1360'

View file

@ -0,0 +1,5 @@
begin
var p: procedure(x: integer);
p := x -> if True then Print(x);
p(666);
end.

View file

@ -0,0 +1,4 @@
begin
foreach var x in ArrGen(5,i->i) do
Print(x);
end.

View file

@ -1500,12 +1500,12 @@ function Length(a: System.Array; dim: integer): integer;
function Copy(a: System.Array): System.Array;
/// Сортирует динамический массив по возрастанию
procedure Sort<T>(a: array of T);
/// Сортирует динамический массив по критерию сортировки, задаваемому функцией сравнения less
procedure Sort<T>(a: array of T; less: (T,T)->boolean);
/// Сортирует динамический массив по критерию сортировки, задаваемому функцией сравнения cmp
procedure Sort<T>(a: array of T; cmp: (T,T)->integer);
/// Сортирует список по возрастанию
procedure Sort<T>(l: List<T>);
/// Сортирует список по критерию сортировки, задаваемому функцией сравнения less
procedure Sort<T>(l: List<T>; less: (T,T)->boolean);
/// Сортирует список по критерию сортировки, задаваемому функцией сравнения cmp
procedure Sort<T>(l: List<T>; cmp: (T,T)->integer);
/// Изменяет порядок элементов в динамическом массиве на противоположный
procedure Reverse<T>(a: array of T);
/// Изменяет порядок элементов на противоположный в диапазоне динамического массива длины length начиная с индекса index
@ -6999,9 +6999,9 @@ begin
System.Array.Sort(a);
end;
procedure Sort<T>(a: array of T; less: (T,T)->boolean);
procedure Sort<T>(a: array of T; cmp: (T,T)->integer);
begin
System.Array.Sort(a,(x,y)->less(y,x)?1:-1);
System.Array.Sort(a,cmp);
end;
procedure Sort<T>(l: List<T>);
@ -7009,9 +7009,9 @@ begin
l.Sort();
end;
procedure Sort<T>(l: List<T>; less: (T,T)->boolean);
procedure Sort<T>(l: List<T>; cmp: (T,T)->integer);
begin
l.Sort((x,y)->less(y,x)?1:-1);
l.Sort(cmp);
end;
procedure Reverse<T>(a: array of T);
@ -9241,7 +9241,7 @@ end;
/// Генерирует последовательность целых от текущего значения до n в убывающем порядке
function &Downto(Self: integer; n: integer): sequence of integer; extensionmethod;
begin
Result := Range(n, Self, -1); // неверно - исправить
Result := Range(Self, n, -1);
end;
/// Возвращает последовательность целых 0,1,...n-1

View file

@ -211,10 +211,13 @@ namespace PascalABCCompiler.TreeConverter
/// </summary>
public static bool TryConvertFuncLambdaBodyWithMethodCallToProcLambdaBody(function_lambda_definition lambdaDef)
{
// SSM 12/12/16 - сделал чтобы всегда эта функция возвращала true.
// Посмотрю далее на её поведение. Мне кажется, что если мы попали сюда, то мы хотим присвоить процедурному типу,
// и в любом случае это надо интерпретировать как процедуру
var stl = lambdaDef.proc_body as SyntaxTree.statement_list;
if (stl.expr_lambda_body)
{
// Очищаем от Result :=
// Очищаем от Result := , который мы создали на предыдущем этапе
var ass = stl.list[0] as assign;
if (ass != null && ass.to is ident && (ass.to as ident).name.ToLower() == "result")
@ -227,10 +230,14 @@ namespace PascalABCCompiler.TreeConverter
lambdaDef.return_type = null;
return true;
}
else
return false;
}
}
return false;
lambdaDef.return_type = null;
return true;
// return false;
}
/// <summary>

View file

@ -19207,11 +19207,30 @@ namespace PascalABCCompiler.TreeConverter
var el = new SyntaxTree.expression_list();
el.Add(new int32_const(situation));
el.Add(sl.from);
var semfrom = convert_strong(sl.from);
var b = convertion_data_and_alghoritms.can_convert_type(semfrom, SystemLibrary.SystemLibrary.integer_type);
if (!b)
AddError(get_location(sl.from), "INTEGER_VALUE_EXPECTED");
el.Add(sl.from); // Это плохо - считается 2 раза. Надо делать semantic_expr_node !!!
var semto = convert_strong(sl.to);
b = convertion_data_and_alghoritms.can_convert_type(semto, SystemLibrary.SystemLibrary.integer_type);
if (!b)
AddError(get_location(sl.to), "INTEGER_VALUE_EXPECTED");
el.Add(sl.to);
if (sl.step != null)
{
var semstep = convert_strong(sl.step);
b = convertion_data_and_alghoritms.can_convert_type(semstep, SystemLibrary.SystemLibrary.integer_type);
if (!b)
AddError(get_location(sl.step), "INTEGER_VALUE_EXPECTED");
el.Add(sl.step);
}
var mc = new method_call(new dot_node(sl.v, new ident("SystemSlice", sl.v.source_context), sl.v.source_context), el, sl.source_context);
visit(mc);

Binary file not shown.