summaryrefslogtreecommitdiff
path: root/packages/fcl-passrc/src/pasresolver.pp
diff options
context:
space:
mode:
authormattias <mattias@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-10-04 20:33:17 +0000
committermattias <mattias@3ad0048d-3df7-0310-abae-a5850022a9f2>2020-10-04 20:33:17 +0000
commit6bf40eccd5651c77d92b8f8c379da3ca5e6077fc (patch)
tree01db7e4e3564aa34aeff03d714266d3ed221744f /packages/fcl-passrc/src/pasresolver.pp
parent91be962c0c51cf5661d8eb3956caa5c7f2fc6282 (diff)
downloadfpc-6bf40eccd5651c77d92b8f8c379da3ca5e6077fc.tar.gz
fcl-passrc: resolver: case EnumRg of end; issue 37860
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47046 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-passrc/src/pasresolver.pp')
-rw-r--r--packages/fcl-passrc/src/pasresolver.pp45
1 files changed, 14 insertions, 31 deletions
diff --git a/packages/fcl-passrc/src/pasresolver.pp b/packages/fcl-passrc/src/pasresolver.pp
index 4a075ee73c..4cf902c06d 100644
--- a/packages/fcl-passrc/src/pasresolver.pp
+++ b/packages/fcl-passrc/src/pasresolver.pp
@@ -9577,59 +9577,42 @@ type
var ValueSet: TResEvalSet): boolean;
var
CaseExprType: TPasType;
+ bt: TResolverBaseType;
+ ElTypeResolved: TPasResolverResult;
begin
Result:=false;
- if ResolvedEl.BaseType in btAllInteger then
+ bt:=ResolvedEl.BaseType;
+ if bt in btAllStrings then
+ exit(true)
+ else if bt=btRange then
+ bt:=ResolvedEl.SubType;
+ if bt in btAllInteger then
begin
ValueSet:=TResEvalSet.CreateEmpty(revskInt);
Result:=true;
end
- else if ResolvedEl.BaseType in btAllBooleans then
+ else if bt in btAllBooleans then
begin
ValueSet:=TResEvalSet.CreateEmpty(revskBool);
Result:=true;
end
- else if ResolvedEl.BaseType in btAllChars then
+ else if bt in btAllChars then
begin
ValueSet:=TResEvalSet.CreateEmpty(revskChar);
Result:=true;
end
- else if ResolvedEl.BaseType in btAllStrings then
- Result:=true
- else if ResolvedEl.BaseType=btContext then
+ else if bt=btContext then
begin
CaseExprType:=ResolvedEl.LoTypeEl;
if CaseExprType.ClassType=TPasEnumType then
begin
ValueSet:=TResEvalSet.CreateEmpty(revskEnum,CaseExprType);
Result:=true;
- end;
- end
- else if ResolvedEl.BaseType=btRange then
- begin
- if ResolvedEl.SubType in btAllInteger then
- begin
- ValueSet:=TResEvalSet.CreateEmpty(revskInt);
- Result:=true;
end
- else if ResolvedEl.SubType in btAllBooleans then
+ else if CaseExprType.ClassType=TPasRangeType then
begin
- ValueSet:=TResEvalSet.CreateEmpty(revskBool);
- Result:=true;
- end
- else if ResolvedEl.SubType in btAllChars then
- begin
- ValueSet:=TResEvalSet.CreateEmpty(revskChar);
- Result:=true;
- end
- else if ResolvedEl.SubType=btContext then
- begin
- CaseExprType:=ResolvedEl.LoTypeEl;
- if CaseExprType.ClassType=TPasEnumType then
- begin
- ValueSet:=TResEvalSet.CreateEmpty(revskEnum,CaseExprType);
- Result:=true;
- end;
+ ComputeElement(TPasRangeType(CaseExprType).RangeExpr.left,ElTypeResolved,[rcConstant]);
+ Result:=CreateValues(ElTypeResolved,ValueSet);
end;
end;
end;