[ooc-compiler] Compiler error
Brought to you by:
mva
|
From: Frank H. <hr...@te...> - 2010-07-07 01:53:58
|
Hi there,
I guess I found a compiler error. I have a module L which implements a
rudimentary list and a module Test which imports L:
MODULE L;
IMPORT Out;
TYPE
Item* = POINTER TO ItemD;
ItemD* = RECORD
next-: Item;
END;
Header* = RECORD
first-, last-: Item;
END;
PROCEDURE IsEmpty* (list:Header): BOOLEAN;
BEGIN RETURN list.first=NIL
END IsEmpty;
PROCEDURE Init* (VAR list:Header);
BEGIN
list.first:= NIL; list.last:= NIL;
Out.String("List initialized"); Out.Ln;
END Init;
END L.
MODULE Test;
IMPORT L, Out;
TYPE
Node = POINTER TO NodeD;
NodeD = RECORD (L.ItemD)
sons-: L.Header;
END;
VAR n1: Node;
PROCEDURE (node:Node) Init;
BEGIN
L.Init (node.sons);
IF ~L.IsEmpty(node.sons) THEN
Out.String("n1.sons not empty!"); Out.Ln;
END
END Init;
BEGIN
NEW (n1);
n1.Init;
END Test.
Executing Test prints the following:
List initialized
n1.sons not empty!
which means that n1.Init didn't change n1. This is an error, isn't it?
If details matter I can tell them (platform, versions etc.).
--
Frank Hrebabetzky
Florianopolis, Brazil
|