-- file P3S.mesa
-- last modified by Satterthwaite, February 22, 1983 9:15 am

DIRECTORY
  P3: TYPE USING [Attr, NPUse, Safety],
  Symbols: TYPE USING [Type, RecordSEIndex, CTXIndex, BTIndex, ContextLevel],
  Tree: TYPE USING [Index, Link];

P3S: DEFINITIONS = {
  OPEN Symbols;
  
 -- shared state variables for pass 3

  BodyData: TYPE = RECORD [	-- shared communication record
    level: Symbols.ContextLevel,	-- current level
    bodyNode: Tree.Index,		-- current body
    argCtx: Symbols.CTXIndex,		-- ctx for inputRecord
    inputRecord: RecordSEIndex,		-- input record for current body
    returnRecord: RecordSEIndex,	-- return record for current body
    entry: BOOL,				-- set for entry procedures
    lockHeld: BOOL,			-- set for entry or internal procedures

    noXfers: BOOL,				-- set by embedded xfer (except return)

    reachable: BOOL,
    labelList: Tree.Link,		-- list of accessible labels
    loopDepth: CARDINAL,		-- depth of loop nesting

    catchDepth: CARDINAL,		-- depth of catch phrase nesting
    unwindEnabled: BOOL,		-- set iff in scope of unwind
    resumeFlag: BOOL,			-- set iff a resume is legal
    resumeRecord: RecordSEIndex];	-- for current catch phrase


  ImplicitInfo: TYPE = RECORD [		-- info about subtree used as an expr
    type: Type,
    tree: Tree.Link,
    attr: P3.Attr];
    
  SelfInfo: TYPE = RECORD [		-- info about x in x.op[args] => op[x, args]
    tree: Tree.Link,
    type: Type,
    attr: P3.Attr,
    np: P3.NPUse];


 -- exported by Pass3S
  
  safety: READONLY P3.Safety;
  currentBody: VAR BodyData;
  currentScope: READONLY BTIndex;
  
 -- exported by Pass3Xa
  
  implicitRecord: VAR RecordSEIndex;	-- type of extraction record
  markCatch: VAR BOOL;			-- reset in Stmt, set in CatchPhrase
  continued: VAR BOOL;
  self: VAR SelfInfo;
  
 -- exported by Pass3Xb
 
  implicit: VAR ImplicitInfo;		-- implied interpretation of Tree.Null
   
  }.