Исправлен IsEmpty для ...Range

This commit is contained in:
Mikhalkovich Stanislav 2021-01-28 10:27:53 +03:00
parent dda097d85e
commit b736de6021
8 changed files with 64 additions and 38 deletions

View file

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

View file

@ -1,4 +1,4 @@
%MINOR%=7
%REVISION%=2809
%COREVERSION%=2
%REVISION%=2814
%MINOR%=7
%MAJOR%=3

View file

@ -1 +1 @@
3.7.2.2809
3.7.2.2814

View file

@ -1 +1 @@
!define VERSION '3.7.2.2809'
!define VERSION '3.7.2.2814'

View file

@ -1620,6 +1620,11 @@ begin
var sz := Size(host.DataContext);
if sz.Width = 0 then
sz.Width := GraphWindow.Width;
if sz.Height = 0 then
sz.Height := GraphWindow.Height;
var bmp := new RenderTargetBitmap(Round(sz.Width*scalex), Round(sz.Height*scaley), dpiX, dpiY, PixelFormats.Pbgra32);
var myvis := new DrawingVisual();

View file

@ -625,8 +625,8 @@ type
static function operator in(x: integer; r: IntRange): boolean := (x >= r.l) and (x <= r.h);
static function operator in(x: real; r: IntRange): boolean := (x >= r.l) and (x <= r.h);
static function operator=(r1,r2: IntRange): boolean := (r1.l = r2.l) and (r1.h = r2.h);
function IsEmpty: boolean := l<=h;
/// Возвращает True если диапазон пуст
function IsEmpty: boolean := l>h;
function Step(n: integer): sequence of integer;
function Reverse: sequence of integer;
@ -698,7 +698,8 @@ type
static function operator in(x: char; r: CharRange): boolean := (x >= r.l) and (x <= r.h);
static function operator=(r1,r2: CharRange): boolean := (r1.l = r2.l) and (r1.h = r2.h);
function IsEmpty: boolean := l<=h;
/// Возвращает True если диапазон пуст
function IsEmpty: boolean := l>h;
function Step(n: integer): sequence of char;
function Reverse: sequence of char;
@ -764,7 +765,8 @@ type
static function operator in(x: real; r: RealRange): boolean := (x >= r.l) and (x <= r.h);
static function operator=(r1,r2: RealRange): boolean := (r1.l = r2.l) and (r1.h = r2.h);
function IsEmpty: boolean := l<=h;
/// Возвращает True если диапазон пуст
function IsEmpty: boolean := l>h;
function ToString: string; override := $'{l}..{h}';
function Equals(o: Object): boolean; override;
@ -7844,6 +7846,11 @@ end;
function DeleteFile(fname: string): boolean;
begin
if not &File.Exists(fname) then
begin
Result := False;
exit
end;
try
Result := True;
&File.Delete(fname);

View file

@ -20027,6 +20027,9 @@ namespace PascalABCCompiler.TreeConverter
int err_cnt = ErrorsList.Count;
try
{
expression_node yyy;
if (ff.parameters.expressions.Count > 0)
yyy = convert_strong(ff.parameters.expressions[0]);
qq = convert_strong(ff.dereferencing_value);
if (qq is exit_procedure && stl.list.Count == 1 || qq is local_block_variable_reference && qq.type is compiled_type_node && (qq.type as compiled_type_node).compiled_type == typeof(Action))
{
@ -20141,9 +20144,11 @@ namespace PascalABCCompiler.TreeConverter
var s = new string (' ',ccc)+"begin " + _function_lambda_definition.lambda_name + " " + _function_lambda_definition.parameters.expressions[0] + "\n";
ccc += 2;
System.IO.File.AppendAllText("d:\\bb3.txt", s);
}*/
}*/
#endif
MaybeConvertFunctionLambdaDefinitionToProcedureLambdaDefinition(_function_lambda_definition);
//stl.list[0] = new procedure_call(ff, ff.source_context); - Это надо для превращения функции в процедуру
//_function_lambda_definition.return_type = null;
_function_lambda_definition.RealSemTypeOfResExpr = null; // После первого присваивания Result она будет содержать тип type_node в правой части Result
_function_lambda_definition.RealSemTypeOfResult = null;
@ -20166,11 +20171,29 @@ namespace PascalABCCompiler.TreeConverter
}
return;
}
Func<function_lambda_definition, ident_list, where_definition_list, expression> makeProcedureForLambdaAndVisit = ProcedureForLambdaAndVisit;
// Внутри makeProcedureForLambdaAndVisit делается procdecl или funcdecl и обходится.
// Поэтому формальный параметр обходится точно!!
//Func<function_lambda_definition, ident_list, where_definition_list, expression> makeProcedureForLambdaAndVisit = ProcedureForLambdaAndVisit;
switch (lambdaProcessingState)
{
case LambdaProcessingState.TypeInferencePhase:
{
MaybeConvertFunctionLambdaDefinitionToProcedureLambdaDefinition(_function_lambda_definition);
if (_function_lambda_definition.lambda_visit_mode ==
LambdaVisitMode.VisitForAdvancedMethodCallProcessing)
{
ProcedureForLambdaAndVisit(_function_lambda_definition, null, null);
if (!LambdaHelper.IsAuxiliaryLambdaName(_function_lambda_definition.lambda_name))
{
LambdaHelper.RemoveLambdaInfoFromCompilationContext(context, _function_lambda_definition);
}
}
ret.return_value((semantic_node)LambdaHelper.GetTempFunctionNodeForTypeInference(_function_lambda_definition, this));
break;
}
case LambdaProcessingState.FinishPhase:
{
if (context.top_function != null && context.top_function.generic_params != null)
@ -20205,32 +20228,16 @@ namespace PascalABCCompiler.TreeConverter
}
}
var methodNameToVisit = (ident_with_templateparams)makeProcedureForLambdaAndVisit(_function_lambda_definition, new ident_list(pars), whereSection);
var methodNameToVisit = (ident_with_templateparams)ProcedureForLambdaAndVisit(_function_lambda_definition, new ident_list(pars), whereSection);
_function_lambda_definition.substituting_node = methodNameToVisit;
visit(methodNameToVisit);
}
else
{
var methodNameToVisit = (ident)makeProcedureForLambdaAndVisit(_function_lambda_definition, null, null);
var methodNameToVisit = (ident)ProcedureForLambdaAndVisit(_function_lambda_definition, null, null);
_function_lambda_definition.substituting_node = methodNameToVisit;
visit(methodNameToVisit);
}
break;
}
case LambdaProcessingState.TypeInferencePhase:
{
if (_function_lambda_definition.lambda_visit_mode ==
LambdaVisitMode.VisitForAdvancedMethodCallProcessing)
{
makeProcedureForLambdaAndVisit(_function_lambda_definition, null, null);
if (!LambdaHelper.IsAuxiliaryLambdaName(_function_lambda_definition.lambda_name))
{
LambdaHelper.RemoveLambdaInfoFromCompilationContext(context, _function_lambda_definition);
}
}
ret.return_value((semantic_node)LambdaHelper.GetTempFunctionNodeForTypeInference(_function_lambda_definition, this));
break;
}
case LambdaProcessingState.ClosuresProcessingPhase:
@ -20239,21 +20246,21 @@ namespace PascalABCCompiler.TreeConverter
//var s = "begin "+_function_lambda_definition.lambda_name + " "+ _function_lambda_definition.parameters.expressions[0] + "\n";
//System.IO.File.AppendAllText("d:\\bb17.txt", s);
#endif
makeProcedureForLambdaAndVisit(_function_lambda_definition, null, null);
ProcedureForLambdaAndVisit(_function_lambda_definition, null, null);
LambdaHelper.RemoveLambdaInfoFromCompilationContext(context, _function_lambda_definition);
ret.return_value((semantic_node)LambdaHelper.GetTempFunctionNodeForTypeInference(_function_lambda_definition, this));
break;
}
case LambdaProcessingState.ClosuresProcessingVisitGeneratedClassesPhase:
{
makeProcedureForLambdaAndVisit(_function_lambda_definition, null, null);
ProcedureForLambdaAndVisit(_function_lambda_definition, null, null);
break;
}
case LambdaProcessingState.None:
{
if (context.converting_block() == block_type.namespace_block)
{
var methodNameToVisit = (ident)makeProcedureForLambdaAndVisit(_function_lambda_definition, null, null);
var methodNameToVisit = (ident)ProcedureForLambdaAndVisit(_function_lambda_definition, null, null);
_function_lambda_definition.substituting_node = methodNameToVisit;
visit(methodNameToVisit);
}

View file

@ -625,8 +625,8 @@ type
static function operator in(x: integer; r: IntRange): boolean := (x >= r.l) and (x <= r.h);
static function operator in(x: real; r: IntRange): boolean := (x >= r.l) and (x <= r.h);
static function operator=(r1,r2: IntRange): boolean := (r1.l = r2.l) and (r1.h = r2.h);
function IsEmpty: boolean := l<=h;
/// Возвращает True если диапазон пуст
function IsEmpty: boolean := l>h;
function Step(n: integer): sequence of integer;
function Reverse: sequence of integer;
@ -698,7 +698,8 @@ type
static function operator in(x: char; r: CharRange): boolean := (x >= r.l) and (x <= r.h);
static function operator=(r1,r2: CharRange): boolean := (r1.l = r2.l) and (r1.h = r2.h);
function IsEmpty: boolean := l<=h;
/// Возвращает True если диапазон пуст
function IsEmpty: boolean := l>h;
function Step(n: integer): sequence of char;
function Reverse: sequence of char;
@ -764,7 +765,8 @@ type
static function operator in(x: real; r: RealRange): boolean := (x >= r.l) and (x <= r.h);
static function operator=(r1,r2: RealRange): boolean := (r1.l = r2.l) and (r1.h = r2.h);
function IsEmpty: boolean := l<=h;
/// Возвращает True если диапазон пуст
function IsEmpty: boolean := l>h;
function ToString: string; override := $'{l}..{h}';
function Equals(o: Object): boolean; override;
@ -7844,6 +7846,11 @@ end;
function DeleteFile(fname: string): boolean;
begin
if not &File.Exists(fname) then
begin
Result := False;
exit
end;
try
Result := True;
&File.Delete(fname);