A ImportList.T
is a set of interface names. The procedure
Get
generates such a list. It takes a Type.Object
and looks
at all its components to construct a list of all necessary
imports to represent the type in a Modula-3 program.
A procedure Add
can be used to add other interfaces to the
list. ToText
produces a comma separated list of all
interface names (useful for IMPORT
statements).
INTERFACEImportList ; IMPORT Atom, Type; TYPE T <: REFANY; MethodList = REF ARRAY OF Method; Method = RECORD name: Atom.T; sig : Type.Signature END; PROCEDURE FromType (type: Type.Object; methods: MethodList): T;
Generate a new import list. Look for fields intype
and for signature of methods inmethods
.
PROCEDURE Add (importList: T; intf: Atom.T);
Add the interface nameintf
toimportList
. This is a no-op ifintf
is already in the list
PROCEDURE ToText (imports: T): TEXT;
Generate a comma separated list of interface names out ofimports
. The output is suitable for anIMPORT
statement.
END ImportList.