SaffronMakeValueImpl.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Generated by BJackson.pa at April 27, 1987 11:24:14 pm PDT
using ThreeCasabaFour [1.1] of April 14, 1987 6:34:07 pm PDT
DIRECTORY
CedarBaseContext,
SaffronAG3Def,
SaffronAG1Def,
CedarBaseMisc,
CedarBaseTypeAux,
ThreeC4Support,
CedarBaseNarrow,
SaffronATDef,
CedarBaseType,
CedarBaseValue;
SaffronMakeValueImpl: CEDAR PROGRAM IMPORTS CedarBaseContext, CedarBaseMisc, CedarBaseTypeAux, ThreeC4Support, CedarBaseNarrow, CedarBaseType, CedarBaseValue EXPORTS SaffronAG3Def, SaffronAG1Def=
BEGIN
OPEN CedarBaseContext, SaffronAG3Def, SaffronAG1Def, CedarBaseMisc, CedarBaseTypeAux, ThreeC4Support, CedarBaseNarrow, SaffronATDef, CedarBaseType, CedarBaseValue;
ExpidProdMakeValue: PUBLIC PROC[ref: REF ANY, localContext: LocalContext, ribContext: RibContext, typeGraph: TypeGraph, typeIndex: TypeIndex] RETURNS[temp0: Value, temp1: LocalContext, temp2: TypeGraph] =
BEGIN
tree: ExpNode← NARROW[ref];
BEGIN
ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length];
treeData: ExpidProdData ← NARROW[tree.data];
BEGIN
assert4: BOOLEAN;
assert3: BOOLEAN;
assert2: BOOLEAN;
descriptor: Descriptor;
typeNode: TypeNode;
localContext1: LocalContext;
typeGraph1: TypeGraph;
[typeNode, localContext1, typeGraph1] ← FetchType[typeGraph, typeIndex, localContext, ribContext];
IF IsEnumType[typeNode] THEN {BEGIN
ordinalValue: OrdinalValue;
eltList: EltList;
eltList ← EnumTypeEltList[typeNode];
ordinalValue ← EltListLookup[eltList, treeData.id];
IF IsUndefinedOrdinalValue[ordinalValue] THEN {descriptor ← Lookup[ribContext, localContext1, treeData.id];
} ELSE {descriptor ← BuildValueDescriptor[BuildSimpleValue[typeIndex, ordinalValue]];
};
END;
} ELSE {descriptor ← Lookup[ribContext, localContext1, treeData.id];
};
assert2 ← Assert[Not[IsUndefinedDescriptor[descriptor]], "undefined identifier", BotchAction.quit];
assert3 ← Assert[Not[IsInaccessibleDescriptor[descriptor]], "circularly defined value", BotchAction.quit];
assert4 ← Assert[Not[IsTypeDescriptor[descriptor]], "type identifier not allowed", BotchAction.quit];
IF IsSuspendedDescriptor[descriptor] THEN {BEGIN
localContext2: LocalContext;
typeGraph2: TypeGraph;
temp3: DeclarationNode;
temp3 ← NarrowToDeclaration[DescriptorGetDecl[descriptor]];
[localContext2, typeGraph2] ← temp3.procs.ProcessOneDecl[temp3, UndefinedTypeIndex[], localContext1, ribContext, typeGraph1];
[temp0, temp1, temp2] ← tree.procs.MakeValue[tree, localContext2, ribContext, typeGraph2, typeIndex];
END;
} ELSE {temp2 ← XTypeGraph[typeGraph1];
temp1 ← XLocalContext[localContext1];
temp0 ← GetValue[descriptor];
};
END;
END
END;
InitializationassignmentProdMakeValue: PUBLIC PROC[ref: REF ANY, localContext: LocalContext, ribContext: RibContext, typeGraph: TypeGraph, typeIndex: TypeIndex] RETURNS[temp0: Value, temp1: LocalContext, temp2: TypeGraph] =
BEGIN
tree: InitializationNode← NARROW[ref];
BEGIN
ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length];
treeData: InitializationassignmentProdData ← NARROW[tree.data];
temp2 ← XTypeGraph[typeGraph];
temp1 ← XLocalContext[localContext];
temp0 ← BuildVarValue[typeIndex];
END
END;
InitializationbindingProdMakeValue: PUBLIC PROC[ref: REF ANY, localContext: LocalContext, ribContext: RibContext, typeGraph: TypeGraph, typeIndex: TypeIndex] RETURNS[temp0: Value, temp1: LocalContext, temp2: TypeGraph] =
BEGIN
tree: InitializationNode← NARROW[ref];
BEGIN
ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length];
treeData: InitializationbindingProdData ← NARROW[tree.data];
[temp0, temp1, temp2] ← treeData.InitialValue.procs.MakeValue[treeData.InitialValue, localContext, ribContext, typeGraph, typeIndex];
END
END;
InitializationemptyProdMakeValue: PUBLIC PROC[ref: REF ANY, localContext: LocalContext, ribContext: RibContext, typeGraph: TypeGraph, typeIndex: TypeIndex] RETURNS[temp0: Value, temp1: LocalContext, temp2: TypeGraph] =
BEGIN
tree: InitializationNode← NARROW[ref];
BEGIN
ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length];
temp2 ← XTypeGraph[typeGraph];
temp1 ← XLocalContext[localContext];
temp0 ← BuildVarValue[typeIndex];
END
END;
InitialValueexpProdMakeValue: PUBLIC PROC[ref: REF ANY, localContext: LocalContext, ribContext: RibContext, typeGraph: TypeGraph, typeIndex: TypeIndex] RETURNS[temp0: Value, temp1: LocalContext, temp2: TypeGraph] =
BEGIN
tree: InitialValueNode← NARROW[ref];
BEGIN
ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length];
treeData: InitialValueexpProdData ← NARROW[tree.data];
[temp0, temp1, temp2] ← treeData.Exp.procs.MakeValue[treeData.Exp, localContext, ribContext, typeGraph, typeIndex];
END
END;
END..