@@ -435,6 +435,24 @@ implementation
435435 function parse_branch_cond (has_subject:boolean;subject:tnode) : tnode;
436436 { Parse pattern(s) for a branch. Subject mode supports comma-separated
437437 patterns (OR'd) and tuple patterns with _ wildcards. }
438+
439+ { equality check, or range check if `..` follows }
440+ function build_match_cond (subj,lo:tnode):tnode;
441+ var
442+ hi : tnode;
443+ begin
444+ if try_to_consume(_POINTPOINT) then
445+ begin
446+ hi:=comp_expr([ef_accept_equal]);
447+ do_typecheckpass(hi);
448+ result:=caddnode.create(andn,
449+ caddnode.create(gten,subj.getcopy,lo),
450+ caddnode.create(lten,subj.getcopy,hi));
451+ end
452+ else
453+ result:=caddnode.create(equaln,subj.getcopy,lo);
454+ end ;
455+
438456 var
439457 pat,cond : tnode;
440458 fields : array of tnode;
@@ -510,13 +528,13 @@ assigned(subject.resultdef) and (subject.resultdef.typ=recorddef) a
510528 do_typecheckpass(pat);
511529 if has_subject then
512530 begin
513- result:=caddnode.create(equaln, subject.getcopy ,pat);
531+ result:=build_match_cond( subject,pat);
514532 while try_to_consume(_COMMA) do
515533 begin
516534 pat:=comp_expr([ef_accept_equal]);
517535 do_typecheckpass(pat);
518536 result:=caddnode.create(orn,result,
519- caddnode.create(equaln, subject.getcopy ,pat));
537+ build_match_cond( subject,pat));
520538 end ;
521539 end
522540 else
0 commit comments