|
|
@@ -90,7 +90,7 @@ PROCEDURE IsSet(t2, t1: Compiler.RecordPtr): BOOLEAN; FORWARD;
|
|
|
PROCEDURE BaseTypeOf(t2, t1: Compiler.RecordPtr): BOOLEAN; FORWARD;
|
|
|
PROCEDURE CheckAssignable; FORWARD;
|
|
|
PROCEDURE ParseSelector(sel: NodePtr; needVal: BOOLEAN; base: CARDINAL); FORWARD;
|
|
|
-PROCEDURE GetTypeDesc(src: ADDRESS; dest: ADDRESS; mode: CARDINAL); FORWARD;
|
|
|
+PROCEDURE GetTypeDesc(t: RecordPtr; lo: ADDRESS; hi: ADDRESS); FORWARD;
|
|
|
PROCEDURE CheckAssignmentCompat(dst: ADDRESS); FORWARD;
|
|
|
|
|
|
(* EXPRESS group 1 — descriptors, predicates, const-fold, designator base, selector *)
|
|
|
@@ -1550,33 +1550,36 @@ BEGIN
|
|
|
curDesc^.typ := Compiler.BooleanType; (* BOOLEAN result *) (*{13df-13e2} *)
|
|
|
END ParseExpression;
|
|
|
|
|
|
+(* proc13 @164b — ~GetConstVal: check constant context, drop pending load. *)
|
|
|
PROCEDURE GetConstVal;
|
|
|
BEGIN
|
|
|
- BoolCondHelper; (* proc12 *) (*{13f5}*)
|
|
|
- IF curDesc^.mode # 0 THEN Errors.ReportError(25) END; (*{13f6-13fb}*)
|
|
|
- CodeGen.DiscardPending; (*{13fc-13fe}*)
|
|
|
+ BoolCondHelper; (* proc12 *)
|
|
|
+ CentralError(curDesc^.mode = 0, 25);
|
|
|
+ CodeGen.DiscardPending;
|
|
|
END GetConstVal;
|
|
|
|
|
|
-PROCEDURE GetTypeDesc(src: ADDRESS; dest: ADDRESS; mode: CARDINAL);
|
|
|
+(* proc14 @1658 — ~GetTypeDesc: read subrange bound(s) of type t into
|
|
|
+ lo/hi buffers (called from PASS1 declarations; no internal callers).
|
|
|
+ Buffers are plain ADDRESS derefs (no view pun). *)
|
|
|
+PROCEDURE GetTypeDesc(t: RecordPtr; lo: ADDRESS; hi: ADDRESS);
|
|
|
BEGIN
|
|
|
- GetConstVal; (* proc13 *) (*{1402}*)
|
|
|
- EmitOp(); (* proc6 *) (*{1403}*)
|
|
|
- ConstToCard(src, 0); (* proc7 *) (*{1404-1406} FIXME: (c,errPos) vs call shape *)
|
|
|
- PopExprDesc(src); (* proc5 FIXME: DescPtr vs ADDRESS *)
|
|
|
- IF (curDesc^.typ # Compiler.CardType) OR (curDesc^.value < 0) THEN
|
|
|
- Errors.ReportError(80); (*{1409-1416} *)
|
|
|
- END;
|
|
|
- Words(dest)^[0] := curDesc^.value; (*{1417-141e} FIXME pun *)
|
|
|
- IF Scanner.AcceptSy(4) THEN (* ',' second bound *) (*{141f-1422}*)
|
|
|
- GetConstVal; (*{1424}*)
|
|
|
- EmitOp(); (*{1426}*)
|
|
|
- ConstToCard(src, 0); (*{1427-0429} *)
|
|
|
- PopExprDesc(src); (*{042a} *)
|
|
|
- IF (curDesc^.typ # Compiler.CardType) OR (curDesc^.value < 0) THEN
|
|
|
- Errors.ReportError(80); (*{142b-1438} *)
|
|
|
- END;
|
|
|
- IF curDesc^.value < Words(dest)^[0] THEN Errors.ReportError(46) END; (*{143a-1440} FIXME *)
|
|
|
- Words(dest)^[0] := curDesc^.value; (*{1441-1444} upper bound *)
|
|
|
+ GetConstVal; (* proc13 *)
|
|
|
+ Proc6;
|
|
|
+ ConstToCard(t, 0); (* proc7 *)
|
|
|
+ PopExprDesc(t); (* proc5 *)
|
|
|
+ CentralError((RecordPtr(curDesc^.typ) <> Compiler.CardType)
|
|
|
+ OR (INTEGER(curDesc^.value) >= 0), 80);
|
|
|
+ lo^ := CARDINAL(curDesc^.value);
|
|
|
+ hi^ := lo^;
|
|
|
+ IF Scanner.AcceptSy(4) THEN (* ',' second bound *)
|
|
|
+ GetConstVal;
|
|
|
+ Proc6;
|
|
|
+ ConstToCard(t, 0);
|
|
|
+ PopExprDesc(t);
|
|
|
+ CentralError((RecordPtr(curDesc^.typ) <> Compiler.CardType)
|
|
|
+ OR (INTEGER(curDesc^.value) >= 0), 80);
|
|
|
+ CentralError(INTEGER(curDesc^.value) >= INTEGER(lo^), 46);
|
|
|
+ hi^ := CARDINAL(curDesc^.value);
|
|
|
END;
|
|
|
END GetTypeDesc;
|
|
|
|