1 /* ***********************************************************
 2    *                                                         *
 3    * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 4    *                                                         *
 5    * Copyright (c) 1972 by Massachusetts Institute of        *
 6    * Technology and Honeywell Information Systems, Inc.      *
 7    *                                                         *
 8    *********************************************************** */
 9 
10 
11 refer_extent: proc(p,q);
12 
13 dcl       (p,q,r) ptr;
14 dcl       (i,n) fixed bin(15);
15 dcl       null builtin;
16 %include language_utility;
17 %include nodes;
18 %include reference;
19 %include operator;
20 %include op_codes;
21 
22 begin:
23           if p = null then return;
24           if p->node.type = reference_node
25                     then do;
26                               r = p->reference.qualifier;
27                               call refer_extent(r,q);
28                               p->reference.qualifier = r;
29                               r = p->reference.offset;
30                               call refer_extent(r,q);
31                               p->reference.offset = r;
32                               r = p->reference.length;
33                               call refer_extent(r,q);
34                               p->reference.length = r;
35                               return;
36                          end;
37           if p->node.type = operator_node
38                     then do;
39                               if p->op_code = refer
40                               then do;
41                                         p = p->operand(2);
42                                         if p->node.type=token_node
43                                         then      p = create_reference(p);
44                                         if q->node.type=reference_node
45                                         then      if q->reference.shared
46                                                   &  q->reference.qualifier=null
47                                                   &  q->reference.offset=null
48                                                   &  q->reference.length=null
49                                                   then do;
50                                                             p->reference.qualifier = q;
51                                                             return;
52                                                   end;
53 
54                                         p->reference.qualifier = copy_expression((q));
55                                         return;
56                               end;
57 
58                               do i = 1 to p->operator.number;
59                               r = p->operand(i);
60                               call refer_extent(r,q);
61                               p->operand(i) = r;
62                               end;
63                               return;
64                          end;
65           end refer_extent;