This commit is contained in:
Ivan Bondarev 2021-12-12 15:26:45 +01:00
parent b845735c07
commit c95fa10824
3 changed files with 29 additions and 9 deletions

View file

@ -1,4 +1,5 @@
var a : 1..4;
var
a: 1..4;
begin
a := 2;

6
TestSuite/diapasons4.pas Normal file
View file

@ -0,0 +1,6 @@
begin
var r := 1..2;
assert(r <> nil);
r := nil;
assert(r = nil);
end.

View file

@ -637,7 +637,20 @@ 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);
static function operator=(r1,r2: IntRange): boolean;
begin
var o1: object := r1;
var o2: object := r2;
if (o1 = nil) and (o2 = nil) then
Result := true
else if (o1 <> nil) and (o2 = nil) then
Result := false
else if (o1 = nil) and (o2 <> nil) then
Result := false
else
Result := (r1.l = r2.l) and (r1.h = r2.h);
end;
/// Возвращает True если диапазон пуст
function IsEmpty: boolean := l>h;