mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-05 23:22:25 +00:00
fix like 78036911d2
This commit is contained in:
parent
8cec6b3794
commit
9cd018a1f0
2 changed files with 13 additions and 2 deletions
|
|
@ -1215,12 +1215,15 @@ MODULE OPC; (* copyright (c) J. Templ 12.7.95 / 3.7.96 *)
|
|||
END IntLiteral;
|
||||
|
||||
PROCEDURE Len* (obj: OPT.Object; array: OPT.Struct; dim: SYSTEM.INT64);
|
||||
VAR
|
||||
d: SYSTEM.INT64;
|
||||
BEGIN
|
||||
d := dim;
|
||||
WHILE d > 0 DO array := array^.BaseTyp; DEC(d) END;
|
||||
IF array^.comp = OPT.DynArr THEN
|
||||
CompleteIdent(obj); OPM.WriteString(LenExt);
|
||||
IF dim # 0 THEN OPM.WriteInt(dim) END
|
||||
ELSE (* array *)
|
||||
WHILE dim > 0 DO array := array^.BaseTyp; DEC(dim) END;
|
||||
OPM.WriteInt(array.n)
|
||||
END
|
||||
END Len;
|
||||
|
|
|
|||
|
|
@ -208,10 +208,18 @@ MODULE OPV; (* J. Templ 16.2.95 / 3.7.96
|
|||
PROCEDURE^ design(n: OPT.Node; prec: INTEGER);
|
||||
|
||||
PROCEDURE Len(n: OPT.Node; dim: SYSTEM.INT64);
|
||||
VAR
|
||||
d: SYSTEM.INT64; array: OPT.Struct;
|
||||
BEGIN
|
||||
WHILE (n^.class = OPT.Nindex) & (n^.typ^.comp = OPT.DynArr(*26.7.2002*)) DO INC(dim); n := n^.left END ;
|
||||
IF (n^.class = OPT.Nderef) & (n^.typ^.comp = OPT.DynArr) THEN
|
||||
design(n^.left, 10); OPM.WriteString("->len["); OPM.WriteInt(dim); OPM.Write("]")
|
||||
d := dim; array := n^.typ;
|
||||
WHILE d > 0 DO array := array^.BaseTyp; DEC(d) END;
|
||||
IF array^.comp = DynArr THEN
|
||||
design(n^.left, 10); OPM.WriteString("->len["); OPM.WriteInt(dim); OPM.Write("]")
|
||||
ELSE
|
||||
OPM.WriteInt(array^.n); OPM.PromoteIntConstToLInt()
|
||||
END
|
||||
ELSE
|
||||
OPC.Len(n^.obj, n^.typ, dim)
|
||||
END
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue