NOTICE: Update author list and years
[nit.git] / c_src / nitc__abstract_compiler.sep.6.c
1 #include "nitc__abstract_compiler.sep.0.h"
2 /* method abstract_compiler#AAttrReassignExpr#stmt for (self: AAttrReassignExpr, AbstractCompilerVisitor) */
3 void nitc__abstract_compiler___AAttrReassignExpr___AExpr__stmt(val* self, val* p0) {
4 val* var_v /* var v: AbstractCompilerVisitor */;
5 val* var /* : AExpr */;
6 val* var2 /* : AExpr */;
7 val* var3 /* : RuntimeVariable */;
8 val* var_recv /* var recv: RuntimeVariable */;
9 val* var4 /* : AExpr */;
10 val* var6 /* : AExpr */;
11 val* var7 /* : RuntimeVariable */;
12 val* var_value /* var value: RuntimeVariable */;
13 val* var8 /* : nullable MAttribute */;
14 val* var10 /* : nullable MAttribute */;
15 val* var_mproperty /* var mproperty: MAttribute */;
16 val* var11 /* : RuntimeVariable */;
17 val* var_attr /* var attr: RuntimeVariable */;
18 val* var12 /* : nullable CallSite */;
19 val* var14 /* : nullable CallSite */;
20 val* var15 /* : Array[RuntimeVariable] */;
21 val* var_ /* var : Array[RuntimeVariable] */;
22 val* var16 /* : nullable RuntimeVariable */;
23 val* var_res /* var res: nullable RuntimeVariable */;
24 short int var17 /* : Bool */;
25 short int var18 /* : Bool */;
26 val* var_other /* var other: nullable Object */;
27 short int var20 /* : Bool */;
28 short int var21 /* : Bool */;
29 var_v = p0;
30 {
31 { /* Inline parser_nodes#AAttrFormExpr#n_expr (self) on <self:AAttrReassignExpr> */
32 var2 = self->attrs[COLOR_nitc__parser_nodes__AAttrFormExpr___n_expr].val; /* _n_expr on <self:AAttrReassignExpr> */
33 if (unlikely(var2 == NULL)) {
34 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _n_expr");
35 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__parser_nodes, 2273);
36 fatal_exit(1);
37 }
38 var = var2;
39 RET_LABEL1:(void)0;
40 }
41 }
42 {
43 var3 = nitc___nitc__AbstractCompilerVisitor___expr(var_v, var, ((val*)NULL));
44 }
45 var_recv = var3;
46 {
47 { /* Inline parser_nodes#AReassignFormExpr#n_value (self) on <self:AAttrReassignExpr> */
48 var6 = self->attrs[COLOR_nitc__parser_nodes__AReassignFormExpr___n_value].val; /* _n_value on <self:AAttrReassignExpr> */
49 if (unlikely(var6 == NULL)) {
50 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _n_value");
51 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__parser_nodes, 2003);
52 fatal_exit(1);
53 }
54 var4 = var6;
55 RET_LABEL5:(void)0;
56 }
57 }
58 {
59 var7 = nitc___nitc__AbstractCompilerVisitor___expr(var_v, var4, ((val*)NULL));
60 }
61 var_value = var7;
62 {
63 { /* Inline typing#AAttrFormExpr#mproperty (self) on <self:AAttrReassignExpr> */
64 var10 = self->attrs[COLOR_nitc__typing__AAttrFormExpr___mproperty].val; /* _mproperty on <self:AAttrReassignExpr> */
65 var8 = var10;
66 RET_LABEL9:(void)0;
67 }
68 }
69 if (unlikely(var8 == NULL)) {
70 PRINT_ERROR("Runtime error: %s", "Cast failed");
71 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__abstract_compiler, 3852);
72 fatal_exit(1);
73 }
74 var_mproperty = var8;
75 {
76 var11 = nitc___nitc__SeparateCompilerVisitor___nitc__abstract_compiler__AbstractCompilerVisitor__read_attribute(var_v, var_mproperty, var_recv);
77 }
78 var_attr = var11;
79 {
80 { /* Inline typing#AReassignFormExpr#reassign_callsite (self) on <self:AAttrReassignExpr> */
81 var14 = self->attrs[COLOR_nitc__typing__AReassignFormExpr___reassign_callsite].val; /* _reassign_callsite on <self:AAttrReassignExpr> */
82 var12 = var14;
83 RET_LABEL13:(void)0;
84 }
85 }
86 if (unlikely(var12 == NULL)) {
87 PRINT_ERROR("Runtime error: %s", "Cast failed");
88 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__abstract_compiler, 3854);
89 fatal_exit(1);
90 }
91 var15 = NEW_core__Array(&type_core__Array__nitc__RuntimeVariable);
92 {
93 core___core__Array___with_capacity(var15, 2l); /* Direct call array#Array#with_capacity on <var15:Array[RuntimeVariable]>*/
94 }
95 var_ = var15;
96 {
97 core___core__AbstractArray___core__abstract_collection__Sequence__push(var_, var_attr); /* Direct call array#AbstractArray#push on <var_:Array[RuntimeVariable]>*/
98 }
99 {
100 core___core__AbstractArray___core__abstract_collection__Sequence__push(var_, var_value); /* Direct call array#AbstractArray#push on <var_:Array[RuntimeVariable]>*/
101 }
102 {
103 var16 = ((val*(*)(val* self, val* p0, val* p1))(var_v->class->vft[COLOR_nitc__abstract_compiler__AbstractCompilerVisitor__compile_callsite]))(var_v, var12, var_); /* compile_callsite on <var_v:AbstractCompilerVisitor>*/
104 }
105 var_res = var16;
106 if (var_res == NULL) {
107 var17 = 0; /* is null */
108 } else {
109 var17 = 1; /* arg is null and recv is not */
110 }
111 if (0) {
112 { /* Inline kernel#Object#!= (var_res,((val*)NULL)) on <var_res:nullable RuntimeVariable> */
113 var_other = ((val*)NULL);
114 {
115 var20 = ((short int(*)(val* self, val* p0))(var_res->class->vft[COLOR_core__kernel__Object___61d_61d]))(var_res, var_other); /* == on <var_res:nullable RuntimeVariable(RuntimeVariable)>*/
116 }
117 var21 = !var20;
118 var18 = var21;
119 goto RET_LABEL19;
120 RET_LABEL19:(void)0;
121 }
122 var17 = var18;
123 }
124 if (unlikely(!var17)) {
125 PRINT_ERROR("Runtime error: %s", "Assert failed");
126 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__abstract_compiler, 3855);
127 fatal_exit(1);
128 }
129 {
130 nitc___nitc__SeparateCompilerVisitor___nitc__abstract_compiler__AbstractCompilerVisitor__write_attribute(var_v, var_mproperty, var_recv, var_res); /* Direct call separate_compiler#SeparateCompilerVisitor#write_attribute on <var_v:AbstractCompilerVisitor>*/
131 }
132 RET_LABEL:;
133 }
134 /* method abstract_compiler#AIssetAttrExpr#expr for (self: AIssetAttrExpr, AbstractCompilerVisitor): nullable RuntimeVariable */
135 val* nitc__abstract_compiler___AIssetAttrExpr___AExpr__expr(val* self, val* p0) {
136 val* var /* : nullable RuntimeVariable */;
137 val* var_v /* var v: AbstractCompilerVisitor */;
138 val* var1 /* : AExpr */;
139 val* var3 /* : AExpr */;
140 val* var4 /* : RuntimeVariable */;
141 val* var_recv /* var recv: RuntimeVariable */;
142 val* var5 /* : nullable MAttribute */;
143 val* var7 /* : nullable MAttribute */;
144 val* var_mproperty /* var mproperty: MAttribute */;
145 val* var8 /* : RuntimeVariable */;
146 var_v = p0;
147 {
148 { /* Inline parser_nodes#AAttrFormExpr#n_expr (self) on <self:AIssetAttrExpr> */
149 var3 = self->attrs[COLOR_nitc__parser_nodes__AAttrFormExpr___n_expr].val; /* _n_expr on <self:AIssetAttrExpr> */
150 if (unlikely(var3 == NULL)) {
151 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _n_expr");
152 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__parser_nodes, 2273);
153 fatal_exit(1);
154 }
155 var1 = var3;
156 RET_LABEL2:(void)0;
157 }
158 }
159 {
160 var4 = nitc___nitc__AbstractCompilerVisitor___expr(var_v, var1, ((val*)NULL));
161 }
162 var_recv = var4;
163 {
164 { /* Inline typing#AAttrFormExpr#mproperty (self) on <self:AIssetAttrExpr> */
165 var7 = self->attrs[COLOR_nitc__typing__AAttrFormExpr___mproperty].val; /* _mproperty on <self:AIssetAttrExpr> */
166 var5 = var7;
167 RET_LABEL6:(void)0;
168 }
169 }
170 if (unlikely(var5 == NULL)) {
171 PRINT_ERROR("Runtime error: %s", "Cast failed");
172 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__abstract_compiler, 3864);
173 fatal_exit(1);
174 }
175 var_mproperty = var5;
176 {
177 var8 = nitc___nitc__SeparateCompilerVisitor___nitc__abstract_compiler__AbstractCompilerVisitor__isset_attribute(var_v, var_mproperty, var_recv);
178 }
179 var = var8;
180 goto RET_LABEL;
181 RET_LABEL:;
182 return var;
183 }
184 /* method abstract_compiler#AVarargExpr#expr for (self: AVarargExpr, AbstractCompilerVisitor): nullable RuntimeVariable */
185 val* nitc__abstract_compiler___AVarargExpr___AExpr__expr(val* self, val* p0) {
186 val* var /* : nullable RuntimeVariable */;
187 val* var_v /* var v: AbstractCompilerVisitor */;
188 val* var1 /* : AExpr */;
189 val* var3 /* : AExpr */;
190 val* var4 /* : RuntimeVariable */;
191 var_v = p0;
192 {
193 { /* Inline parser_nodes#AVarargExpr#n_expr (self) on <self:AVarargExpr> */
194 var3 = self->attrs[COLOR_nitc__parser_nodes__AVarargExpr___n_expr].val; /* _n_expr on <self:AVarargExpr> */
195 if (unlikely(var3 == NULL)) {
196 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _n_expr");
197 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__parser_nodes, 2630);
198 fatal_exit(1);
199 }
200 var1 = var3;
201 RET_LABEL2:(void)0;
202 }
203 }
204 {
205 var4 = nitc___nitc__AbstractCompilerVisitor___expr(var_v, var1, ((val*)NULL));
206 }
207 var = var4;
208 goto RET_LABEL;
209 RET_LABEL:;
210 return var;
211 }
212 /* method abstract_compiler#ANamedargExpr#expr for (self: ANamedargExpr, AbstractCompilerVisitor): nullable RuntimeVariable */
213 val* nitc__abstract_compiler___ANamedargExpr___AExpr__expr(val* self, val* p0) {
214 val* var /* : nullable RuntimeVariable */;
215 val* var_v /* var v: AbstractCompilerVisitor */;
216 val* var1 /* : AExpr */;
217 val* var3 /* : AExpr */;
218 val* var4 /* : RuntimeVariable */;
219 var_v = p0;
220 {
221 { /* Inline parser_nodes#ANamedargExpr#n_expr (self) on <self:ANamedargExpr> */
222 var3 = self->attrs[COLOR_nitc__parser_nodes__ANamedargExpr___n_expr].val; /* _n_expr on <self:ANamedargExpr> */
223 if (unlikely(var3 == NULL)) {
224 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _n_expr");
225 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__parser_nodes, 2647);
226 fatal_exit(1);
227 }
228 var1 = var3;
229 RET_LABEL2:(void)0;
230 }
231 }
232 {
233 var4 = nitc___nitc__AbstractCompilerVisitor___expr(var_v, var1, ((val*)NULL));
234 }
235 var = var4;
236 goto RET_LABEL;
237 RET_LABEL:;
238 return var;
239 }
240 /* method abstract_compiler#ADebugTypeExpr#stmt for (self: ADebugTypeExpr, AbstractCompilerVisitor) */
241 void nitc__abstract_compiler___ADebugTypeExpr___AExpr__stmt(val* self, val* p0) {
242 val* var_v /* var v: AbstractCompilerVisitor */;
243 var_v = p0;
244 RET_LABEL:;
245 }
246 /* method abstract_compiler#MModule#properties for (self: MModule, MClass): Set[MProperty] */
247 val* nitc__abstract_compiler___MModule___properties(val* self, val* p0) {
248 val* var /* : Set[MProperty] */;
249 val* var_mclass /* var mclass: MClass */;
250 val* var1 /* : Map[MClass, Set[MProperty]] */;
251 val* var3 /* : Map[MClass, Set[MProperty]] */;
252 short int var4 /* : Bool */;
253 short int var5 /* : Bool */;
254 val* var6 /* : HashSet[MProperty] */;
255 val* var_properties /* var properties: HashSet[MProperty] */;
256 val* var7 /* : Array[MClass] */;
257 val* var_parents /* var parents: Array[MClass] */;
258 val* var8 /* : POSet[MClass] */;
259 short int var9 /* : Bool */;
260 val* var10 /* : POSetElement[MClass] */;
261 val* var11 /* : Collection[nullable Object] */;
262 val* var_ /* var : Array[MClass] */;
263 val* var12 /* : IndexedIterator[nullable Object] */;
264 val* var_13 /* var : IndexedIterator[MClass] */;
265 short int var14 /* : Bool */;
266 val* var15 /* : nullable Object */;
267 val* var_parent /* var parent: MClass */;
268 val* var16 /* : Set[MProperty] */;
269 val* var17 /* : Array[MClassDef] */;
270 val* var19 /* : Array[MClassDef] */;
271 val* var_20 /* var : Array[MClassDef] */;
272 val* var21 /* : IndexedIterator[nullable Object] */;
273 val* var_22 /* var : IndexedIterator[MClassDef] */;
274 short int var23 /* : Bool */;
275 val* var25 /* : nullable Object */;
276 val* var_mclassdef /* var mclassdef: MClassDef */;
277 val* var26 /* : POSetElement[MModule] */;
278 val* var28 /* : POSetElement[MModule] */;
279 val* var29 /* : MModule */;
280 val* var31 /* : MModule */;
281 short int var32 /* : Bool */;
282 short int var33 /* : Bool */;
283 val* var35 /* : Array[MProperty] */;
284 val* var37 /* : Array[MProperty] */;
285 val* var_38 /* var : Array[MProperty] */;
286 val* var39 /* : IndexedIterator[nullable Object] */;
287 val* var_40 /* var : IndexedIterator[MProperty] */;
288 short int var41 /* : Bool */;
289 val* var43 /* : nullable Object */;
290 val* var_mprop /* var mprop: MProperty */;
291 val* var44 /* : Map[MClass, Set[MProperty]] */;
292 val* var46 /* : Map[MClass, Set[MProperty]] */;
293 val* var47 /* : Map[MClass, Set[MProperty]] */;
294 val* var49 /* : Map[MClass, Set[MProperty]] */;
295 val* var50 /* : nullable Object */;
296 var_mclass = p0;
297 {
298 { /* Inline abstract_compiler#MModule#properties_cache (self) on <self:MModule> */
299 var3 = self->attrs[COLOR_nitc__abstract_compiler__MModule___properties_cache].val; /* _properties_cache on <self:MModule> */
300 if (unlikely(var3 == NULL)) {
301 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _properties_cache");
302 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__abstract_compiler, 3923);
303 fatal_exit(1);
304 }
305 var1 = var3;
306 RET_LABEL2:(void)0;
307 }
308 }
309 {
310 var4 = ((short int(*)(val* self, val* p0))((((long)var1&3)?class_info[((long)var1&3)]:var1->class)->vft[COLOR_core__abstract_collection__MapRead__has_key]))(var1, var_mclass); /* has_key on <var1:Map[MClass, Set[MProperty]]>*/
311 }
312 var5 = !var4;
313 if (var5){
314 var6 = NEW_core__HashSet(&type_core__HashSet__nitc__MProperty);
315 {
316 core___core__HashSet___core__kernel__Object__init(var6); /* Direct call hash_collection#HashSet#init on <var6:HashSet[MProperty]>*/
317 }
318 var_properties = var6;
319 var7 = NEW_core__Array(&type_core__Array__nitc__MClass);
320 {
321 core___core__Array___core__kernel__Object__init(var7); /* Direct call array#Array#init on <var7:Array[MClass]>*/
322 }
323 var_parents = var7;
324 {
325 var8 = nitc__model___MModule___flatten_mclass_hierarchy(self);
326 }
327 {
328 var9 = poset___poset__POSet___core__abstract_collection__Collection__has(var8, var_mclass);
329 }
330 if (var9){
331 {
332 var10 = nitc___nitc__MClass___in_hierarchy(var_mclass, self);
333 }
334 {
335 var11 = poset___poset__POSetElement___direct_greaters(var10);
336 }
337 {
338 core___core__Array___core__abstract_collection__SimpleCollection__add_all(var_parents, var11); /* Direct call array#Array#add_all on <var_parents:Array[MClass]>*/
339 }
340 } else {
341 }
342 var_ = var_parents;
343 {
344 var12 = core___core__AbstractArrayRead___core__abstract_collection__Collection__iterator(var_);
345 }
346 var_13 = var12;
347 for(;;) {
348 {
349 var14 = ((short int(*)(val* self))((((long)var_13&3)?class_info[((long)var_13&3)]:var_13->class)->vft[COLOR_core__abstract_collection__Iterator__is_ok]))(var_13); /* is_ok on <var_13:IndexedIterator[MClass]>*/
350 }
351 if (var14){
352 } else {
353 goto BREAK_label;
354 }
355 {
356 var15 = ((val*(*)(val* self))((((long)var_13&3)?class_info[((long)var_13&3)]:var_13->class)->vft[COLOR_core__abstract_collection__Iterator__item]))(var_13); /* item on <var_13:IndexedIterator[MClass]>*/
357 }
358 var_parent = var15;
359 {
360 var16 = nitc__abstract_compiler___MModule___properties(self, var_parent);
361 }
362 {
363 core___core__SimpleCollection___add_all(var_properties, var16); /* Direct call abstract_collection#SimpleCollection#add_all on <var_properties:HashSet[MProperty]>*/
364 }
365 {
366 ((void(*)(val* self))((((long)var_13&3)?class_info[((long)var_13&3)]:var_13->class)->vft[COLOR_core__abstract_collection__Iterator__next]))(var_13); /* next on <var_13:IndexedIterator[MClass]>*/
367 }
368 }
369 BREAK_label: (void)0;
370 {
371 ((void(*)(val* self))((((long)var_13&3)?class_info[((long)var_13&3)]:var_13->class)->vft[COLOR_core__abstract_collection__Iterator__finish]))(var_13); /* finish on <var_13:IndexedIterator[MClass]>*/
372 }
373 {
374 { /* Inline model#MClass#mclassdefs (var_mclass) on <var_mclass:MClass> */
375 var19 = var_mclass->attrs[COLOR_nitc__model__MClass___mclassdefs].val; /* _mclassdefs on <var_mclass:MClass> */
376 if (unlikely(var19 == NULL)) {
377 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _mclassdefs");
378 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__model, 477);
379 fatal_exit(1);
380 }
381 var17 = var19;
382 RET_LABEL18:(void)0;
383 }
384 }
385 var_20 = var17;
386 {
387 var21 = core___core__AbstractArrayRead___core__abstract_collection__Collection__iterator(var_20);
388 }
389 var_22 = var21;
390 for(;;) {
391 {
392 var23 = ((short int(*)(val* self))((((long)var_22&3)?class_info[((long)var_22&3)]:var_22->class)->vft[COLOR_core__abstract_collection__Iterator__is_ok]))(var_22); /* is_ok on <var_22:IndexedIterator[MClassDef]>*/
393 }
394 if (var23){
395 } else {
396 goto BREAK_label24;
397 }
398 {
399 var25 = ((val*(*)(val* self))((((long)var_22&3)?class_info[((long)var_22&3)]:var_22->class)->vft[COLOR_core__abstract_collection__Iterator__item]))(var_22); /* item on <var_22:IndexedIterator[MClassDef]>*/
400 }
401 var_mclassdef = var25;
402 {
403 { /* Inline mmodule#MModule#in_importation (self) on <self:MModule> */
404 var28 = self->attrs[COLOR_nitc__mmodule__MModule___in_importation].val; /* _in_importation on <self:MModule> */
405 if (unlikely(var28 == NULL)) {
406 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _in_importation");
407 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__mmodule, 104);
408 fatal_exit(1);
409 }
410 var26 = var28;
411 RET_LABEL27:(void)0;
412 }
413 }
414 {
415 { /* Inline model#MClassDef#mmodule (var_mclassdef) on <var_mclassdef:MClassDef> */
416 var31 = var_mclassdef->attrs[COLOR_nitc__model__MClassDef___mmodule].val; /* _mmodule on <var_mclassdef:MClassDef> */
417 if (unlikely(var31 == NULL)) {
418 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _mmodule");
419 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__model, 573);
420 fatal_exit(1);
421 }
422 var29 = var31;
423 RET_LABEL30:(void)0;
424 }
425 }
426 {
427 var32 = poset___poset__POSetElement____60d_61d(var26, var29);
428 }
429 var33 = !var32;
430 if (var33){
431 goto BREAK_label34;
432 } else {
433 }
434 {
435 { /* Inline model#MClassDef#intro_mproperties (var_mclassdef) on <var_mclassdef:MClassDef> */
436 var37 = var_mclassdef->attrs[COLOR_nitc__model__MClassDef___intro_mproperties].val; /* _intro_mproperties on <var_mclassdef:MClassDef> */
437 if (unlikely(var37 == NULL)) {
438 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _intro_mproperties");
439 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__model, 704);
440 fatal_exit(1);
441 }
442 var35 = var37;
443 RET_LABEL36:(void)0;
444 }
445 }
446 var_38 = var35;
447 {
448 var39 = core___core__AbstractArrayRead___core__abstract_collection__Collection__iterator(var_38);
449 }
450 var_40 = var39;
451 for(;;) {
452 {
453 var41 = ((short int(*)(val* self))((((long)var_40&3)?class_info[((long)var_40&3)]:var_40->class)->vft[COLOR_core__abstract_collection__Iterator__is_ok]))(var_40); /* is_ok on <var_40:IndexedIterator[MProperty]>*/
454 }
455 if (var41){
456 } else {
457 goto BREAK_label42;
458 }
459 {
460 var43 = ((val*(*)(val* self))((((long)var_40&3)?class_info[((long)var_40&3)]:var_40->class)->vft[COLOR_core__abstract_collection__Iterator__item]))(var_40); /* item on <var_40:IndexedIterator[MProperty]>*/
461 }
462 var_mprop = var43;
463 {
464 core___core__HashSet___core__abstract_collection__SimpleCollection__add(var_properties, var_mprop); /* Direct call hash_collection#HashSet#add on <var_properties:HashSet[MProperty]>*/
465 }
466 {
467 ((void(*)(val* self))((((long)var_40&3)?class_info[((long)var_40&3)]:var_40->class)->vft[COLOR_core__abstract_collection__Iterator__next]))(var_40); /* next on <var_40:IndexedIterator[MProperty]>*/
468 }
469 }
470 BREAK_label42: (void)0;
471 {
472 ((void(*)(val* self))((((long)var_40&3)?class_info[((long)var_40&3)]:var_40->class)->vft[COLOR_core__abstract_collection__Iterator__finish]))(var_40); /* finish on <var_40:IndexedIterator[MProperty]>*/
473 }
474 BREAK_label34: (void)0;
475 {
476 ((void(*)(val* self))((((long)var_22&3)?class_info[((long)var_22&3)]:var_22->class)->vft[COLOR_core__abstract_collection__Iterator__next]))(var_22); /* next on <var_22:IndexedIterator[MClassDef]>*/
477 }
478 }
479 BREAK_label24: (void)0;
480 {
481 ((void(*)(val* self))((((long)var_22&3)?class_info[((long)var_22&3)]:var_22->class)->vft[COLOR_core__abstract_collection__Iterator__finish]))(var_22); /* finish on <var_22:IndexedIterator[MClassDef]>*/
482 }
483 {
484 { /* Inline abstract_compiler#MModule#properties_cache (self) on <self:MModule> */
485 var46 = self->attrs[COLOR_nitc__abstract_compiler__MModule___properties_cache].val; /* _properties_cache on <self:MModule> */
486 if (unlikely(var46 == NULL)) {
487 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _properties_cache");
488 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__abstract_compiler, 3923);
489 fatal_exit(1);
490 }
491 var44 = var46;
492 RET_LABEL45:(void)0;
493 }
494 }
495 {
496 ((void(*)(val* self, val* p0, val* p1))((((long)var44&3)?class_info[((long)var44&3)]:var44->class)->vft[COLOR_core__abstract_collection__Map___91d_93d_61d]))(var44, var_mclass, var_properties); /* []= on <var44:Map[MClass, Set[MProperty]]>*/
497 }
498 } else {
499 }
500 {
501 { /* Inline abstract_compiler#MModule#properties_cache (self) on <self:MModule> */
502 var49 = self->attrs[COLOR_nitc__abstract_compiler__MModule___properties_cache].val; /* _properties_cache on <self:MModule> */
503 if (unlikely(var49 == NULL)) {
504 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _properties_cache");
505 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__abstract_compiler, 3923);
506 fatal_exit(1);
507 }
508 var47 = var49;
509 RET_LABEL48:(void)0;
510 }
511 }
512 {
513 var50 = ((val*(*)(val* self, val* p0))((((long)var47&3)?class_info[((long)var47&3)]:var47->class)->vft[COLOR_core__abstract_collection__MapRead___91d_93d]))(var47, var_mclass); /* [] on <var47:Map[MClass, Set[MProperty]]>*/
514 }
515 var = var50;
516 goto RET_LABEL;
517 RET_LABEL:;
518 return var;
519 }
520 /* method abstract_compiler#MModule#properties_cache for (self: MModule): Map[MClass, Set[MProperty]] */
521 val* nitc__abstract_compiler___MModule___properties_cache(val* self) {
522 val* var /* : Map[MClass, Set[MProperty]] */;
523 val* var1 /* : Map[MClass, Set[MProperty]] */;
524 var1 = self->attrs[COLOR_nitc__abstract_compiler__MModule___properties_cache].val; /* _properties_cache on <self:MModule> */
525 if (unlikely(var1 == NULL)) {
526 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _properties_cache");
527 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__abstract_compiler, 3923);
528 fatal_exit(1);
529 }
530 var = var1;
531 RET_LABEL:;
532 return var;
533 }
534 /* method abstract_compiler#Sys#main for (self: Sys) */
535 void nitc__abstract_compiler___core__Sys___main(val* self) {
536 val* var /* : ToolContext */;
537 val* var_toolcontext /* var toolcontext: ToolContext */;
538 static val* varonce;
539 val* var1 /* : String */;
540 char* var2 /* : NativeString */;
541 val* var3 /* : String */;
542 val* var5 /* : Sequence[String] */;
543 val* var6 /* : Model */;
544 val* var_model /* var model: Model */;
545 val* var8 /* : ModelBuilder */;
546 val* var_modelbuilder /* var modelbuilder: ModelBuilder */;
547 val* var9 /* : OptionContext */;
548 val* var11 /* : OptionContext */;
549 val* var12 /* : Array[String] */;
550 val* var14 /* : Array[String] */;
551 val* var_arguments /* var arguments: Array[String] */;
552 short int var15 /* : Bool */;
553 long var16 /* : Int */;
554 long var18 /* : Int */;
555 short int var19 /* : Bool */;
556 short int var21 /* : Bool */;
557 int cltype;
558 int idtype;
559 const char* var_class_name;
560 short int var22 /* : Bool */;
561 short int var_ /* var : Bool */;
562 val* var23 /* : OptionString */;
563 val* var25 /* : OptionString */;
564 val* var26 /* : nullable Object */;
565 val* var28 /* : nullable Object */;
566 short int var29 /* : Bool */;
567 short int var30 /* : Bool */;
568 val* var_other /* var other: nullable Object */;
569 short int var32 /* : Bool */;
570 short int var33 /* : Bool */;
571 static val* varonce34;
572 val* var35 /* : String */;
573 char* var36 /* : NativeString */;
574 val* var37 /* : String */;
575 val* var39 /* : Array[MModule] */;
576 val* var_mmodules /* var mmodules: Array[MModule] */;
577 short int var40 /* : Bool */;
578 val* var_41 /* var : Array[MModule] */;
579 val* var42 /* : IndexedIterator[nullable Object] */;
580 val* var_43 /* var : IndexedIterator[MModule] */;
581 short int var44 /* : Bool */;
582 val* var45 /* : nullable Object */;
583 val* var_mmodule /* var mmodule: MModule */;
584 val* var47 /* : NativeArray[String] */;
585 static val* varonce46;
586 static val* varonce48;
587 val* var49 /* : String */;
588 char* var50 /* : NativeString */;
589 val* var51 /* : String */;
590 static val* varonce52;
591 val* var53 /* : String */;
592 char* var54 /* : NativeString */;
593 val* var55 /* : String */;
594 val* var56 /* : String */;
595 val* var57 /* : String */;
596 val* var58 /* : Array[MModule] */;
597 val* var_59 /* var : Array[MModule] */;
598 val* var_ms /* var ms: Array[MModule] */;
599 var = NEW_nitc__ToolContext(&type_nitc__ToolContext);
600 {
601 nitc__separate_erasure_compiler___ToolContext___core__kernel__Object__init(var); /* Direct call separate_erasure_compiler#ToolContext#init on <var:ToolContext>*/
602 }
603 var_toolcontext = var;
604 if (likely(varonce!=NULL)) {
605 var1 = varonce;
606 } else {
607 var2 = "Usage: nitc [OPTION]... file.nit...\nCompiles Nit programs.";
608 var3 = core__flat___NativeString___to_s_full(var2, 58l, 58l);
609 var1 = var3;
610 varonce = var1;
611 }
612 {
613 { /* Inline toolcontext#ToolContext#tooldescription= (var_toolcontext,var1) on <var_toolcontext:ToolContext> */
614 var_toolcontext->attrs[COLOR_nitc__toolcontext__ToolContext___tooldescription].val = var1; /* _tooldescription on <var_toolcontext:ToolContext> */
615 RET_LABEL4:(void)0;
616 }
617 }
618 {
619 var5 = core__abstract_text___Sys___args(self);
620 }
621 {
622 nitc__nith___ToolContext___process_options(var_toolcontext, var5); /* Direct call nith#ToolContext#process_options on <var_toolcontext:ToolContext>*/
623 }
624 var6 = NEW_nitc__Model(&type_nitc__Model);
625 {
626 { /* Inline kernel#Object#init (var6) on <var6:Model> */
627 RET_LABEL7:(void)0;
628 }
629 }
630 var_model = var6;
631 var8 = NEW_nitc__ModelBuilder(&type_nitc__ModelBuilder);
632 {
633 ((void(*)(val* self, val* p0))(var8->class->vft[COLOR_nitc__modelbuilder_base__ModelBuilder__model_61d]))(var8, var_model); /* model= on <var8:ModelBuilder>*/
634 }
635 {
636 ((void(*)(val* self, val* p0))(var8->class->vft[COLOR_nitc__modelbuilder_base__ModelBuilder__toolcontext_61d]))(var8, var_toolcontext); /* toolcontext= on <var8:ModelBuilder>*/
637 }
638 {
639 ((void(*)(val* self))(var8->class->vft[COLOR_core__kernel__Object__init]))(var8); /* init on <var8:ModelBuilder>*/
640 }
641 var_modelbuilder = var8;
642 {
643 { /* Inline toolcontext#ToolContext#option_context (var_toolcontext) on <var_toolcontext:ToolContext> */
644 var11 = var_toolcontext->attrs[COLOR_nitc__toolcontext__ToolContext___option_context].val; /* _option_context on <var_toolcontext:ToolContext> */
645 if (unlikely(var11 == NULL)) {
646 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _option_context");
647 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__toolcontext, 342);
648 fatal_exit(1);
649 }
650 var9 = var11;
651 RET_LABEL10:(void)0;
652 }
653 }
654 {
655 { /* Inline opts#OptionContext#rest (var9) on <var9:OptionContext> */
656 var14 = var9->attrs[COLOR_opts__OptionContext___rest].val; /* _rest on <var9:OptionContext> */
657 if (unlikely(var14 == NULL)) {
658 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _rest");
659 PRINT_ERROR(" (%s:%d)\n", FILE_opts, 280);
660 fatal_exit(1);
661 }
662 var12 = var14;
663 RET_LABEL13:(void)0;
664 }
665 }
666 var_arguments = var12;
667 {
668 { /* Inline array#AbstractArrayRead#length (var_arguments) on <var_arguments:Array[String]> */
669 var18 = var_arguments->attrs[COLOR_core__array__AbstractArrayRead___length].l; /* _length on <var_arguments:Array[String]> */
670 var16 = var18;
671 RET_LABEL17:(void)0;
672 }
673 }
674 {
675 { /* Inline kernel#Int#> (var16,1l) on <var16:Int> */
676 /* Covariant cast for argument 0 (i) <1l:Int> isa OTHER */
677 /* <1l:Int> isa OTHER */
678 var21 = 1; /* easy <1l:Int> isa OTHER*/
679 if (unlikely(!var21)) {
680 var_class_name = type_core__Int.name;
681 PRINT_ERROR("Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name);
682 PRINT_ERROR(" (%s:%d)\n", FILE_core__kernel, 730);
683 fatal_exit(1);
684 }
685 var22 = var16 > 1l;
686 var19 = var22;
687 goto RET_LABEL20;
688 RET_LABEL20:(void)0;
689 }
690 }
691 var_ = var19;
692 if (var19){
693 {
694 { /* Inline abstract_compiler#ToolContext#opt_output (var_toolcontext) on <var_toolcontext:ToolContext> */
695 var25 = var_toolcontext->attrs[COLOR_nitc__abstract_compiler__ToolContext___opt_output].val; /* _opt_output on <var_toolcontext:ToolContext> */
696 if (unlikely(var25 == NULL)) {
697 PRINT_ERROR("Runtime error: %s", "Uninitialized attribute _opt_output");
698 PRINT_ERROR(" (%s:%d)\n", FILE_nitc__abstract_compiler, 30);
699 fatal_exit(1);
700 }
701 var23 = var25;
702 RET_LABEL24:(void)0;
703 }
704 }
705 {
706 { /* Inline opts#Option#value (var23) on <var23:OptionString> */
707 var28 = var23->attrs[COLOR_opts__Option___value].val; /* _value on <var23:OptionString> */
708 var26 = var28;
709 RET_LABEL27:(void)0;
710 }
711 }
712 if (var26 == NULL) {
713 var29 = 0; /* is null */
714 } else {
715 var29 = 1; /* arg is null and recv is not */
716 }
717 if (0) {
718 { /* Inline kernel#Object#!= (var26,((val*)NULL)) on <var26:nullable Object(nullable String)> */
719 var_other = ((val*)NULL);
720 {
721 var32 = ((short int(*)(val* self, val* p0))(var26->class->vft[COLOR_core__kernel__Object___61d_61d]))(var26, var_other); /* == on <var26:nullable String(String)>*/
722 }
723 var33 = !var32;
724 var30 = var33;
725 goto RET_LABEL31;
726 RET_LABEL31:(void)0;
727 }
728 var29 = var30;
729 }
730 var15 = var29;
731 } else {
732 var15 = var_;
733 }
734 if (var15){
735 if (likely(varonce34!=NULL)) {
736 var35 = varonce34;
737 } else {
738 var36 = "Option Error: --output needs a single source file. Do you prefer --dir?";
739 var37 = core__flat___NativeString___to_s_full(var36, 71l, 71l);
740 var35 = var37;
741 varonce34 = var35;
742 }
743 {
744 core__file___Sys___print(self, var35); /* Direct call file#Sys#print on <self:Sys>*/
745 }
746 {
747 { /* Inline kernel#Sys#exit (self,1l) on <self:Sys> */
748 exit(1l);
749 RET_LABEL38:(void)0;
750 }
751 }
752 } else {
753 }
754 {
755 var39 = nitc__loader___ModelBuilder___parse(var_modelbuilder, var_arguments);
756 }
757 var_mmodules = var39;
758 {
759 var40 = core___core__AbstractArrayRead___core__abstract_collection__Collection__is_empty(var_mmodules);
760 }
761 if (var40){
762 {
763 nitc___nitc__ToolContext___quit(var_toolcontext); /* Direct call toolcontext#ToolContext#quit on <var_toolcontext:ToolContext>*/
764 }
765 } else {
766 }
767 {
768 nitc__modelbuilder___ModelBuilder___run_phases(var_modelbuilder); /* Direct call modelbuilder#ModelBuilder#run_phases on <var_modelbuilder:ModelBuilder>*/
769 }
770 var_41 = var_mmodules;
771 {
772 var42 = core___core__AbstractArrayRead___core__abstract_collection__Collection__iterator(var_41);
773 }
774 var_43 = var42;
775 for(;;) {
776 {
777 var44 = ((short int(*)(val* self))((((long)var_43&3)?class_info[((long)var_43&3)]:var_43->class)->vft[COLOR_core__abstract_collection__Iterator__is_ok]))(var_43); /* is_ok on <var_43:IndexedIterator[MModule]>*/
778 }
779 if (var44){
780 } else {
781 goto BREAK_label;
782 }
783 {
784 var45 = ((val*(*)(val* self))((((long)var_43&3)?class_info[((long)var_43&3)]:var_43->class)->vft[COLOR_core__abstract_collection__Iterator__item]))(var_43); /* item on <var_43:IndexedIterator[MModule]>*/
785 }
786 var_mmodule = var45;
787 if (unlikely(varonce46==NULL)) {
788 var47 = NEW_core__NativeArray(3l, &type_core__NativeArray__core__String);
789 if (likely(varonce48!=NULL)) {
790 var49 = varonce48;
791 } else {
792 var50 = "*** PROCESS ";
793 var51 = core__flat___NativeString___to_s_full(var50, 12l, 12l);
794 var49 = var51;
795 varonce48 = var49;
796 }
797 ((struct instance_core__NativeArray*)var47)->values[0]=var49;
798 if (likely(varonce52!=NULL)) {
799 var53 = varonce52;
800 } else {
801 var54 = " ***";
802 var55 = core__flat___NativeString___to_s_full(var54, 4l, 4l);
803 var53 = var55;
804 varonce52 = var53;
805 }
806 ((struct instance_core__NativeArray*)var47)->values[2]=var53;
807 } else {
808 var47 = varonce46;
809 varonce46 = NULL;
810 }
811 {
812 var56 = ((val*(*)(val* self))(var_mmodule->class->vft[COLOR_core__abstract_text__Object__to_s]))(var_mmodule); /* to_s on <var_mmodule:MModule>*/
813 }
814 ((struct instance_core__NativeArray*)var47)->values[1]=var56;
815 {
816 var57 = ((val*(*)(val* self))(var47->class->vft[COLOR_core__abstract_text__NativeArray__native_to_s]))(var47); /* native_to_s on <var47:NativeArray[String]>*/
817 }
818 varonce46 = var47;
819 {
820 nitc___nitc__ToolContext___info(var_toolcontext, var57, 1l); /* Direct call toolcontext#ToolContext#info on <var_toolcontext:ToolContext>*/
821 }
822 var58 = NEW_core__Array(&type_core__Array__nitc__MModule);
823 {
824 core___core__Array___with_capacity(var58, 1l); /* Direct call array#Array#with_capacity on <var58:Array[MModule]>*/
825 }
826 var_59 = var58;
827 {
828 core___core__AbstractArray___core__abstract_collection__Sequence__push(var_59, var_mmodule); /* Direct call array#AbstractArray#push on <var_59:Array[MModule]>*/
829 }
830 var_ms = var_59;
831 {
832 nitc__modelbuilder___ToolContext___run_global_phases(var_toolcontext, var_ms); /* Direct call modelbuilder#ToolContext#run_global_phases on <var_toolcontext:ToolContext>*/
833 }
834 {
835 ((void(*)(val* self))((((long)var_43&3)?class_info[((long)var_43&3)]:var_43->class)->vft[COLOR_core__abstract_collection__Iterator__next]))(var_43); /* next on <var_43:IndexedIterator[MModule]>*/
836 }
837 }
838 BREAK_label: (void)0;
839 {
840 ((void(*)(val* self))((((long)var_43&3)?class_info[((long)var_43&3)]:var_43->class)->vft[COLOR_core__abstract_collection__Iterator__finish]))(var_43); /* finish on <var_43:IndexedIterator[MModule]>*/
841 }
842 RET_LABEL:;
843 }