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, AtomRefTbl, Type; TYPE T <: AtomRefTbl.Default; MethodList = REF ARRAY OF Method; Method = RECORD name, intf: Atom.T; sig : Type.Signature END; PROCEDURE New (): T; PROCEDURE FromType (type: Type.Object; methods: MethodList): T;
Generate a new import list. Look for fields intypeand for signature of methods inmethods.
PROCEDURE Add (importList: T; intf: Atom.T);
Add the interface nameintftoimportList. This is a no-op ifintfis already in the list
PROCEDURE ToText (imports: T): TEXT;
Generate a comma separated list of interface names out ofimports. The output is suitable for anIMPORTstatement.
END ImportList.