DeferringTypesImpl.mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Last tweaked by Mike Spreitzer December 20, 1991 12:40 pm PST
Laurie Horton, July 20, 1992 10:31 am PDT
DIRECTORY
CCTypes,
CirioTypes USING [CompilerContext, Type],
DeferringTypes;
DeferringTypesImpl: CEDAR PROGRAM
IMPORTS CCTypes
EXPORTS DeferringTypes
SHARES CirioTypes
= BEGIN
CC: TYPE = CirioTypes.CompilerContext;
Type: TYPE = CirioTypes.Type;
CreateDeferringType: PUBLIC PROC [cc: CC] RETURNS [Type] ~ {
dt: Type ← CCTypes.CreateCedarType[$defer, NIL, NIL, cc];
RETURN [dt]};
SetUndertype: PUBLIC PROC [deferring, under: Type] ~ {
IF under=NIL THEN CCTypes.CCError[cirioError, "SetUndertype[.., NIL]"];
IF deferring.procData#NIL THEN CCTypes.CCError[cirioError, "Re-Setting the undertype of a deferring type"];
deferring.procData ← deferring.defaultType ← under;
deferring.indirectType.defaultType ← under.indirectType;
RETURN};
GetUndertype: PUBLIC PROC [deferring: Type] RETURNS [Type] ~ {
RETURN [deferring.defaultType]};
IsDeferring: PUBLIC PROC [t: Type] RETURNS [BOOL] ~ {
RETURN [t.class = $defer]};
UndertypeStar: PUBLIC PROC [deferring: Type] RETURNS [Type] ~ {
IF NOT IsDeferring[deferring] THEN RETURN [deferring];
RETURN [UndertypeStar[GetUndertype[deferring]]]};
Some implementation also exists in CCTypesImpl.Get(TypeClass,ProcDataFromType,DefaultTypeFromType).
END.