Skip to content

Commit b7837f3

Browse files
committed
Fix TODO in lower_context_for_call
1 parent de292cd commit b7837f3

File tree

3 files changed

+32
-37
lines changed

3 files changed

+32
-37
lines changed

src/lower.c

+2-7
Original file line numberDiff line numberDiff line change
@@ -2417,13 +2417,8 @@ static vcode_type_t lower_param_type(type_t type, class_t class,
24172417

24182418
static vcode_reg_t lower_context_for_call(lower_unit_t *lu, ident_t unit_name)
24192419
{
2420-
// XXX: this should call unit_registery_get_parent
2421-
if (lu->registry != NULL && unit_registry_query(lu->registry, unit_name)) {
2422-
vcode_unit_t vu = unit_registry_get(lu->registry, unit_name);
2423-
2424-
vcode_unit_t context = vcode_unit_context(vu);
2425-
assert(context != NULL);
2426-
2420+
vcode_unit_t context = unit_registry_get_parent(lu->registry, unit_name);
2421+
if (context != NULL) {
24272422
vcode_unit_t ancestor = lu->vunit;
24282423
int hops = 0;
24292424
for (; ancestor && ancestor != context;

test/regress/gold/cover1.xml

+12-12
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,23 @@
109109
<scope name="PROC_CALL_LOCAL" line="105">
110110
<statement hier="WORK.COVER1.TEST_PROC.PROC_CALL_LOCAL" data="1"/>
111111
</scope>
112+
<scope name="_S3" line="106">
113+
<statement hier="WORK.COVER1.TEST_PROC._S3" data="1"/>
114+
</scope>
115+
<scope name="_S4" line="107">
116+
<statement hier="WORK.COVER1.TEST_PROC._S4" data="1"/>
117+
</scope>
118+
<scope name="_S5" line="109">
119+
<statement hier="WORK.COVER1.TEST_PROC._S5" data="1"/>
120+
</scope>
121+
<scope name="_S6" line="111">
122+
<statement hier="WORK.COVER1.TEST_PROC._S6" data="1"/>
123+
</scope>
112124
<scope name="MY_LOCAL_PROCEDURE" line="30">
113125
<scope name="RPT3" line="32">
114126
<statement hier="WORK.COVER1.TEST_PROC.MY_LOCAL_PROCEDURE.RPT3" data="1"/>
115127
</scope>
116128
</scope>
117-
<scope name="_S3" line="106">
118-
<statement hier="WORK.COVER1.TEST_PROC._S3" data="1"/>
119-
</scope>
120129
<scope name="MY_LOCAL_FUNCTION" line="35">
121130
<scope name="RPT4" line="37">
122131
<statement hier="WORK.COVER1.TEST_PROC.MY_LOCAL_FUNCTION.RPT4" data="2"/>
@@ -135,15 +144,6 @@
135144
</scope>
136145
</scope>
137146
</scope>
138-
<scope name="_S4" line="107">
139-
<statement hier="WORK.COVER1.TEST_PROC._S4" data="1"/>
140-
</scope>
141-
<scope name="_S5" line="109">
142-
<statement hier="WORK.COVER1.TEST_PROC._S5" data="1"/>
143-
</scope>
144-
<scope name="_S6" line="111">
145-
<statement hier="WORK.COVER1.TEST_PROC._S6" data="1"/>
146-
</scope>
147147
</scope>
148148
<scope name="MY_GLOBAL_PROCEDURE" line="8">
149149
<scope name="RPT1" line="10">

test/regress/gold/cover15.xml

+18-18
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@
88
<scope name="_S1" line="19">
99
<statement hier="WORK.COVER15._P0._S1" data="1"/>
1010
</scope>
11+
<scope name="_S2" line="20">
12+
<statement hier="WORK.COVER15._P0._S2" data="1"/>
13+
</scope>
14+
<scope name="_S3" line="21">
15+
<statement hier="WORK.COVER15._P0._S3" data="1"/>
16+
</scope>
17+
<scope name="_S4" line="22">
18+
<statement hier="WORK.COVER15._P0._S4" data="1"/>
19+
</scope>
20+
<scope name="_S5" line="23">
21+
<statement hier="WORK.COVER15._P0._S5" data="1"/>
22+
</scope>
23+
<scope name="_S6" line="25">
24+
<statement hier="WORK.COVER15._P0._S6" data="1"/>
25+
</scope>
26+
<scope name="_S7" line="26">
27+
<statement hier="WORK.COVER15._P0._S7" data="1"/>
28+
</scope>
1129
<scope name="CROP_AND_SATURATE_TIME" line="9">
1230
<scope name="_S0" line="11">
1331
<statement hier="WORK.COVER15._P0.CROP_AND_SATURATE_TIME._S0" data="3"/>
@@ -54,24 +72,6 @@
5472
</scope>
5573
</scope>
5674
</scope>
57-
<scope name="_S2" line="20">
58-
<statement hier="WORK.COVER15._P0._S2" data="1"/>
59-
</scope>
60-
<scope name="_S3" line="21">
61-
<statement hier="WORK.COVER15._P0._S3" data="1"/>
62-
</scope>
63-
<scope name="_S4" line="22">
64-
<statement hier="WORK.COVER15._P0._S4" data="1"/>
65-
</scope>
66-
<scope name="_S5" line="23">
67-
<statement hier="WORK.COVER15._P0._S5" data="1"/>
68-
</scope>
69-
<scope name="_S6" line="25">
70-
<statement hier="WORK.COVER15._P0._S6" data="1"/>
71-
</scope>
72-
<scope name="_S7" line="26">
73-
<statement hier="WORK.COVER15._P0._S7" data="1"/>
74-
</scope>
7575
</scope>
7676
</scope>
7777
</scope>

0 commit comments

Comments
 (0)