nitg & niti: add intern methods `successor` and `predecessor`
[nit.git] / c_src / ropes.sep.1.c
1 #include "ropes.sep.0.h"
2 /* method ropes#TupleLeafNodePos#curr_node for (self: TupleLeafNodePos): LeafNode */
3 val* ropes__TupleLeafNodePos__curr_node(val* self) {
4 val* var /* : LeafNode */;
5 val* var1 /* : LeafNode */;
6 var1 = self->attrs[COLOR_ropes__TupleLeafNodePos___64dcurr_node].val; /* @curr_node on <self:TupleLeafNodePos> */
7 if (var1 == NULL) {
8 fprintf(stderr, "Runtime error: %s", "Uninitialized attribute @curr_node");
9 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 24);
10 show_backtrace(1);
11 }
12 var = var1;
13 RET_LABEL:;
14 return var;
15 }
16 /* method ropes#TupleLeafNodePos#curr_node for (self: Object): LeafNode */
17 val* VIRTUAL_ropes__TupleLeafNodePos__curr_node(val* self) {
18 val* var /* : LeafNode */;
19 val* var1 /* : LeafNode */;
20 var1 = ropes__TupleLeafNodePos__curr_node(self);
21 var = var1;
22 RET_LABEL:;
23 return var;
24 }
25 /* method ropes#TupleLeafNodePos#curr_node= for (self: TupleLeafNodePos, LeafNode) */
26 void ropes__TupleLeafNodePos__curr_node_61d(val* self, val* p0) {
27 self->attrs[COLOR_ropes__TupleLeafNodePos___64dcurr_node].val = p0; /* @curr_node on <self:TupleLeafNodePos> */
28 RET_LABEL:;
29 }
30 /* method ropes#TupleLeafNodePos#curr_node= for (self: Object, LeafNode) */
31 void VIRTUAL_ropes__TupleLeafNodePos__curr_node_61d(val* self, val* p0) {
32 ropes__TupleLeafNodePos__curr_node_61d(self, p0);
33 RET_LABEL:;
34 }
35 /* method ropes#TupleLeafNodePos#corrected_pos for (self: TupleLeafNodePos): Int */
36 long ropes__TupleLeafNodePos__corrected_pos(val* self) {
37 long var /* : Int */;
38 long var1 /* : Int */;
39 var1 = self->attrs[COLOR_ropes__TupleLeafNodePos___64dcorrected_pos].l; /* @corrected_pos on <self:TupleLeafNodePos> */
40 var = var1;
41 RET_LABEL:;
42 return var;
43 }
44 /* method ropes#TupleLeafNodePos#corrected_pos for (self: Object): Int */
45 long VIRTUAL_ropes__TupleLeafNodePos__corrected_pos(val* self) {
46 long var /* : Int */;
47 long var1 /* : Int */;
48 var1 = ropes__TupleLeafNodePos__corrected_pos(self);
49 var = var1;
50 RET_LABEL:;
51 return var;
52 }
53 /* method ropes#TupleLeafNodePos#corrected_pos= for (self: TupleLeafNodePos, Int) */
54 void ropes__TupleLeafNodePos__corrected_pos_61d(val* self, long p0) {
55 self->attrs[COLOR_ropes__TupleLeafNodePos___64dcorrected_pos].l = p0; /* @corrected_pos on <self:TupleLeafNodePos> */
56 RET_LABEL:;
57 }
58 /* method ropes#TupleLeafNodePos#corrected_pos= for (self: Object, Int) */
59 void VIRTUAL_ropes__TupleLeafNodePos__corrected_pos_61d(val* self, long p0) {
60 ropes__TupleLeafNodePos__corrected_pos_61d(self, p0);
61 RET_LABEL:;
62 }
63 /* method ropes#TupleLeafNodePos#visit_stack for (self: TupleLeafNodePos): List[TupleVisitNode] */
64 val* ropes__TupleLeafNodePos__visit_stack(val* self) {
65 val* var /* : List[TupleVisitNode] */;
66 val* var1 /* : List[TupleVisitNode] */;
67 var1 = self->attrs[COLOR_ropes__TupleLeafNodePos___64dvisit_stack].val; /* @visit_stack on <self:TupleLeafNodePos> */
68 if (var1 == NULL) {
69 fprintf(stderr, "Runtime error: %s", "Uninitialized attribute @visit_stack");
70 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 26);
71 show_backtrace(1);
72 }
73 var = var1;
74 RET_LABEL:;
75 return var;
76 }
77 /* method ropes#TupleLeafNodePos#visit_stack for (self: Object): List[TupleVisitNode] */
78 val* VIRTUAL_ropes__TupleLeafNodePos__visit_stack(val* self) {
79 val* var /* : List[TupleVisitNode] */;
80 val* var1 /* : List[TupleVisitNode] */;
81 var1 = ropes__TupleLeafNodePos__visit_stack(self);
82 var = var1;
83 RET_LABEL:;
84 return var;
85 }
86 /* method ropes#TupleLeafNodePos#visit_stack= for (self: TupleLeafNodePos, List[TupleVisitNode]) */
87 void ropes__TupleLeafNodePos__visit_stack_61d(val* self, val* p0) {
88 self->attrs[COLOR_ropes__TupleLeafNodePos___64dvisit_stack].val = p0; /* @visit_stack on <self:TupleLeafNodePos> */
89 RET_LABEL:;
90 }
91 /* method ropes#TupleLeafNodePos#visit_stack= for (self: Object, List[TupleVisitNode]) */
92 void VIRTUAL_ropes__TupleLeafNodePos__visit_stack_61d(val* self, val* p0) {
93 ropes__TupleLeafNodePos__visit_stack_61d(self, p0);
94 RET_LABEL:;
95 }
96 /* method ropes#TupleLeafNodePos#init for (self: TupleLeafNodePos, LeafNode, Int, List[TupleVisitNode]) */
97 void ropes__TupleLeafNodePos__init(val* self, val* p0, long p1, val* p2) {
98 self->attrs[COLOR_ropes__TupleLeafNodePos___64dcurr_node].val = p0; /* @curr_node on <self:TupleLeafNodePos> */
99 self->attrs[COLOR_ropes__TupleLeafNodePos___64dcorrected_pos].l = p1; /* @corrected_pos on <self:TupleLeafNodePos> */
100 self->attrs[COLOR_ropes__TupleLeafNodePos___64dvisit_stack].val = p2; /* @visit_stack on <self:TupleLeafNodePos> */
101 RET_LABEL:;
102 }
103 /* method ropes#TupleLeafNodePos#init for (self: Object, LeafNode, Int, List[TupleVisitNode]) */
104 void VIRTUAL_ropes__TupleLeafNodePos__init(val* self, val* p0, long p1, val* p2) {
105 ropes__TupleLeafNodePos__init(self, p0, p1, p2);
106 RET_LABEL:;
107 }
108 /* method ropes#Rope#str_representation for (self: Rope): nullable String */
109 val* ropes__Rope__str_representation(val* self) {
110 val* var /* : nullable String */;
111 val* var1 /* : nullable String */;
112 var1 = self->attrs[COLOR_ropes__Rope___64dstr_representation].val; /* @str_representation on <self:Rope> */
113 var = var1;
114 RET_LABEL:;
115 return var;
116 }
117 /* method ropes#Rope#str_representation for (self: Object): nullable String */
118 val* VIRTUAL_ropes__Rope__str_representation(val* self) {
119 val* var /* : nullable String */;
120 val* var1 /* : nullable String */;
121 var1 = ropes__Rope__str_representation(self);
122 var = var1;
123 RET_LABEL:;
124 return var;
125 }
126 /* method ropes#Rope#str_representation= for (self: Rope, nullable String) */
127 void ropes__Rope__str_representation_61d(val* self, val* p0) {
128 self->attrs[COLOR_ropes__Rope___64dstr_representation].val = p0; /* @str_representation on <self:Rope> */
129 RET_LABEL:;
130 }
131 /* method ropes#Rope#str_representation= for (self: Object, nullable String) */
132 void VIRTUAL_ropes__Rope__str_representation_61d(val* self, val* p0) {
133 ropes__Rope__str_representation_61d(self, p0);
134 RET_LABEL:;
135 }
136 /* method ropes#Rope#parent_node for (self: Rope): RopeNode */
137 val* ropes__Rope__parent_node(val* self) {
138 val* var /* : RopeNode */;
139 val* var1 /* : RopeNode */;
140 var1 = self->attrs[COLOR_ropes__Rope___64dparent_node].val; /* @parent_node on <self:Rope> */
141 if (var1 == NULL) {
142 fprintf(stderr, "Runtime error: %s", "Uninitialized attribute @parent_node");
143 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 39);
144 show_backtrace(1);
145 }
146 var = var1;
147 RET_LABEL:;
148 return var;
149 }
150 /* method ropes#Rope#parent_node for (self: Object): RopeNode */
151 val* VIRTUAL_ropes__Rope__parent_node(val* self) {
152 val* var /* : RopeNode */;
153 val* var1 /* : RopeNode */;
154 var1 = ropes__Rope__parent_node(self);
155 var = var1;
156 RET_LABEL:;
157 return var;
158 }
159 /* method ropes#Rope#parent_node= for (self: Rope, RopeNode) */
160 void ropes__Rope__parent_node_61d(val* self, val* p0) {
161 self->attrs[COLOR_ropes__Rope___64dparent_node].val = p0; /* @parent_node on <self:Rope> */
162 RET_LABEL:;
163 }
164 /* method ropes#Rope#parent_node= for (self: Object, RopeNode) */
165 void VIRTUAL_ropes__Rope__parent_node_61d(val* self, val* p0) {
166 ropes__Rope__parent_node_61d(self, p0);
167 RET_LABEL:;
168 }
169 /* method ropes#Rope#init for (self: Rope) */
170 void ropes__Rope__init(val* self) {
171 val* var /* : ConcatNode */;
172 var = NEW_ropes__ConcatNode(&type_ropes__ConcatNode);
173 ((void (*)(val*))(var->class->vft[COLOR_ropes__ConcatNode__init]))(var) /* init on <var:ConcatNode>*/;
174 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__Rope__parent_node_61d]))(self, var) /* parent_node= on <self:Rope>*/;
175 RET_LABEL:;
176 }
177 /* method ropes#Rope#init for (self: Object) */
178 void VIRTUAL_ropes__Rope__init(val* self) {
179 ropes__Rope__init(self);
180 RET_LABEL:;
181 }
182 /* method ropes#Rope#with_string for (self: Rope, AbstractString) */
183 void ropes__Rope__with_string(val* self, val* p0) {
184 val* var_str /* var str: AbstractString */;
185 val* var /* : ConcatNode */;
186 val* var1 /* : RopeNode */;
187 short int var2 /* : Bool */;
188 int cltype;
189 int idtype;
190 const char* var_class_name;
191 val* var3 /* : LeafNode */;
192 val* var4 /* : RopeNode */;
193 short int var5 /* : Bool */;
194 int cltype6;
195 int idtype7;
196 const char* var_class_name8;
197 var_str = p0;
198 var = NEW_ropes__ConcatNode(&type_ropes__ConcatNode);
199 ((void (*)(val*))(var->class->vft[COLOR_ropes__ConcatNode__init]))(var) /* init on <var:ConcatNode>*/;
200 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__Rope__parent_node_61d]))(self, var) /* parent_node= on <self:Rope>*/;
201 var1 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__parent_node]))(self) /* parent_node on <self:Rope>*/;
202 /* <var1:RopeNode> isa ConcatNode */
203 cltype = type_ropes__ConcatNode.color;
204 idtype = type_ropes__ConcatNode.id;
205 if(cltype >= var1->type->table_size) {
206 var2 = 0;
207 } else {
208 var2 = var1->type->type_table[cltype] == idtype;
209 }
210 if (!var2) {
211 var_class_name = var1 == NULL ? "null" : var1->type->name;
212 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "ConcatNode", var_class_name);
213 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 50);
214 show_backtrace(1);
215 }
216 var3 = NEW_ropes__LeafNode(&type_ropes__LeafNode);
217 ((void (*)(val*, val*))(var3->class->vft[COLOR_ropes__LeafNode__init]))(var3, var_str) /* init on <var3:LeafNode>*/;
218 ((void (*)(val*, val*))(var1->class->vft[COLOR_ropes__ConcatNode__right_child_61d]))(var1, var3) /* right_child= on <var1:RopeNode(ConcatNode)>*/;
219 var4 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__parent_node]))(self) /* parent_node on <self:Rope>*/;
220 /* <var4:RopeNode> isa ConcatNode */
221 cltype6 = type_ropes__ConcatNode.color;
222 idtype7 = type_ropes__ConcatNode.id;
223 if(cltype6 >= var4->type->table_size) {
224 var5 = 0;
225 } else {
226 var5 = var4->type->type_table[cltype6] == idtype7;
227 }
228 if (!var5) {
229 var_class_name8 = var4 == NULL ? "null" : var4->type->name;
230 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "ConcatNode", var_class_name8);
231 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 51);
232 show_backtrace(1);
233 }
234 ((void (*)(val*))(var4->class->vft[COLOR_ropes__ConcatNode__update_data]))(var4) /* update_data on <var4:RopeNode(ConcatNode)>*/;
235 RET_LABEL:;
236 }
237 /* method ropes#Rope#with_string for (self: Object, AbstractString) */
238 void VIRTUAL_ropes__Rope__with_string(val* self, val* p0) {
239 ropes__Rope__with_string(self, p0);
240 RET_LABEL:;
241 }
242 /* method ropes#Rope#chars for (self: Rope): SequenceRead[Char] */
243 val* ropes__Rope__chars(val* self) {
244 val* var /* : SequenceRead[Char] */;
245 val* var1 /* : CharRopeView */;
246 var1 = NEW_ropes__CharRopeView(&type_ropes__CharRopeView);
247 ((void (*)(val*, val*))(var1->class->vft[COLOR_ropes__CharRopeView__init]))(var1, self) /* init on <var1:CharRopeView>*/;
248 var = var1;
249 goto RET_LABEL;
250 RET_LABEL:;
251 return var;
252 }
253 /* method ropes#Rope#chars for (self: Object): SequenceRead[Char] */
254 val* VIRTUAL_ropes__Rope__chars(val* self) {
255 val* var /* : SequenceRead[Char] */;
256 val* var1 /* : SequenceRead[Char] */;
257 var1 = ropes__Rope__chars(self);
258 var = var1;
259 RET_LABEL:;
260 return var;
261 }
262 /* method ropes#Rope#length for (self: Rope): Int */
263 long ropes__Rope__length(val* self) {
264 long var /* : Int */;
265 val* var1 /* : RopeNode */;
266 long var2 /* : Int */;
267 var1 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__parent_node]))(self) /* parent_node on <self:Rope>*/;
268 var2 = ((long (*)(val*))(var1->class->vft[COLOR_ropes__RopeNode__length]))(var1) /* length on <var1:RopeNode>*/;
269 var = var2;
270 goto RET_LABEL;
271 RET_LABEL:;
272 return var;
273 }
274 /* method ropes#Rope#length for (self: Object): Int */
275 long VIRTUAL_ropes__Rope__length(val* self) {
276 long var /* : Int */;
277 long var1 /* : Int */;
278 var1 = ropes__Rope__length(self);
279 var = var1;
280 RET_LABEL:;
281 return var;
282 }
283 /* method ropes#Rope#to_s for (self: Rope): String */
284 val* ropes__Rope__to_s(val* self) {
285 val* var /* : String */;
286 val* var1 /* : nullable String */;
287 val* var2 /* : null */;
288 short int var3 /* : Bool */;
289 val* var4 /* : String */;
290 val* var5 /* : nullable String */;
291 var1 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__str_representation]))(self) /* str_representation on <self:Rope>*/;
292 var2 = NULL;
293 if (var1 == NULL) {
294 var3 = 1; /* is null */
295 } else {
296 var3 = 0; /* arg is null but recv is not */
297 }
298 if (var3){
299 var4 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__flatten]))(self) /* flatten on <self:Rope>*/;
300 var4;
301 } else {
302 }
303 var5 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__str_representation]))(self) /* str_representation on <self:Rope>*/;
304 if (var5 == NULL) {
305 fprintf(stderr, "Runtime error: %s", "Cast failed");
306 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 70);
307 show_backtrace(1);
308 }
309 var = var5;
310 goto RET_LABEL;
311 RET_LABEL:;
312 return var;
313 }
314 /* method ropes#Rope#to_s for (self: Object): String */
315 val* VIRTUAL_ropes__Rope__to_s(val* self) {
316 val* var /* : String */;
317 val* var1 /* : String */;
318 var1 = ropes__Rope__to_s(self);
319 var = var1;
320 RET_LABEL:;
321 return var;
322 }
323 /* method ropes#Rope#flatten for (self: Rope): String */
324 val* ropes__Rope__flatten(val* self) {
325 val* var /* : String */;
326 long var1 /* : Int */;
327 long var2 /* : Int */;
328 long var3 /* : Int */;
329 long var5 /* : Int */;
330 char* var6 /* : NativeString */;
331 char* var_native_final_str /* var native_final_str: NativeString */;
332 long var7 /* : Int */;
333 char var8 /* : Char */;
334 long var10 /* : Int */;
335 long var_offset /* var offset: Int */;
336 val* var11 /* : DFSRopeLeafIterator */;
337 val* var_iter /* var iter: DFSRopeLeafIterator */;
338 short int var12 /* : Bool */;
339 val* var13 /* : nullable Object */;
340 val* var14 /* : String */;
341 char* var15 /* : NativeString */;
342 val* var16 /* : nullable Object */;
343 val* var17 /* : String */;
344 long var18 /* : Int */;
345 long var19 /* : Int */;
346 val* var21 /* : nullable Object */;
347 val* var22 /* : String */;
348 long var23 /* : Int */;
349 long var24 /* : Int */;
350 long var26 /* : Int */;
351 long var27 /* : Int */;
352 val* var28 /* : String */;
353 var1 = ((long (*)(val*))(self->class->vft[COLOR_ropes__Rope__length]))(self) /* length on <self:Rope>*/;
354 var2 = 1;
355 { /* Inline kernel#Int#+ (var1,var2) */
356 var5 = var1 + var2;
357 var3 = var5;
358 goto RET_LABEL4;
359 RET_LABEL4:(void)0;
360 }
361 var6 = ((char* (*)(val*, long))(self->class->vft[COLOR_string__StringCapable__calloc_string]))(self, var3) /* calloc_string on <self:Rope>*/;
362 var_native_final_str = var6;
363 var7 = ((long (*)(val*))(self->class->vft[COLOR_ropes__Rope__length]))(self) /* length on <self:Rope>*/;
364 var8 = '\0';
365 { /* Inline string#NativeString#[]= (var_native_final_str,var7,var8) */
366 var_native_final_str[var7]=var8;
367 RET_LABEL9:(void)0;
368 }
369 var10 = 0;
370 var_offset = var10;
371 var11 = NEW_ropes__DFSRopeLeafIterator(&type_ropes__DFSRopeLeafIterator);
372 ((void (*)(val*, val*))(var11->class->vft[COLOR_ropes__DFSRopeLeafIterator__init]))(var11, self) /* init on <var11:DFSRopeLeafIterator>*/;
373 var_iter = var11;
374 for(;;) {
375 var12 = ((short int (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_iter) /* is_ok on <var_iter:DFSRopeLeafIterator>*/;
376 if (!var12) break;
377 var13 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
378 var14 = ((val* (*)(val*))(var13->class->vft[COLOR_ropes__LeafNode__value]))(var13) /* value on <var13:nullable Object(LeafNode)>*/;
379 var15 = var14->attrs[COLOR_string__AbstractString___items].str; /* _items on <var14:String> */
380 var16 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
381 var17 = ((val* (*)(val*))(var16->class->vft[COLOR_ropes__LeafNode__value]))(var16) /* value on <var16:nullable Object(LeafNode)>*/;
382 var18 = ((long (*)(val*))(var17->class->vft[COLOR_abstract_collection__Collection__length]))(var17) /* length on <var17:String>*/;
383 var19 = 0;
384 { /* Inline string#NativeString#copy_to (var15,var_native_final_str,var18,var19,var_offset) */
385 memcpy(var_native_final_str+var_offset,var15+var19,var18);
386 RET_LABEL20:(void)0;
387 }
388 var21 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
389 var22 = ((val* (*)(val*))(var21->class->vft[COLOR_ropes__LeafNode__value]))(var21) /* value on <var21:nullable Object(LeafNode)>*/;
390 var23 = ((long (*)(val*))(var22->class->vft[COLOR_abstract_collection__Collection__length]))(var22) /* length on <var22:String>*/;
391 { /* Inline kernel#Int#+ (var_offset,var23) */
392 var26 = var_offset + var23;
393 var24 = var26;
394 goto RET_LABEL25;
395 RET_LABEL25:(void)0;
396 }
397 var_offset = var24;
398 ((void (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_iter) /* next on <var_iter:DFSRopeLeafIterator>*/;
399 CONTINUE_label: (void)0;
400 }
401 BREAK_label: (void)0;
402 var27 = ((long (*)(val*))(self->class->vft[COLOR_ropes__Rope__length]))(self) /* length on <self:Rope>*/;
403 var28 = string__NativeString__to_s_with_length(var_native_final_str, var27);
404 var = var28;
405 goto RET_LABEL;
406 RET_LABEL:;
407 return var;
408 }
409 /* method ropes#Rope#flatten for (self: Object): String */
410 val* VIRTUAL_ropes__Rope__flatten(val* self) {
411 val* var /* : String */;
412 val* var1 /* : String */;
413 var1 = ropes__Rope__flatten(self);
414 var = var1;
415 RET_LABEL:;
416 return var;
417 }
418 /* method ropes#Rope#get_node_for_pos for (self: Rope, Int): TupleLeafNodePos */
419 val* ropes__Rope__get_node_for_pos(val* self, long p0) {
420 val* var /* : TupleLeafNodePos */;
421 long var_position /* var position: Int */;
422 short int var1 /* : Bool */;
423 long var2 /* : Int */;
424 short int var3 /* : Bool */;
425 short int var5 /* : Bool */;
426 int cltype;
427 int idtype;
428 const char* var_class_name;
429 short int var6 /* : Bool */;
430 short int var_ /* var : Bool */;
431 long var7 /* : Int */;
432 short int var8 /* : Bool */;
433 short int var10 /* : Bool */;
434 int cltype11;
435 int idtype12;
436 const char* var_class_name13;
437 short int var14 /* : Bool */;
438 val* var15 /* : RopeNode */;
439 val* var_curr_node /* var curr_node: nullable RopeNode */;
440 val* var16 /* : List[TupleVisitNode] */;
441 val* var_visit_stack /* var visit_stack: List[TupleVisitNode] */;
442 short int var17 /* : Bool */;
443 int cltype18;
444 int idtype19;
445 val* var20 /* : TupleVisitNode */;
446 val* var_curr_visit_tuple /* var curr_visit_tuple: TupleVisitNode */;
447 short int var21 /* : Bool */;
448 val* var22 /* : nullable RopeNode */;
449 val* var23 /* : null */;
450 short int var24 /* : Bool */;
451 val* var25 /* : nullable RopeNode */;
452 long var26 /* : Int */;
453 short int var27 /* : Bool */;
454 short int var29 /* : Bool */;
455 int cltype30;
456 int idtype31;
457 const char* var_class_name32;
458 short int var33 /* : Bool */;
459 short int var34 /* : Bool */;
460 val* var35 /* : nullable RopeNode */;
461 val* var36 /* : nullable RopeNode */;
462 val* var37 /* : null */;
463 short int var38 /* : Bool */;
464 short int var39 /* : Bool */;
465 short int var40 /* : Bool */;
466 val* var41 /* : nullable RopeNode */;
467 val* var42 /* : null */;
468 short int var43 /* : Bool */;
469 val* var44 /* : nullable RopeNode */;
470 long var45 /* : Int */;
471 long var46 /* : Int */;
472 long var48 /* : Int */;
473 val* var49 /* : nullable RopeNode */;
474 static val* varonce;
475 val* var50 /* : String */;
476 char* var51 /* : NativeString */;
477 long var52 /* : Int */;
478 val* var53 /* : String */;
479 short int var54 /* : Bool */;
480 int cltype55;
481 int idtype56;
482 val* var57 /* : TupleLeafNodePos */;
483 var_position = p0;
484 var2 = 0;
485 { /* Inline kernel#Int#>= (var_position,var2) */
486 /* Covariant cast for argument 0 (i) <var2:Int> isa OTHER */
487 /* <var2:Int> isa OTHER */
488 var5 = 1; /* easy <var2:Int> isa OTHER*/
489 if (!var5) {
490 var_class_name = type_kernel__Int.name;
491 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name);
492 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 262);
493 show_backtrace(1);
494 }
495 var6 = var_position >= var2;
496 var3 = var6;
497 goto RET_LABEL4;
498 RET_LABEL4:(void)0;
499 }
500 var_ = var3;
501 if (var3){
502 var7 = ((long (*)(val*))(self->class->vft[COLOR_ropes__Rope__length]))(self) /* length on <self:Rope>*/;
503 { /* Inline kernel#Int#< (var_position,var7) */
504 /* Covariant cast for argument 0 (i) <var7:Int> isa OTHER */
505 /* <var7:Int> isa OTHER */
506 var10 = 1; /* easy <var7:Int> isa OTHER*/
507 if (!var10) {
508 var_class_name13 = type_kernel__Int.name;
509 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name13);
510 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 261);
511 show_backtrace(1);
512 }
513 var14 = var_position < var7;
514 var8 = var14;
515 goto RET_LABEL9;
516 RET_LABEL9:(void)0;
517 }
518 var1 = var8;
519 } else {
520 var1 = var_;
521 }
522 if (!var1) {
523 fprintf(stderr, "Runtime error: %s", "Assert failed");
524 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 96);
525 show_backtrace(1);
526 }
527 var15 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__parent_node]))(self) /* parent_node on <self:Rope>*/;
528 var_curr_node = var15;
529 var16 = NEW_list__List(&type_list__Listropes__TupleVisitNode);
530 ((void (*)(val*))(var16->class->vft[COLOR_list__List__init]))(var16) /* init on <var16:List[TupleVisitNode]>*/;
531 var_visit_stack = var16;
532 for(;;) {
533 /* <var_curr_node:nullable RopeNode> isa ConcatNode */
534 cltype18 = type_ropes__ConcatNode.color;
535 idtype19 = type_ropes__ConcatNode.id;
536 if(var_curr_node == NULL) {
537 var17 = 0;
538 } else {
539 if(cltype18 >= var_curr_node->type->table_size) {
540 var17 = 0;
541 } else {
542 var17 = var_curr_node->type->type_table[cltype18] == idtype19;
543 }
544 }
545 if (var17){
546 var20 = NEW_ropes__TupleVisitNode(&type_ropes__TupleVisitNode);
547 ((void (*)(val*, val*))(var20->class->vft[COLOR_ropes__TupleVisitNode__init]))(var20, var_curr_node) /* init on <var20:TupleVisitNode>*/;
548 var_curr_visit_tuple = var20;
549 var22 = ((val* (*)(val*))(var_curr_node->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_curr_node) /* left_child on <var_curr_node:nullable RopeNode(ConcatNode)>*/;
550 var23 = NULL;
551 if (var22 == NULL) {
552 var24 = 0; /* is null */
553 } else {
554 var24 = 1; /* arg is null and recv is not */
555 }
556 if (!var24) {
557 var21 = 0;
558 } else {
559 var25 = ((val* (*)(val*))(var_curr_node->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_curr_node) /* left_child on <var_curr_node:nullable RopeNode(ConcatNode)>*/;
560 if (var25 == NULL) {
561 fprintf(stderr, "Runtime error: %s", "Reciever is null");
562 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 107);
563 show_backtrace(1);
564 } else {
565 var26 = ((long (*)(val*))(var25->class->vft[COLOR_ropes__RopeNode__length]))(var25) /* length on <var25:nullable RopeNode>*/;
566 }
567 { /* Inline kernel#Int#< (var_position,var26) */
568 /* Covariant cast for argument 0 (i) <var26:Int> isa OTHER */
569 /* <var26:Int> isa OTHER */
570 var29 = 1; /* easy <var26:Int> isa OTHER*/
571 if (!var29) {
572 var_class_name32 = type_kernel__Int.name;
573 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name32);
574 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 261);
575 show_backtrace(1);
576 }
577 var33 = var_position < var26;
578 var27 = var33;
579 goto RET_LABEL28;
580 RET_LABEL28:(void)0;
581 }
582 var21 = var27;
583 }
584 if (var21){
585 var34 = 1;
586 ((void (*)(val*, short int))(var_curr_visit_tuple->class->vft[COLOR_ropes__TupleVisitNode__left_visited_61d]))(var_curr_visit_tuple, var34) /* left_visited= on <var_curr_visit_tuple:TupleVisitNode>*/;
587 var35 = ((val* (*)(val*))(var_curr_node->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_curr_node) /* left_child on <var_curr_node:nullable RopeNode(ConcatNode)>*/;
588 var_curr_node = var35;
589 } else {
590 var36 = ((val* (*)(val*))(var_curr_node->class->vft[COLOR_ropes__ConcatNode__right_child]))(var_curr_node) /* right_child on <var_curr_node:nullable RopeNode(ConcatNode)>*/;
591 var37 = NULL;
592 if (var36 == NULL) {
593 var38 = 0; /* is null */
594 } else {
595 var38 = 1; /* arg is null and recv is not */
596 }
597 if (var38){
598 var39 = 1;
599 ((void (*)(val*, short int))(var_curr_visit_tuple->class->vft[COLOR_ropes__TupleVisitNode__left_visited_61d]))(var_curr_visit_tuple, var39) /* left_visited= on <var_curr_visit_tuple:TupleVisitNode>*/;
600 var40 = 1;
601 ((void (*)(val*, short int))(var_curr_visit_tuple->class->vft[COLOR_ropes__TupleVisitNode__right_visited_61d]))(var_curr_visit_tuple, var40) /* right_visited= on <var_curr_visit_tuple:TupleVisitNode>*/;
602 var41 = ((val* (*)(val*))(var_curr_node->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_curr_node) /* left_child on <var_curr_node:nullable RopeNode(ConcatNode)>*/;
603 var42 = NULL;
604 if (var41 == NULL) {
605 var43 = 0; /* is null */
606 } else {
607 var43 = 1; /* arg is null and recv is not */
608 }
609 if (var43){
610 var44 = ((val* (*)(val*))(var_curr_node->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_curr_node) /* left_child on <var_curr_node:nullable RopeNode(ConcatNode)>*/;
611 if (var44 == NULL) {
612 fprintf(stderr, "Runtime error: %s", "Reciever is null");
613 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 113);
614 show_backtrace(1);
615 } else {
616 var45 = ((long (*)(val*))(var44->class->vft[COLOR_ropes__RopeNode__length]))(var44) /* length on <var44:nullable RopeNode>*/;
617 }
618 { /* Inline kernel#Int#- (var_position,var45) */
619 var48 = var_position - var45;
620 var46 = var48;
621 goto RET_LABEL47;
622 RET_LABEL47:(void)0;
623 }
624 var_position = var46;
625 } else {
626 }
627 var49 = ((val* (*)(val*))(var_curr_node->class->vft[COLOR_ropes__ConcatNode__right_child]))(var_curr_node) /* right_child on <var_curr_node:nullable RopeNode(ConcatNode)>*/;
628 var_curr_node = var49;
629 } else {
630 if (varonce) {
631 var50 = varonce;
632 } else {
633 var51 = "Fatal Error";
634 var52 = 11;
635 var53 = string__NativeString__to_s_with_length(var51, var52);
636 var50 = var53;
637 varonce = var50;
638 }
639 ((void (*)(val*, val*))(self->class->vft[COLOR_file__Object__print]))(self, var50) /* print on <self:Rope>*/;
640 fprintf(stderr, "Runtime error: %s", "Aborted");
641 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 117);
642 show_backtrace(1);
643 }
644 }
645 ((void (*)(val*, val*))(var_visit_stack->class->vft[COLOR_abstract_collection__Sequence__push]))(var_visit_stack, var_curr_visit_tuple) /* push on <var_visit_stack:List[TupleVisitNode]>*/;
646 } else {
647 /* <var_curr_node:nullable RopeNode> isa LeafNode */
648 cltype55 = type_ropes__LeafNode.color;
649 idtype56 = type_ropes__LeafNode.id;
650 if(var_curr_node == NULL) {
651 var54 = 0;
652 } else {
653 if(cltype55 >= var_curr_node->type->table_size) {
654 var54 = 0;
655 } else {
656 var54 = var_curr_node->type->type_table[cltype55] == idtype56;
657 }
658 }
659 if (var54){
660 var57 = NEW_ropes__TupleLeafNodePos(&type_ropes__TupleLeafNodePos);
661 ((void (*)(val*, val*, long, val*))(var57->class->vft[COLOR_ropes__TupleLeafNodePos__init]))(var57, var_curr_node, var_position, var_visit_stack) /* init on <var57:TupleLeafNodePos>*/;
662 var = var57;
663 goto RET_LABEL;
664 } else {
665 }
666 }
667 CONTINUE_label: (void)0;
668 }
669 BREAK_label: (void)0;
670 RET_LABEL:;
671 return var;
672 }
673 /* method ropes#Rope#get_node_for_pos for (self: Object, Int): TupleLeafNodePos */
674 val* VIRTUAL_ropes__Rope__get_node_for_pos(val* self, long p0) {
675 val* var /* : TupleLeafNodePos */;
676 val* var1 /* : TupleLeafNodePos */;
677 var1 = ropes__Rope__get_node_for_pos(self, p0);
678 var = var1;
679 RET_LABEL:;
680 return var;
681 }
682 /* method ropes#Rope#+ for (self: Rope, Rope): Rope */
683 val* ropes__Rope___43d(val* self, val* p0) {
684 val* var /* : Rope */;
685 val* var_other /* var other: Rope */;
686 val* var1 /* : BufferRope */;
687 val* var_new_rope /* var new_rope: BufferRope */;
688 val* var2 /* : DFSRopeLeafIterator */;
689 val* var_first_iter /* var first_iter: DFSRopeLeafIterator */;
690 short int var3 /* : Bool */;
691 val* var4 /* : nullable Object */;
692 val* var5 /* : String */;
693 val* var6 /* : BufferRope */;
694 val* var7 /* : DFSRopeLeafIterator */;
695 val* var_second_iter /* var second_iter: DFSRopeLeafIterator */;
696 short int var8 /* : Bool */;
697 val* var9 /* : nullable Object */;
698 val* var10 /* : String */;
699 val* var11 /* : BufferRope */;
700 var_other = p0;
701 var1 = NEW_ropes__BufferRope(&type_ropes__BufferRope);
702 ((void (*)(val*))(var1->class->vft[COLOR_ropes__BufferRope__init]))(var1) /* init on <var1:BufferRope>*/;
703 var_new_rope = var1;
704 var2 = NEW_ropes__DFSRopeLeafIterator(&type_ropes__DFSRopeLeafIterator);
705 ((void (*)(val*, val*))(var2->class->vft[COLOR_ropes__DFSRopeLeafIterator__init]))(var2, self) /* init on <var2:DFSRopeLeafIterator>*/;
706 var_first_iter = var2;
707 for(;;) {
708 var3 = ((short int (*)(val*))(var_first_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_first_iter) /* is_ok on <var_first_iter:DFSRopeLeafIterator>*/;
709 if (!var3) break;
710 var4 = ((val* (*)(val*))(var_first_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_first_iter) /* item on <var_first_iter:DFSRopeLeafIterator>*/;
711 var5 = ((val* (*)(val*))(var4->class->vft[COLOR_ropes__LeafNode__value]))(var4) /* value on <var4:nullable Object(LeafNode)>*/;
712 var6 = ((val* (*)(val*, val*))(var_new_rope->class->vft[COLOR_ropes__BufferRope__append]))(var_new_rope, var5) /* append on <var_new_rope:BufferRope>*/;
713 var6;
714 ((void (*)(val*))(var_first_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_first_iter) /* next on <var_first_iter:DFSRopeLeafIterator>*/;
715 CONTINUE_label: (void)0;
716 }
717 BREAK_label: (void)0;
718 var7 = NEW_ropes__DFSRopeLeafIterator(&type_ropes__DFSRopeLeafIterator);
719 ((void (*)(val*, val*))(var7->class->vft[COLOR_ropes__DFSRopeLeafIterator__init]))(var7, var_other) /* init on <var7:DFSRopeLeafIterator>*/;
720 var_second_iter = var7;
721 for(;;) {
722 var8 = ((short int (*)(val*))(var_second_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_second_iter) /* is_ok on <var_second_iter:DFSRopeLeafIterator>*/;
723 if (!var8) break;
724 var9 = ((val* (*)(val*))(var_second_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_second_iter) /* item on <var_second_iter:DFSRopeLeafIterator>*/;
725 var10 = ((val* (*)(val*))(var9->class->vft[COLOR_ropes__LeafNode__value]))(var9) /* value on <var9:nullable Object(LeafNode)>*/;
726 var11 = ((val* (*)(val*, val*))(var_new_rope->class->vft[COLOR_ropes__BufferRope__append]))(var_new_rope, var10) /* append on <var_new_rope:BufferRope>*/;
727 var11;
728 ((void (*)(val*))(var_second_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_second_iter) /* next on <var_second_iter:DFSRopeLeafIterator>*/;
729 CONTINUE_label12: (void)0;
730 }
731 BREAK_label12: (void)0;
732 var = var_new_rope;
733 goto RET_LABEL;
734 RET_LABEL:;
735 return var;
736 }
737 /* method ropes#Rope#+ for (self: Object, Rope): Rope */
738 val* VIRTUAL_ropes__Rope___43d(val* self, val* p0) {
739 val* var /* : Rope */;
740 val* var1 /* : Rope */;
741 var1 = ropes__Rope___43d(self, p0);
742 var = var1;
743 RET_LABEL:;
744 return var;
745 }
746 /* method ropes#Rope#multi_concat for (self: Rope, Array[Rope]): Rope */
747 val* ropes__Rope__multi_concat(val* self, val* p0) {
748 val* var /* : Rope */;
749 val* var_ropes /* var ropes: Array[Rope] */;
750 val* var1 /* : BufferRope */;
751 val* var_new_rope /* var new_rope: BufferRope */;
752 val* var2 /* : Iterator[LeafNode] */;
753 val* var_self_iter /* var self_iter: Iterator[LeafNode] */;
754 short int var3 /* : Bool */;
755 val* var4 /* : nullable Object */;
756 val* var5 /* : String */;
757 val* var6 /* : BufferRope */;
758 val* var7 /* : Iterator[nullable Object] */;
759 short int var8 /* : Bool */;
760 val* var9 /* : nullable Object */;
761 val* var_i /* var i: Rope */;
762 val* var10 /* : Iterator[LeafNode] */;
763 val* var_iter /* var iter: Iterator[LeafNode] */;
764 short int var11 /* : Bool */;
765 val* var12 /* : nullable Object */;
766 val* var13 /* : String */;
767 val* var14 /* : BufferRope */;
768 var_ropes = p0;
769 var1 = NEW_ropes__BufferRope(&type_ropes__BufferRope);
770 ((void (*)(val*))(var1->class->vft[COLOR_ropes__BufferRope__init]))(var1) /* init on <var1:BufferRope>*/;
771 var_new_rope = var1;
772 var2 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__iterator]))(self) /* iterator on <self:Rope>*/;
773 var_self_iter = var2;
774 for(;;) {
775 var3 = ((short int (*)(val*))(var_self_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_self_iter) /* is_ok on <var_self_iter:Iterator[LeafNode]>*/;
776 if (!var3) break;
777 var4 = ((val* (*)(val*))(var_self_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_self_iter) /* item on <var_self_iter:Iterator[LeafNode]>*/;
778 var5 = ((val* (*)(val*))(var4->class->vft[COLOR_ropes__LeafNode__value]))(var4) /* value on <var4:nullable Object(LeafNode)>*/;
779 var6 = ((val* (*)(val*, val*))(var_new_rope->class->vft[COLOR_ropes__BufferRope__append]))(var_new_rope, var5) /* append on <var_new_rope:BufferRope>*/;
780 var6;
781 ((void (*)(val*))(var_self_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_self_iter) /* next on <var_self_iter:Iterator[LeafNode]>*/;
782 CONTINUE_label: (void)0;
783 }
784 BREAK_label: (void)0;
785 var7 = ((val* (*)(val*))(var_ropes->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_ropes) /* iterator on <var_ropes:Array[Rope]>*/;
786 for(;;) {
787 var8 = ((short int (*)(val*))(var7->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var7) /* is_ok on <var7:Iterator[nullable Object]>*/;
788 if(!var8) break;
789 var9 = ((val* (*)(val*))(var7->class->vft[COLOR_abstract_collection__Iterator__item]))(var7) /* item on <var7:Iterator[nullable Object]>*/;
790 var_i = var9;
791 var10 = ((val* (*)(val*))(var_i->class->vft[COLOR_ropes__Rope__iterator]))(var_i) /* iterator on <var_i:Rope>*/;
792 var_iter = var10;
793 for(;;) {
794 var11 = ((short int (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_iter) /* is_ok on <var_iter:Iterator[LeafNode]>*/;
795 if (!var11) break;
796 var12 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:Iterator[LeafNode]>*/;
797 var13 = ((val* (*)(val*))(var12->class->vft[COLOR_ropes__LeafNode__value]))(var12) /* value on <var12:nullable Object(LeafNode)>*/;
798 var14 = ((val* (*)(val*, val*))(var_new_rope->class->vft[COLOR_ropes__BufferRope__append]))(var_new_rope, var13) /* append on <var_new_rope:BufferRope>*/;
799 var14;
800 ((void (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_iter) /* next on <var_iter:Iterator[LeafNode]>*/;
801 CONTINUE_label15: (void)0;
802 }
803 BREAK_label15: (void)0;
804 CONTINUE_label16: (void)0;
805 ((void (*)(val*))(var7->class->vft[COLOR_abstract_collection__Iterator__next]))(var7) /* next on <var7:Iterator[nullable Object]>*/;
806 }
807 BREAK_label16: (void)0;
808 var = var_new_rope;
809 goto RET_LABEL;
810 RET_LABEL:;
811 return var;
812 }
813 /* method ropes#Rope#multi_concat for (self: Object, Array[Rope]): Rope */
814 val* VIRTUAL_ropes__Rope__multi_concat(val* self, val* p0) {
815 val* var /* : Rope */;
816 val* var1 /* : Rope */;
817 var1 = ropes__Rope__multi_concat(self, p0);
818 var = var1;
819 RET_LABEL:;
820 return var;
821 }
822 /* method ropes#Rope#* for (self: Rope, Int): Rope */
823 val* ropes__Rope___42d(val* self, long p0) {
824 val* var /* : Rope */;
825 long var_repeats /* var repeats: Int */;
826 val* var1 /* : BufferRope */;
827 val* var_new_rope /* var new_rope: BufferRope */;
828 val* var2 /* : String */;
829 val* var_str /* var str: String */;
830 val* var3 /* : Range[Int] */;
831 long var4 /* : Int */;
832 val* var5 /* : Discrete */;
833 val* var6 /* : Discrete */;
834 val* var7 /* : Iterator[nullable Object] */;
835 short int var8 /* : Bool */;
836 val* var9 /* : nullable Object */;
837 long var_i /* var i: Int */;
838 long var10 /* : Int */;
839 val* var11 /* : BufferRope */;
840 var_repeats = p0;
841 var1 = NEW_ropes__BufferRope(&type_ropes__BufferRope);
842 ((void (*)(val*))(var1->class->vft[COLOR_ropes__BufferRope__init]))(var1) /* init on <var1:BufferRope>*/;
843 var_new_rope = var1;
844 var2 = ((val* (*)(val*))(self->class->vft[COLOR_string__Object__to_s]))(self) /* to_s on <self:Rope>*/;
845 var_str = var2;
846 var3 = NEW_range__Range(&type_range__Rangekernel__Int);
847 var4 = 1;
848 var5 = BOX_kernel__Int(var4); /* autobox from Int to Discrete */
849 var6 = BOX_kernel__Int(var_repeats); /* autobox from Int to Discrete */
850 ((void (*)(val*, val*, val*))(var3->class->vft[COLOR_range__Range__init]))(var3, var5, var6) /* init on <var3:Range[Int]>*/;
851 var7 = ((val* (*)(val*))(var3->class->vft[COLOR_abstract_collection__Collection__iterator]))(var3) /* iterator on <var3:Range[Int]>*/;
852 for(;;) {
853 var8 = ((short int (*)(val*))(var7->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var7) /* is_ok on <var7:Iterator[nullable Object]>*/;
854 if(!var8) break;
855 var9 = ((val* (*)(val*))(var7->class->vft[COLOR_abstract_collection__Iterator__item]))(var7) /* item on <var7:Iterator[nullable Object]>*/;
856 var10 = ((struct instance_kernel__Int*)var9)->value; /* autounbox from nullable Object to Int */;
857 var_i = var10;
858 var11 = ((val* (*)(val*, val*))(var_new_rope->class->vft[COLOR_ropes__BufferRope__append]))(var_new_rope, var_str) /* append on <var_new_rope:BufferRope>*/;
859 var11;
860 CONTINUE_label: (void)0;
861 ((void (*)(val*))(var7->class->vft[COLOR_abstract_collection__Iterator__next]))(var7) /* next on <var7:Iterator[nullable Object]>*/;
862 }
863 BREAK_label: (void)0;
864 var = var_new_rope;
865 goto RET_LABEL;
866 RET_LABEL:;
867 return var;
868 }
869 /* method ropes#Rope#* for (self: Object, Int): Rope */
870 val* VIRTUAL_ropes__Rope___42d(val* self, long p0) {
871 val* var /* : Rope */;
872 val* var1 /* : Rope */;
873 var1 = ropes__Rope___42d(self, p0);
874 var = var1;
875 RET_LABEL:;
876 return var;
877 }
878 /* method ropes#Rope#iterator for (self: Rope): Iterator[LeafNode] */
879 val* ropes__Rope__iterator(val* self) {
880 val* var /* : Iterator[LeafNode] */;
881 val* var1 /* : DFSRopeLeafIterator */;
882 var1 = NEW_ropes__DFSRopeLeafIterator(&type_ropes__DFSRopeLeafIterator);
883 ((void (*)(val*, val*))(var1->class->vft[COLOR_ropes__DFSRopeLeafIterator__init]))(var1, self) /* init on <var1:DFSRopeLeafIterator>*/;
884 var = var1;
885 goto RET_LABEL;
886 RET_LABEL:;
887 return var;
888 }
889 /* method ropes#Rope#iterator for (self: Object): Iterator[LeafNode] */
890 val* VIRTUAL_ropes__Rope__iterator(val* self) {
891 val* var /* : Iterator[LeafNode] */;
892 val* var1 /* : Iterator[LeafNode] */;
893 var1 = ropes__Rope__iterator(self);
894 var = var1;
895 RET_LABEL:;
896 return var;
897 }
898 /* method ropes#Rope#subrope for (self: Rope, Int, Int): Rope */
899 val* ropes__Rope__subrope(val* self, long p0, long p1) {
900 val* var /* : Rope */;
901 long var_index_from /* var index_from: Int */;
902 long var_count /* var count: Int */;
903 long var1 /* : Int */;
904 short int var2 /* : Bool */;
905 short int var4 /* : Bool */;
906 int cltype;
907 int idtype;
908 const char* var_class_name;
909 short int var5 /* : Bool */;
910 long var6 /* : Int */;
911 short int var7 /* : Bool */;
912 short int var9 /* : Bool */;
913 int cltype10;
914 int idtype11;
915 const char* var_class_name12;
916 short int var13 /* : Bool */;
917 long var14 /* : Int */;
918 long var16 /* : Int */;
919 long var17 /* : Int */;
920 short int var18 /* : Bool */;
921 short int var20 /* : Bool */;
922 int cltype21;
923 int idtype22;
924 const char* var_class_name23;
925 short int var24 /* : Bool */;
926 long var25 /* : Int */;
927 long var26 /* : Int */;
928 long var27 /* : Int */;
929 long var29 /* : Int */;
930 long var30 /* : Int */;
931 short int var31 /* : Bool */;
932 short int var33 /* : Bool */;
933 int cltype34;
934 int idtype35;
935 const char* var_class_name36;
936 short int var37 /* : Bool */;
937 long var38 /* : Int */;
938 long var39 /* : Int */;
939 long var41 /* : Int */;
940 val* var42 /* : BufferRope */;
941 val* var_buffer /* var buffer: BufferRope */;
942 val* var43 /* : DFSRopeLeafIterator */;
943 val* var_iter /* var iter: DFSRopeLeafIterator */;
944 long var44 /* : Int */;
945 long var45 /* : Int */;
946 long var47 /* : Int */;
947 long var_curr_subrope_index /* var curr_subrope_index: Int */;
948 short int var48 /* : Bool */;
949 long var49 /* : Int */;
950 short int var50 /* : Bool */;
951 short int var52 /* : Bool */;
952 long var53 /* : Int */;
953 short int var54 /* : Bool */;
954 short int var56 /* : Bool */;
955 int cltype57;
956 int idtype58;
957 const char* var_class_name59;
958 short int var60 /* : Bool */;
959 val* var61 /* : nullable Object */;
960 val* var62 /* : String */;
961 long var63 /* : Int */;
962 short int var64 /* : Bool */;
963 short int var66 /* : Bool */;
964 int cltype67;
965 int idtype68;
966 const char* var_class_name69;
967 short int var70 /* : Bool */;
968 val* var71 /* : nullable Object */;
969 val* var72 /* : String */;
970 val* var73 /* : String */;
971 val* var74 /* : BufferRope */;
972 val* var75 /* : nullable Object */;
973 val* var76 /* : String */;
974 long var77 /* : Int */;
975 long var78 /* : Int */;
976 long var80 /* : Int */;
977 long var81 /* : Int */;
978 long var83 /* : Int */;
979 long var84 /* : Int */;
980 val* var85 /* : nullable Object */;
981 val* var86 /* : String */;
982 val* var87 /* : String */;
983 val* var88 /* : BufferRope */;
984 val* var89 /* : nullable Object */;
985 val* var90 /* : String */;
986 long var91 /* : Int */;
987 short int var92 /* : Bool */;
988 short int var94 /* : Bool */;
989 int cltype95;
990 int idtype96;
991 const char* var_class_name97;
992 short int var98 /* : Bool */;
993 val* var99 /* : nullable Object */;
994 val* var100 /* : String */;
995 val* var101 /* : BufferRope */;
996 val* var102 /* : nullable Object */;
997 val* var103 /* : String */;
998 long var104 /* : Int */;
999 long var105 /* : Int */;
1000 long var107 /* : Int */;
1001 val* var108 /* : nullable Object */;
1002 val* var109 /* : String */;
1003 long var110 /* : Int */;
1004 val* var111 /* : String */;
1005 val* var112 /* : BufferRope */;
1006 var_index_from = p0;
1007 var_count = p1;
1008 var1 = 0;
1009 { /* Inline kernel#Int#>= (var_count,var1) */
1010 /* Covariant cast for argument 0 (i) <var1:Int> isa OTHER */
1011 /* <var1:Int> isa OTHER */
1012 var4 = 1; /* easy <var1:Int> isa OTHER*/
1013 if (!var4) {
1014 var_class_name = type_kernel__Int.name;
1015 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name);
1016 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 262);
1017 show_backtrace(1);
1018 }
1019 var5 = var_count >= var1;
1020 var2 = var5;
1021 goto RET_LABEL3;
1022 RET_LABEL3:(void)0;
1023 }
1024 if (!var2) {
1025 fprintf(stderr, "Runtime error: %s", "Assert failed");
1026 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 205);
1027 show_backtrace(1);
1028 }
1029 var6 = 0;
1030 { /* Inline kernel#Int#< (var_index_from,var6) */
1031 /* Covariant cast for argument 0 (i) <var6:Int> isa OTHER */
1032 /* <var6:Int> isa OTHER */
1033 var9 = 1; /* easy <var6:Int> isa OTHER*/
1034 if (!var9) {
1035 var_class_name12 = type_kernel__Int.name;
1036 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name12);
1037 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 261);
1038 show_backtrace(1);
1039 }
1040 var13 = var_index_from < var6;
1041 var7 = var13;
1042 goto RET_LABEL8;
1043 RET_LABEL8:(void)0;
1044 }
1045 if (var7){
1046 { /* Inline kernel#Int#+ (var_count,var_index_from) */
1047 var16 = var_count + var_index_from;
1048 var14 = var16;
1049 goto RET_LABEL15;
1050 RET_LABEL15:(void)0;
1051 }
1052 var_count = var14;
1053 var17 = 0;
1054 { /* Inline kernel#Int#< (var_count,var17) */
1055 /* Covariant cast for argument 0 (i) <var17:Int> isa OTHER */
1056 /* <var17:Int> isa OTHER */
1057 var20 = 1; /* easy <var17:Int> isa OTHER*/
1058 if (!var20) {
1059 var_class_name23 = type_kernel__Int.name;
1060 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name23);
1061 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 261);
1062 show_backtrace(1);
1063 }
1064 var24 = var_count < var17;
1065 var18 = var24;
1066 goto RET_LABEL19;
1067 RET_LABEL19:(void)0;
1068 }
1069 if (var18){
1070 var25 = 0;
1071 var_count = var25;
1072 } else {
1073 }
1074 var26 = 0;
1075 var_index_from = var26;
1076 } else {
1077 }
1078 { /* Inline kernel#Int#- (var_count,var_index_from) */
1079 var29 = var_count - var_index_from;
1080 var27 = var29;
1081 goto RET_LABEL28;
1082 RET_LABEL28:(void)0;
1083 }
1084 var30 = ((long (*)(val*))(self->class->vft[COLOR_ropes__Rope__length]))(self) /* length on <self:Rope>*/;
1085 { /* Inline kernel#Int#>= (var27,var30) */
1086 /* Covariant cast for argument 0 (i) <var30:Int> isa OTHER */
1087 /* <var30:Int> isa OTHER */
1088 var33 = 1; /* easy <var30:Int> isa OTHER*/
1089 if (!var33) {
1090 var_class_name36 = type_kernel__Int.name;
1091 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name36);
1092 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 262);
1093 show_backtrace(1);
1094 }
1095 var37 = var27 >= var30;
1096 var31 = var37;
1097 goto RET_LABEL32;
1098 RET_LABEL32:(void)0;
1099 }
1100 if (var31){
1101 var38 = ((long (*)(val*))(self->class->vft[COLOR_ropes__Rope__length]))(self) /* length on <self:Rope>*/;
1102 { /* Inline kernel#Int#- (var38,var_index_from) */
1103 var41 = var38 - var_index_from;
1104 var39 = var41;
1105 goto RET_LABEL40;
1106 RET_LABEL40:(void)0;
1107 }
1108 var_count = var39;
1109 } else {
1110 }
1111 var42 = NEW_ropes__BufferRope(&type_ropes__BufferRope);
1112 ((void (*)(val*))(var42->class->vft[COLOR_ropes__BufferRope__init]))(var42) /* init on <var42:BufferRope>*/;
1113 var_buffer = var42;
1114 var43 = NEW_ropes__DFSRopeLeafIterator(&type_ropes__DFSRopeLeafIterator);
1115 ((void (*)(val*, val*, long))(var43->class->vft[COLOR_ropes__DFSRopeLeafIterator__with_index]))(var43, self, var_index_from) /* with_index on <var43:DFSRopeLeafIterator>*/;
1116 var_iter = var43;
1117 var44 = ((long (*)(val*))(var_iter->class->vft[COLOR_ropes__RopeIterator__pos]))(var_iter) /* pos on <var_iter:DFSRopeLeafIterator>*/;
1118 { /* Inline kernel#Int#- (var_index_from,var44) */
1119 var47 = var_index_from - var44;
1120 var45 = var47;
1121 goto RET_LABEL46;
1122 RET_LABEL46:(void)0;
1123 }
1124 var_curr_subrope_index = var45;
1125 for(;;) {
1126 var48 = ((short int (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_iter) /* is_ok on <var_iter:DFSRopeLeafIterator>*/;
1127 if (!var48) break;
1128 var49 = 0;
1129 { /* Inline kernel#Int#== (var_count,var49) */
1130 var52 = var_count == var49;
1131 var50 = var52;
1132 goto RET_LABEL51;
1133 RET_LABEL51:(void)0;
1134 }
1135 if (var50){
1136 goto BREAK_label;
1137 } else {
1138 }
1139 var53 = 0;
1140 { /* Inline kernel#Int#> (var_curr_subrope_index,var53) */
1141 /* Covariant cast for argument 0 (i) <var53:Int> isa OTHER */
1142 /* <var53:Int> isa OTHER */
1143 var56 = 1; /* easy <var53:Int> isa OTHER*/
1144 if (!var56) {
1145 var_class_name59 = type_kernel__Int.name;
1146 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name59);
1147 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 263);
1148 show_backtrace(1);
1149 }
1150 var60 = var_curr_subrope_index > var53;
1151 var54 = var60;
1152 goto RET_LABEL55;
1153 RET_LABEL55:(void)0;
1154 }
1155 if (var54){
1156 var61 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
1157 var62 = ((val* (*)(val*))(var61->class->vft[COLOR_ropes__LeafNode__value]))(var61) /* value on <var61:nullable Object(LeafNode)>*/;
1158 var63 = ((long (*)(val*))(var62->class->vft[COLOR_abstract_collection__Collection__length]))(var62) /* length on <var62:String>*/;
1159 { /* Inline kernel#Int#>= (var_count,var63) */
1160 /* Covariant cast for argument 0 (i) <var63:Int> isa OTHER */
1161 /* <var63:Int> isa OTHER */
1162 var66 = 1; /* easy <var63:Int> isa OTHER*/
1163 if (!var66) {
1164 var_class_name69 = type_kernel__Int.name;
1165 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name69);
1166 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 262);
1167 show_backtrace(1);
1168 }
1169 var70 = var_count >= var63;
1170 var64 = var70;
1171 goto RET_LABEL65;
1172 RET_LABEL65:(void)0;
1173 }
1174 if (var64){
1175 var71 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
1176 var72 = ((val* (*)(val*))(var71->class->vft[COLOR_ropes__LeafNode__value]))(var71) /* value on <var71:nullable Object(LeafNode)>*/;
1177 var73 = ((val* (*)(val*, long, long))(var72->class->vft[COLOR_string__AbstractString__substring]))(var72, var_curr_subrope_index, var_count) /* substring on <var72:String>*/;
1178 var74 = ((val* (*)(val*, val*))(var_buffer->class->vft[COLOR_ropes__BufferRope__append]))(var_buffer, var73) /* append on <var_buffer:BufferRope>*/;
1179 var74;
1180 var75 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
1181 var76 = ((val* (*)(val*))(var75->class->vft[COLOR_ropes__LeafNode__value]))(var75) /* value on <var75:nullable Object(LeafNode)>*/;
1182 var77 = ((long (*)(val*))(var76->class->vft[COLOR_abstract_collection__Collection__length]))(var76) /* length on <var76:String>*/;
1183 { /* Inline kernel#Int#- (var77,var_curr_subrope_index) */
1184 var80 = var77 - var_curr_subrope_index;
1185 var78 = var80;
1186 goto RET_LABEL79;
1187 RET_LABEL79:(void)0;
1188 }
1189 { /* Inline kernel#Int#- (var_count,var78) */
1190 var83 = var_count - var78;
1191 var81 = var83;
1192 goto RET_LABEL82;
1193 RET_LABEL82:(void)0;
1194 }
1195 var_count = var81;
1196 var84 = 0;
1197 var_curr_subrope_index = var84;
1198 } else {
1199 var85 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
1200 var86 = ((val* (*)(val*))(var85->class->vft[COLOR_ropes__LeafNode__value]))(var85) /* value on <var85:nullable Object(LeafNode)>*/;
1201 var87 = ((val* (*)(val*, long, long))(var86->class->vft[COLOR_string__AbstractString__substring]))(var86, var_curr_subrope_index, var_count) /* substring on <var86:String>*/;
1202 var88 = ((val* (*)(val*, val*))(var_buffer->class->vft[COLOR_ropes__BufferRope__append]))(var_buffer, var87) /* append on <var_buffer:BufferRope>*/;
1203 var88;
1204 goto BREAK_label;
1205 }
1206 } else {
1207 var89 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
1208 var90 = ((val* (*)(val*))(var89->class->vft[COLOR_ropes__LeafNode__value]))(var89) /* value on <var89:nullable Object(LeafNode)>*/;
1209 var91 = ((long (*)(val*))(var90->class->vft[COLOR_abstract_collection__Collection__length]))(var90) /* length on <var90:String>*/;
1210 { /* Inline kernel#Int#>= (var_count,var91) */
1211 /* Covariant cast for argument 0 (i) <var91:Int> isa OTHER */
1212 /* <var91:Int> isa OTHER */
1213 var94 = 1; /* easy <var91:Int> isa OTHER*/
1214 if (!var94) {
1215 var_class_name97 = type_kernel__Int.name;
1216 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name97);
1217 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 262);
1218 show_backtrace(1);
1219 }
1220 var98 = var_count >= var91;
1221 var92 = var98;
1222 goto RET_LABEL93;
1223 RET_LABEL93:(void)0;
1224 }
1225 if (var92){
1226 var99 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
1227 var100 = ((val* (*)(val*))(var99->class->vft[COLOR_ropes__LeafNode__value]))(var99) /* value on <var99:nullable Object(LeafNode)>*/;
1228 var101 = ((val* (*)(val*, val*))(var_buffer->class->vft[COLOR_ropes__BufferRope__append]))(var_buffer, var100) /* append on <var_buffer:BufferRope>*/;
1229 var101;
1230 var102 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
1231 var103 = ((val* (*)(val*))(var102->class->vft[COLOR_ropes__LeafNode__value]))(var102) /* value on <var102:nullable Object(LeafNode)>*/;
1232 var104 = ((long (*)(val*))(var103->class->vft[COLOR_abstract_collection__Collection__length]))(var103) /* length on <var103:String>*/;
1233 { /* Inline kernel#Int#- (var_count,var104) */
1234 var107 = var_count - var104;
1235 var105 = var107;
1236 goto RET_LABEL106;
1237 RET_LABEL106:(void)0;
1238 }
1239 var_count = var105;
1240 } else {
1241 var108 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
1242 var109 = ((val* (*)(val*))(var108->class->vft[COLOR_ropes__LeafNode__value]))(var108) /* value on <var108:nullable Object(LeafNode)>*/;
1243 var110 = 0;
1244 var111 = ((val* (*)(val*, long, long))(var109->class->vft[COLOR_string__AbstractString__substring]))(var109, var110, var_count) /* substring on <var109:String>*/;
1245 var112 = ((val* (*)(val*, val*))(var_buffer->class->vft[COLOR_ropes__BufferRope__append]))(var_buffer, var111) /* append on <var_buffer:BufferRope>*/;
1246 var112;
1247 goto BREAK_label;
1248 }
1249 }
1250 ((void (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_iter) /* next on <var_iter:DFSRopeLeafIterator>*/;
1251 CONTINUE_label: (void)0;
1252 }
1253 BREAK_label: (void)0;
1254 var = var_buffer;
1255 goto RET_LABEL;
1256 RET_LABEL:;
1257 return var;
1258 }
1259 /* method ropes#Rope#subrope for (self: Object, Int, Int): Rope */
1260 val* VIRTUAL_ropes__Rope__subrope(val* self, long p0, long p1) {
1261 val* var /* : Rope */;
1262 val* var1 /* : Rope */;
1263 var1 = ropes__Rope__subrope(self, p0, p1);
1264 var = var1;
1265 RET_LABEL:;
1266 return var;
1267 }
1268 /* method ropes#Rope#to_upper for (self: Rope): Rope */
1269 val* ropes__Rope__to_upper(val* self) {
1270 val* var /* : Rope */;
1271 val* var1 /* : BufferRope */;
1272 val* var_new_rope /* var new_rope: BufferRope */;
1273 val* var2 /* : DFSRopeLeafIterator */;
1274 val* var_iter /* var iter: DFSRopeLeafIterator */;
1275 short int var3 /* : Bool */;
1276 val* var4 /* : nullable Object */;
1277 val* var5 /* : String */;
1278 val* var6 /* : String */;
1279 val* var7 /* : BufferRope */;
1280 var1 = NEW_ropes__BufferRope(&type_ropes__BufferRope);
1281 ((void (*)(val*))(var1->class->vft[COLOR_ropes__BufferRope__init]))(var1) /* init on <var1:BufferRope>*/;
1282 var_new_rope = var1;
1283 var2 = NEW_ropes__DFSRopeLeafIterator(&type_ropes__DFSRopeLeafIterator);
1284 ((void (*)(val*, val*))(var2->class->vft[COLOR_ropes__DFSRopeLeafIterator__init]))(var2, self) /* init on <var2:DFSRopeLeafIterator>*/;
1285 var_iter = var2;
1286 for(;;) {
1287 var3 = ((short int (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_iter) /* is_ok on <var_iter:DFSRopeLeafIterator>*/;
1288 if (!var3) break;
1289 var4 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
1290 var5 = ((val* (*)(val*))(var4->class->vft[COLOR_ropes__LeafNode__value]))(var4) /* value on <var4:nullable Object(LeafNode)>*/;
1291 var6 = ((val* (*)(val*))(var5->class->vft[COLOR_string__AbstractString__to_upper]))(var5) /* to_upper on <var5:String>*/;
1292 var7 = ((val* (*)(val*, val*))(var_new_rope->class->vft[COLOR_ropes__BufferRope__append]))(var_new_rope, var6) /* append on <var_new_rope:BufferRope>*/;
1293 var7;
1294 ((void (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_iter) /* next on <var_iter:DFSRopeLeafIterator>*/;
1295 CONTINUE_label: (void)0;
1296 }
1297 BREAK_label: (void)0;
1298 var = var_new_rope;
1299 goto RET_LABEL;
1300 RET_LABEL:;
1301 return var;
1302 }
1303 /* method ropes#Rope#to_upper for (self: Object): Rope */
1304 val* VIRTUAL_ropes__Rope__to_upper(val* self) {
1305 val* var /* : Rope */;
1306 val* var1 /* : Rope */;
1307 var1 = ropes__Rope__to_upper(self);
1308 var = var1;
1309 RET_LABEL:;
1310 return var;
1311 }
1312 /* method ropes#Rope#to_lower for (self: Rope): Rope */
1313 val* ropes__Rope__to_lower(val* self) {
1314 val* var /* : Rope */;
1315 val* var1 /* : BufferRope */;
1316 val* var_new_rope /* var new_rope: BufferRope */;
1317 val* var2 /* : DFSRopeLeafIterator */;
1318 val* var_iter /* var iter: DFSRopeLeafIterator */;
1319 short int var3 /* : Bool */;
1320 val* var4 /* : nullable Object */;
1321 val* var5 /* : String */;
1322 val* var6 /* : String */;
1323 val* var7 /* : BufferRope */;
1324 var1 = NEW_ropes__BufferRope(&type_ropes__BufferRope);
1325 ((void (*)(val*))(var1->class->vft[COLOR_ropes__BufferRope__init]))(var1) /* init on <var1:BufferRope>*/;
1326 var_new_rope = var1;
1327 var2 = NEW_ropes__DFSRopeLeafIterator(&type_ropes__DFSRopeLeafIterator);
1328 ((void (*)(val*, val*))(var2->class->vft[COLOR_ropes__DFSRopeLeafIterator__init]))(var2, self) /* init on <var2:DFSRopeLeafIterator>*/;
1329 var_iter = var2;
1330 for(;;) {
1331 var3 = ((short int (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_iter) /* is_ok on <var_iter:DFSRopeLeafIterator>*/;
1332 if (!var3) break;
1333 var4 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
1334 var5 = ((val* (*)(val*))(var4->class->vft[COLOR_ropes__LeafNode__value]))(var4) /* value on <var4:nullable Object(LeafNode)>*/;
1335 var6 = ((val* (*)(val*))(var5->class->vft[COLOR_string__AbstractString__to_lower]))(var5) /* to_lower on <var5:String>*/;
1336 var7 = ((val* (*)(val*, val*))(var_new_rope->class->vft[COLOR_ropes__BufferRope__append]))(var_new_rope, var6) /* append on <var_new_rope:BufferRope>*/;
1337 var7;
1338 ((void (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_iter) /* next on <var_iter:DFSRopeLeafIterator>*/;
1339 CONTINUE_label: (void)0;
1340 }
1341 BREAK_label: (void)0;
1342 var = var_new_rope;
1343 goto RET_LABEL;
1344 RET_LABEL:;
1345 return var;
1346 }
1347 /* method ropes#Rope#to_lower for (self: Object): Rope */
1348 val* VIRTUAL_ropes__Rope__to_lower(val* self) {
1349 val* var /* : Rope */;
1350 val* var1 /* : Rope */;
1351 var1 = ropes__Rope__to_lower(self);
1352 var = var1;
1353 RET_LABEL:;
1354 return var;
1355 }
1356 /* method ropes#Rope#== for (self: Rope, nullable Object): Bool */
1357 short int ropes__Rope___61d_61d(val* self, val* p0) {
1358 short int var /* : Bool */;
1359 val* var_other /* var other: nullable Object */;
1360 short int var1 /* : Bool */;
1361 val* var2 /* : null */;
1362 short int var3 /* : Bool */;
1363 short int var_ /* var : Bool */;
1364 short int var4 /* : Bool */;
1365 short int var5 /* : Bool */;
1366 int cltype;
1367 int idtype;
1368 short int var_6 /* var : Bool */;
1369 short int var7 /* : Bool */;
1370 int cltype8;
1371 int idtype9;
1372 short int var10 /* : Bool */;
1373 short int var11 /* : Bool */;
1374 val* var12 /* : RopeCharIterator */;
1375 val* var_self_iter /* var self_iter: RopeCharIterator */;
1376 short int var13 /* : Bool */;
1377 int cltype14;
1378 int idtype15;
1379 long var16 /* : Int */;
1380 long var17 /* : Int */;
1381 short int var18 /* : Bool */;
1382 short int var20 /* : Bool */;
1383 short int var21 /* : Bool */;
1384 short int var22 /* : Bool */;
1385 val* var23 /* : RopeCharIterator */;
1386 val* var_other_iterator /* var other_iterator: RopeCharIterator */;
1387 short int var24 /* : Bool */;
1388 val* var25 /* : nullable Object */;
1389 val* var26 /* : nullable Object */;
1390 short int var27 /* : Bool */;
1391 short int var29 /* : Bool */;
1392 short int var30 /* : Bool */;
1393 short int var31 /* : Bool */;
1394 short int var32 /* : Bool */;
1395 int cltype33;
1396 int idtype34;
1397 long var35 /* : Int */;
1398 long var_pos /* var pos: Int */;
1399 long var36 /* : Int */;
1400 long var37 /* : Int */;
1401 short int var38 /* : Bool */;
1402 short int var40 /* : Bool */;
1403 short int var41 /* : Bool */;
1404 short int var42 /* : Bool */;
1405 short int var43 /* : Bool */;
1406 val* var44 /* : nullable Object */;
1407 val* var45 /* : nullable Object */;
1408 short int var46 /* : Bool */;
1409 short int var48 /* : Bool */;
1410 short int var49 /* : Bool */;
1411 short int var50 /* : Bool */;
1412 long var51 /* : Int */;
1413 long var52 /* : Int */;
1414 long var54 /* : Int */;
1415 short int var56 /* : Bool */;
1416 var_other = p0;
1417 var2 = NULL;
1418 if (var_other == NULL) {
1419 var3 = 1; /* is null */
1420 } else {
1421 var3 = 0; /* arg is null but recv is not */
1422 }
1423 var_ = var3;
1424 if (var3){
1425 var1 = var_;
1426 } else {
1427 /* <var_other:nullable Object(Object)> isa Rope */
1428 cltype = type_ropes__Rope.color;
1429 idtype = type_ropes__Rope.id;
1430 if(cltype >= var_other->type->table_size) {
1431 var5 = 0;
1432 } else {
1433 var5 = var_other->type->type_table[cltype] == idtype;
1434 }
1435 var_6 = var5;
1436 if (var5){
1437 var4 = var_6;
1438 } else {
1439 /* <var_other:nullable Object(Object)> isa AbstractString */
1440 cltype8 = type_string__AbstractString.color;
1441 idtype9 = type_string__AbstractString.id;
1442 if(cltype8 >= var_other->type->table_size) {
1443 var7 = 0;
1444 } else {
1445 var7 = var_other->type->type_table[cltype8] == idtype9;
1446 }
1447 var4 = var7;
1448 }
1449 var10 = !var4;
1450 var1 = var10;
1451 }
1452 if (var1){
1453 var11 = 0;
1454 var = var11;
1455 goto RET_LABEL;
1456 } else {
1457 }
1458 var12 = NEW_ropes__RopeCharIterator(&type_ropes__RopeCharIterator);
1459 ((void (*)(val*, val*))(var12->class->vft[COLOR_ropes__RopeCharIterator__init]))(var12, self) /* init on <var12:RopeCharIterator>*/;
1460 var_self_iter = var12;
1461 /* <var_other:nullable Object> isa Rope */
1462 cltype14 = type_ropes__Rope.color;
1463 idtype15 = type_ropes__Rope.id;
1464 if(var_other == NULL) {
1465 var13 = 0;
1466 } else {
1467 if(cltype14 >= var_other->type->table_size) {
1468 var13 = 0;
1469 } else {
1470 var13 = var_other->type->type_table[cltype14] == idtype15;
1471 }
1472 }
1473 if (var13){
1474 var16 = ((long (*)(val*))(self->class->vft[COLOR_ropes__Rope__length]))(self) /* length on <self:Rope>*/;
1475 var17 = ((long (*)(val*))(var_other->class->vft[COLOR_ropes__Rope__length]))(var_other) /* length on <var_other:nullable Object(Rope)>*/;
1476 { /* Inline kernel#Int#!= (var16,var17) */
1477 var20 = var16 == var17;
1478 var21 = !var20;
1479 var18 = var21;
1480 goto RET_LABEL19;
1481 RET_LABEL19:(void)0;
1482 }
1483 if (var18){
1484 var22 = 0;
1485 var = var22;
1486 goto RET_LABEL;
1487 } else {
1488 }
1489 var23 = NEW_ropes__RopeCharIterator(&type_ropes__RopeCharIterator);
1490 ((void (*)(val*, val*))(var23->class->vft[COLOR_ropes__RopeCharIterator__init]))(var23, var_other) /* init on <var23:RopeCharIterator>*/;
1491 var_other_iterator = var23;
1492 for(;;) {
1493 var24 = ((short int (*)(val*))(var_self_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_self_iter) /* is_ok on <var_self_iter:RopeCharIterator>*/;
1494 if (!var24) break;
1495 var25 = ((val* (*)(val*))(var_self_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_self_iter) /* item on <var_self_iter:RopeCharIterator>*/;
1496 var26 = ((val* (*)(val*))(var_other_iterator->class->vft[COLOR_abstract_collection__Iterator__item]))(var_other_iterator) /* item on <var_other_iterator:RopeCharIterator>*/;
1497 { /* Inline kernel#Char#!= (var25,var26) */
1498 var29 = var25 == var26 || (((struct instance_kernel__Char*)var25)->value == ((struct instance_kernel__Char*)var26)->value);
1499 var30 = !var29;
1500 var27 = var30;
1501 goto RET_LABEL28;
1502 RET_LABEL28:(void)0;
1503 }
1504 if (var27){
1505 var31 = 0;
1506 var = var31;
1507 goto RET_LABEL;
1508 } else {
1509 }
1510 ((void (*)(val*))(var_self_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_self_iter) /* next on <var_self_iter:RopeCharIterator>*/;
1511 ((void (*)(val*))(var_other_iterator->class->vft[COLOR_abstract_collection__Iterator__next]))(var_other_iterator) /* next on <var_other_iterator:RopeCharIterator>*/;
1512 CONTINUE_label: (void)0;
1513 }
1514 BREAK_label: (void)0;
1515 } else {
1516 /* <var_other:nullable Object> isa AbstractString */
1517 cltype33 = type_string__AbstractString.color;
1518 idtype34 = type_string__AbstractString.id;
1519 if(var_other == NULL) {
1520 var32 = 0;
1521 } else {
1522 if(cltype33 >= var_other->type->table_size) {
1523 var32 = 0;
1524 } else {
1525 var32 = var_other->type->type_table[cltype33] == idtype34;
1526 }
1527 }
1528 if (var32){
1529 var35 = 0;
1530 var_pos = var35;
1531 var36 = ((long (*)(val*))(self->class->vft[COLOR_ropes__Rope__length]))(self) /* length on <self:Rope>*/;
1532 var37 = ((long (*)(val*))(var_other->class->vft[COLOR_abstract_collection__Collection__length]))(var_other) /* length on <var_other:nullable Object(AbstractString)>*/;
1533 { /* Inline kernel#Int#!= (var36,var37) */
1534 var40 = var36 == var37;
1535 var41 = !var40;
1536 var38 = var41;
1537 goto RET_LABEL39;
1538 RET_LABEL39:(void)0;
1539 }
1540 if (var38){
1541 var42 = 0;
1542 var = var42;
1543 goto RET_LABEL;
1544 } else {
1545 }
1546 for(;;) {
1547 var43 = ((short int (*)(val*))(var_self_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_self_iter) /* is_ok on <var_self_iter:RopeCharIterator>*/;
1548 if (!var43) break;
1549 var44 = ((val* (*)(val*))(var_self_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_self_iter) /* item on <var_self_iter:RopeCharIterator>*/;
1550 var45 = ((val* (*)(val*, long))(var_other->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(var_other, var_pos) /* [] on <var_other:nullable Object(AbstractString)>*/;
1551 { /* Inline kernel#Char#!= (var44,var45) */
1552 var48 = var44 == var45 || (((struct instance_kernel__Char*)var44)->value == ((struct instance_kernel__Char*)var45)->value);
1553 var49 = !var48;
1554 var46 = var49;
1555 goto RET_LABEL47;
1556 RET_LABEL47:(void)0;
1557 }
1558 if (var46){
1559 var50 = 0;
1560 var = var50;
1561 goto RET_LABEL;
1562 } else {
1563 }
1564 var51 = 1;
1565 { /* Inline kernel#Int#+ (var_pos,var51) */
1566 var54 = var_pos + var51;
1567 var52 = var54;
1568 goto RET_LABEL53;
1569 RET_LABEL53:(void)0;
1570 }
1571 var_pos = var52;
1572 ((void (*)(val*))(var_self_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_self_iter) /* next on <var_self_iter:RopeCharIterator>*/;
1573 CONTINUE_label55: (void)0;
1574 }
1575 BREAK_label55: (void)0;
1576 } else {
1577 }
1578 }
1579 var56 = 1;
1580 var = var56;
1581 goto RET_LABEL;
1582 RET_LABEL:;
1583 return var;
1584 }
1585 /* method ropes#Rope#== for (self: Object, nullable Object): Bool */
1586 short int VIRTUAL_ropes__Rope___61d_61d(val* self, val* p0) {
1587 short int var /* : Bool */;
1588 short int var1 /* : Bool */;
1589 var1 = ropes__Rope___61d_61d(self, p0);
1590 var = var1;
1591 RET_LABEL:;
1592 return var;
1593 }
1594 /* method ropes#Rope#< for (self: Rope, Rope): Bool */
1595 short int ropes__Rope___60d(val* self, val* p0) {
1596 short int var /* : Bool */;
1597 short int var1 /* : Bool */;
1598 int cltype;
1599 int idtype;
1600 const struct type* type_struct;
1601 const char* var_class_name;
1602 val* var_other /* var other: Rope */;
1603 val* var2 /* : SequenceRead[Char] */;
1604 val* var3 /* : Iterator[nullable Object] */;
1605 val* var_other_iter /* var other_iter: IndexedIterator[Char] */;
1606 val* var4 /* : SequenceRead[Char] */;
1607 val* var5 /* : Iterator[nullable Object] */;
1608 short int var6 /* : Bool */;
1609 val* var7 /* : nullable Object */;
1610 char var_i /* var i: Char */;
1611 char var8 /* : Char */;
1612 short int var9 /* : Bool */;
1613 short int var10 /* : Bool */;
1614 short int var11 /* : Bool */;
1615 val* var12 /* : nullable Object */;
1616 short int var13 /* : Bool */;
1617 short int var15 /* : Bool */;
1618 int cltype16;
1619 int idtype17;
1620 const char* var_class_name18;
1621 char var19 /* : Char */;
1622 short int var20 /* : Bool */;
1623 short int var21 /* : Bool */;
1624 val* var22 /* : nullable Object */;
1625 short int var23 /* : Bool */;
1626 short int var25 /* : Bool */;
1627 int cltype26;
1628 int idtype27;
1629 const char* var_class_name28;
1630 char var29 /* : Char */;
1631 short int var30 /* : Bool */;
1632 short int var31 /* : Bool */;
1633 short int var32 /* : Bool */;
1634 short int var33 /* : Bool */;
1635 short int var34 /* : Bool */;
1636 /* Covariant cast for argument 0 (other) <p0:Rope> isa OTHER */
1637 /* <p0:Rope> isa OTHER */
1638 type_struct = self->type->resolution_table->types[COLOR_kernel__Comparable_VTOTHER];
1639 cltype = type_struct->color;
1640 idtype = type_struct->id;
1641 if(cltype >= p0->type->table_size) {
1642 var1 = 0;
1643 } else {
1644 var1 = p0->type->type_table[cltype] == idtype;
1645 }
1646 if (!var1) {
1647 var_class_name = p0 == NULL ? "null" : p0->type->name;
1648 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name);
1649 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 301);
1650 show_backtrace(1);
1651 }
1652 var_other = p0;
1653 var2 = ((val* (*)(val*))(var_other->class->vft[COLOR_ropes__Rope__chars]))(var_other) /* chars on <var_other:Rope>*/;
1654 var3 = ((val* (*)(val*))(var2->class->vft[COLOR_abstract_collection__Collection__iterator]))(var2) /* iterator on <var2:SequenceRead[Char]>*/;
1655 var_other_iter = var3;
1656 var4 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__chars]))(self) /* chars on <self:Rope>*/;
1657 var5 = ((val* (*)(val*))(var4->class->vft[COLOR_abstract_collection__Collection__iterator]))(var4) /* iterator on <var4:SequenceRead[Char]>*/;
1658 for(;;) {
1659 var6 = ((short int (*)(val*))(var5->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var5) /* is_ok on <var5:Iterator[nullable Object]>*/;
1660 if(!var6) break;
1661 var7 = ((val* (*)(val*))(var5->class->vft[COLOR_abstract_collection__Iterator__item]))(var5) /* item on <var5:Iterator[nullable Object]>*/;
1662 var8 = ((struct instance_kernel__Char*)var7)->value; /* autounbox from nullable Object to Char */;
1663 var_i = var8;
1664 var9 = ((short int (*)(val*))(var_other_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_other_iter) /* is_ok on <var_other_iter:IndexedIterator[Char]>*/;
1665 var10 = !var9;
1666 if (var10){
1667 var11 = 0;
1668 var = var11;
1669 goto RET_LABEL;
1670 } else {
1671 }
1672 var12 = ((val* (*)(val*))(var_other_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_other_iter) /* item on <var_other_iter:IndexedIterator[Char]>*/;
1673 { /* Inline kernel#Char#< (var_i,var12) */
1674 /* Covariant cast for argument 0 (i) <var12:nullable Object(Char)> isa OTHER */
1675 /* <var12:nullable Object(Char)> isa OTHER */
1676 var15 = 1; /* easy <var12:nullable Object(Char)> isa OTHER*/
1677 if (!var15) {
1678 var_class_name18 = var12 == NULL ? "null" : var12->type->name;
1679 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name18);
1680 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 437);
1681 show_backtrace(1);
1682 }
1683 var19 = ((struct instance_kernel__Char*)var12)->value; /* autounbox from nullable Object to Char */;
1684 var20 = var_i < var19;
1685 var13 = var20;
1686 goto RET_LABEL14;
1687 RET_LABEL14:(void)0;
1688 }
1689 if (var13){
1690 var21 = 1;
1691 var = var21;
1692 goto RET_LABEL;
1693 } else {
1694 }
1695 var22 = ((val* (*)(val*))(var_other_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_other_iter) /* item on <var_other_iter:IndexedIterator[Char]>*/;
1696 { /* Inline kernel#Char#> (var_i,var22) */
1697 /* Covariant cast for argument 0 (i) <var22:nullable Object(Char)> isa OTHER */
1698 /* <var22:nullable Object(Char)> isa OTHER */
1699 var25 = 1; /* easy <var22:nullable Object(Char)> isa OTHER*/
1700 if (!var25) {
1701 var_class_name28 = var22 == NULL ? "null" : var22->type->name;
1702 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name28);
1703 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 439);
1704 show_backtrace(1);
1705 }
1706 var29 = ((struct instance_kernel__Char*)var22)->value; /* autounbox from nullable Object to Char */;
1707 var30 = var_i > var29;
1708 var23 = var30;
1709 goto RET_LABEL24;
1710 RET_LABEL24:(void)0;
1711 }
1712 if (var23){
1713 var31 = 0;
1714 var = var31;
1715 goto RET_LABEL;
1716 } else {
1717 }
1718 ((void (*)(val*))(var_other_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_other_iter) /* next on <var_other_iter:IndexedIterator[Char]>*/;
1719 CONTINUE_label: (void)0;
1720 ((void (*)(val*))(var5->class->vft[COLOR_abstract_collection__Iterator__next]))(var5) /* next on <var5:Iterator[nullable Object]>*/;
1721 }
1722 BREAK_label: (void)0;
1723 var32 = ((short int (*)(val*))(var_other_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_other_iter) /* is_ok on <var_other_iter:IndexedIterator[Char]>*/;
1724 if (var32){
1725 var33 = 1;
1726 var = var33;
1727 goto RET_LABEL;
1728 } else {
1729 }
1730 var34 = 0;
1731 var = var34;
1732 goto RET_LABEL;
1733 RET_LABEL:;
1734 return var;
1735 }
1736 /* method ropes#Rope#< for (self: Object, Comparable): Bool */
1737 short int VIRTUAL_ropes__Rope___60d(val* self, val* p0) {
1738 short int var /* : Bool */;
1739 short int var1 /* : Bool */;
1740 var1 = ropes__Rope___60d(self, p0);
1741 var = var1;
1742 RET_LABEL:;
1743 return var;
1744 }
1745 /* method ropes#BufferRope#is_dirty for (self: BufferRope): Bool */
1746 short int ropes__BufferRope__is_dirty(val* self) {
1747 short int var /* : Bool */;
1748 short int var1 /* : Bool */;
1749 var1 = self->attrs[COLOR_ropes__BufferRope___64dis_dirty].s; /* @is_dirty on <self:BufferRope> */
1750 var = var1;
1751 RET_LABEL:;
1752 return var;
1753 }
1754 /* method ropes#BufferRope#is_dirty for (self: Object): Bool */
1755 short int VIRTUAL_ropes__BufferRope__is_dirty(val* self) {
1756 short int var /* : Bool */;
1757 short int var1 /* : Bool */;
1758 var1 = ropes__BufferRope__is_dirty(self);
1759 var = var1;
1760 RET_LABEL:;
1761 return var;
1762 }
1763 /* method ropes#BufferRope#is_dirty= for (self: BufferRope, Bool) */
1764 void ropes__BufferRope__is_dirty_61d(val* self, short int p0) {
1765 self->attrs[COLOR_ropes__BufferRope___64dis_dirty].s = p0; /* @is_dirty on <self:BufferRope> */
1766 RET_LABEL:;
1767 }
1768 /* method ropes#BufferRope#is_dirty= for (self: Object, Bool) */
1769 void VIRTUAL_ropes__BufferRope__is_dirty_61d(val* self, short int p0) {
1770 ropes__BufferRope__is_dirty_61d(self, p0);
1771 RET_LABEL:;
1772 }
1773 /* method ropes#BufferRope#init for (self: BufferRope) */
1774 void ropes__BufferRope__init(val* self) {
1775 ((void (*)(val*))(self->class->vft[COLOR_ropes__Rope__init]))(self) /* init on <self:BufferRope>*/;
1776 RET_LABEL:;
1777 }
1778 /* method ropes#BufferRope#init for (self: Object) */
1779 void VIRTUAL_ropes__BufferRope__init(val* self) {
1780 ropes__BufferRope__init(self);
1781 RET_LABEL:;
1782 }
1783 /* method ropes#BufferRope#with_string for (self: BufferRope, AbstractString) */
1784 void ropes__BufferRope__with_string(val* self, val* p0) {
1785 val* var_str /* var str: AbstractString */;
1786 var_str = p0;
1787 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__Rope__with_string]))(self, p0) /* with_string on <self:BufferRope>*/;
1788 RET_LABEL:;
1789 }
1790 /* method ropes#BufferRope#with_string for (self: Object, AbstractString) */
1791 void VIRTUAL_ropes__BufferRope__with_string(val* self, val* p0) {
1792 ropes__BufferRope__with_string(self, p0);
1793 RET_LABEL:;
1794 }
1795 /* method ropes#BufferRope#rotate_right for (self: BufferRope, ConcatNode) */
1796 void ropes__BufferRope__rotate_right(val* self, val* p0) {
1797 val* var_root /* var root: ConcatNode */;
1798 val* var /* : nullable RopeNode */;
1799 val* var1 /* : null */;
1800 short int var2 /* : Bool */;
1801 val* var3 /* : nullable RopeNode */;
1802 short int var4 /* : Bool */;
1803 int cltype;
1804 int idtype;
1805 const char* var_class_name;
1806 val* var_pivot /* var pivot: ConcatNode */;
1807 val* var5 /* : nullable RopeNode */;
1808 val* var_root_new_left /* var root_new_left: nullable RopeNode */;
1809 val* var6 /* : nullable ConcatNode */;
1810 val* var_root_parent /* var root_parent: nullable ConcatNode */;
1811 val* var7 /* : null */;
1812 short int var8 /* : Bool */;
1813 val* var9 /* : null */;
1814 val* var10 /* : nullable RopeNode */;
1815 short int var11 /* : Bool */;
1816 var_root = p0;
1817 var = ((val* (*)(val*))(var_root->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_root) /* left_child on <var_root:ConcatNode>*/;
1818 var1 = NULL;
1819 if (var == NULL) {
1820 var2 = 0; /* is null */
1821 } else {
1822 var2 = 1; /* arg is null and recv is not */
1823 }
1824 if (!var2) {
1825 fprintf(stderr, "Runtime error: %s", "Assert failed");
1826 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 353);
1827 show_backtrace(1);
1828 }
1829 var3 = ((val* (*)(val*))(var_root->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_root) /* left_child on <var_root:ConcatNode>*/;
1830 /* <var3:nullable RopeNode> isa ConcatNode */
1831 cltype = type_ropes__ConcatNode.color;
1832 idtype = type_ropes__ConcatNode.id;
1833 if(var3 == NULL) {
1834 var4 = 0;
1835 } else {
1836 if(cltype >= var3->type->table_size) {
1837 var4 = 0;
1838 } else {
1839 var4 = var3->type->type_table[cltype] == idtype;
1840 }
1841 }
1842 if (!var4) {
1843 var_class_name = var3 == NULL ? "null" : var3->type->name;
1844 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "ConcatNode", var_class_name);
1845 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 354);
1846 show_backtrace(1);
1847 }
1848 var_pivot = var3;
1849 var5 = ((val* (*)(val*))(var_pivot->class->vft[COLOR_ropes__ConcatNode__right_child]))(var_pivot) /* right_child on <var_pivot:ConcatNode>*/;
1850 var_root_new_left = var5;
1851 var6 = ((val* (*)(val*))(var_root->class->vft[COLOR_ropes__RopeNode__parent]))(var_root) /* parent on <var_root:ConcatNode>*/;
1852 var_root_parent = var6;
1853 ((void (*)(val*, val*))(var_root->class->vft[COLOR_ropes__ConcatNode__left_child_61d]))(var_root, var_root_new_left) /* left_child= on <var_root:ConcatNode>*/;
1854 ((void (*)(val*, val*))(var_pivot->class->vft[COLOR_ropes__ConcatNode__right_child_61d]))(var_pivot, var_root) /* right_child= on <var_pivot:ConcatNode>*/;
1855 var7 = NULL;
1856 if (var_root_parent == NULL) {
1857 var8 = 1; /* is null */
1858 } else {
1859 var8 = 0; /* arg is null but recv is not */
1860 }
1861 if (var8){
1862 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__Rope__parent_node_61d]))(self, var_pivot) /* parent_node= on <self:BufferRope>*/;
1863 var9 = NULL;
1864 ((void (*)(val*, val*))(var_pivot->class->vft[COLOR_ropes__RopeNode__parent_61d]))(var_pivot, var9) /* parent= on <var_pivot:ConcatNode>*/;
1865 goto RET_LABEL;
1866 } else {
1867 }
1868 var10 = ((val* (*)(val*))(var_root_parent->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_root_parent) /* left_child on <var_root_parent:nullable ConcatNode(ConcatNode)>*/;
1869 if (var10 == NULL) {
1870 var11 = 0; /* <var_root:ConcatNode> cannot be null */
1871 } else {
1872 var11 = ((short int (*)(val*, val*))(var10->class->vft[COLOR_kernel__Object___61d_61d]))(var10, var_root) /* == on <var10:nullable RopeNode>*/;
1873 }
1874 if (var11){
1875 ((void (*)(val*, val*))(var_root_parent->class->vft[COLOR_ropes__ConcatNode__left_child_61d]))(var_root_parent, var_pivot) /* left_child= on <var_root_parent:nullable ConcatNode(ConcatNode)>*/;
1876 } else {
1877 ((void (*)(val*, val*))(var_root_parent->class->vft[COLOR_ropes__ConcatNode__right_child_61d]))(var_root_parent, var_pivot) /* right_child= on <var_root_parent:nullable ConcatNode(ConcatNode)>*/;
1878 }
1879 ((void (*)(val*))(var_root->class->vft[COLOR_ropes__ConcatNode__update_data]))(var_root) /* update_data on <var_root:ConcatNode>*/;
1880 ((void (*)(val*))(var_pivot->class->vft[COLOR_ropes__ConcatNode__update_data]))(var_pivot) /* update_data on <var_pivot:ConcatNode>*/;
1881 ((void (*)(val*))(var_root_parent->class->vft[COLOR_ropes__ConcatNode__update_data]))(var_root_parent) /* update_data on <var_root_parent:nullable ConcatNode(ConcatNode)>*/;
1882 RET_LABEL:;
1883 }
1884 /* method ropes#BufferRope#rotate_right for (self: Object, ConcatNode) */
1885 void VIRTUAL_ropes__BufferRope__rotate_right(val* self, val* p0) {
1886 ropes__BufferRope__rotate_right(self, p0);
1887 RET_LABEL:;
1888 }
1889 /* method ropes#BufferRope#rotate_left for (self: BufferRope, ConcatNode) */
1890 void ropes__BufferRope__rotate_left(val* self, val* p0) {
1891 val* var_root /* var root: ConcatNode */;
1892 val* var /* : nullable RopeNode */;
1893 val* var1 /* : null */;
1894 short int var2 /* : Bool */;
1895 val* var3 /* : nullable RopeNode */;
1896 short int var4 /* : Bool */;
1897 int cltype;
1898 int idtype;
1899 const char* var_class_name;
1900 val* var_pivot /* var pivot: ConcatNode */;
1901 val* var5 /* : nullable RopeNode */;
1902 val* var_root_new_right /* var root_new_right: nullable RopeNode */;
1903 val* var6 /* : nullable ConcatNode */;
1904 val* var_root_parent /* var root_parent: nullable ConcatNode */;
1905 val* var7 /* : null */;
1906 short int var8 /* : Bool */;
1907 val* var9 /* : null */;
1908 val* var10 /* : nullable RopeNode */;
1909 short int var11 /* : Bool */;
1910 var_root = p0;
1911 var = ((val* (*)(val*))(var_root->class->vft[COLOR_ropes__ConcatNode__right_child]))(var_root) /* right_child on <var_root:ConcatNode>*/;
1912 var1 = NULL;
1913 if (var == NULL) {
1914 var2 = 0; /* is null */
1915 } else {
1916 var2 = 1; /* arg is null and recv is not */
1917 }
1918 if (!var2) {
1919 fprintf(stderr, "Runtime error: %s", "Assert failed");
1920 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 386);
1921 show_backtrace(1);
1922 }
1923 var3 = ((val* (*)(val*))(var_root->class->vft[COLOR_ropes__ConcatNode__right_child]))(var_root) /* right_child on <var_root:ConcatNode>*/;
1924 /* <var3:nullable RopeNode> isa ConcatNode */
1925 cltype = type_ropes__ConcatNode.color;
1926 idtype = type_ropes__ConcatNode.id;
1927 if(var3 == NULL) {
1928 var4 = 0;
1929 } else {
1930 if(cltype >= var3->type->table_size) {
1931 var4 = 0;
1932 } else {
1933 var4 = var3->type->type_table[cltype] == idtype;
1934 }
1935 }
1936 if (!var4) {
1937 var_class_name = var3 == NULL ? "null" : var3->type->name;
1938 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "ConcatNode", var_class_name);
1939 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 387);
1940 show_backtrace(1);
1941 }
1942 var_pivot = var3;
1943 var5 = ((val* (*)(val*))(var_pivot->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_pivot) /* left_child on <var_pivot:ConcatNode>*/;
1944 var_root_new_right = var5;
1945 var6 = ((val* (*)(val*))(var_root->class->vft[COLOR_ropes__RopeNode__parent]))(var_root) /* parent on <var_root:ConcatNode>*/;
1946 var_root_parent = var6;
1947 ((void (*)(val*, val*))(var_root->class->vft[COLOR_ropes__ConcatNode__right_child_61d]))(var_root, var_root_new_right) /* right_child= on <var_root:ConcatNode>*/;
1948 ((void (*)(val*, val*))(var_pivot->class->vft[COLOR_ropes__ConcatNode__left_child_61d]))(var_pivot, var_root) /* left_child= on <var_pivot:ConcatNode>*/;
1949 var7 = NULL;
1950 if (var_root_parent == NULL) {
1951 var8 = 1; /* is null */
1952 } else {
1953 var8 = 0; /* arg is null but recv is not */
1954 }
1955 if (var8){
1956 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__Rope__parent_node_61d]))(self, var_pivot) /* parent_node= on <self:BufferRope>*/;
1957 var9 = NULL;
1958 ((void (*)(val*, val*))(var_pivot->class->vft[COLOR_ropes__RopeNode__parent_61d]))(var_pivot, var9) /* parent= on <var_pivot:ConcatNode>*/;
1959 goto RET_LABEL;
1960 } else {
1961 }
1962 var10 = ((val* (*)(val*))(var_root_parent->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_root_parent) /* left_child on <var_root_parent:nullable ConcatNode(ConcatNode)>*/;
1963 if (var10 == NULL) {
1964 var11 = 0; /* <var_root:ConcatNode> cannot be null */
1965 } else {
1966 var11 = ((short int (*)(val*, val*))(var10->class->vft[COLOR_kernel__Object___61d_61d]))(var10, var_root) /* == on <var10:nullable RopeNode>*/;
1967 }
1968 if (var11){
1969 ((void (*)(val*, val*))(var_root_parent->class->vft[COLOR_ropes__ConcatNode__left_child_61d]))(var_root_parent, var_pivot) /* left_child= on <var_root_parent:nullable ConcatNode(ConcatNode)>*/;
1970 } else {
1971 ((void (*)(val*, val*))(var_root_parent->class->vft[COLOR_ropes__ConcatNode__right_child_61d]))(var_root_parent, var_pivot) /* right_child= on <var_root_parent:nullable ConcatNode(ConcatNode)>*/;
1972 }
1973 ((void (*)(val*))(var_root->class->vft[COLOR_ropes__ConcatNode__update_data]))(var_root) /* update_data on <var_root:ConcatNode>*/;
1974 ((void (*)(val*))(var_pivot->class->vft[COLOR_ropes__ConcatNode__update_data]))(var_pivot) /* update_data on <var_pivot:ConcatNode>*/;
1975 ((void (*)(val*))(var_root_parent->class->vft[COLOR_ropes__ConcatNode__update_data]))(var_root_parent) /* update_data on <var_root_parent:nullable ConcatNode(ConcatNode)>*/;
1976 RET_LABEL:;
1977 }
1978 /* method ropes#BufferRope#rotate_left for (self: Object, ConcatNode) */
1979 void VIRTUAL_ropes__BufferRope__rotate_left(val* self, val* p0) {
1980 ropes__BufferRope__rotate_left(self, p0);
1981 RET_LABEL:;
1982 }
1983 /* method ropes#BufferRope#balance_from_node for (self: BufferRope, nullable ConcatNode) */
1984 void ropes__BufferRope__balance_from_node(val* self, val* p0) {
1985 val* var_parent_node /* var parent_node: nullable ConcatNode */;
1986 val* var /* : null */;
1987 short int var1 /* : Bool */;
1988 long var2 /* : Int */;
1989 long var_node_balance /* var node_balance: Int */;
1990 short int var3 /* : Bool */;
1991 long var4 /* : Int */;
1992 long var5 /* : Int */;
1993 long var7 /* : Int */;
1994 short int var8 /* : Bool */;
1995 short int var10 /* : Bool */;
1996 int cltype;
1997 int idtype;
1998 const char* var_class_name;
1999 short int var11 /* : Bool */;
2000 short int var_ /* var : Bool */;
2001 long var12 /* : Int */;
2002 short int var13 /* : Bool */;
2003 short int var15 /* : Bool */;
2004 int cltype16;
2005 int idtype17;
2006 const char* var_class_name18;
2007 short int var19 /* : Bool */;
2008 val* var20 /* : nullable ConcatNode */;
2009 var_parent_node = p0;
2010 for(;;) {
2011 var = NULL;
2012 if (var_parent_node == NULL) {
2013 var1 = 0; /* is null */
2014 } else {
2015 var1 = 1; /* arg is null and recv is not */
2016 }
2017 if (!var1) break;
2018 ((void (*)(val*))(var_parent_node->class->vft[COLOR_ropes__ConcatNode__update_data]))(var_parent_node) /* update_data on <var_parent_node:nullable ConcatNode(ConcatNode)>*/;
2019 var2 = ((long (*)(val*))(var_parent_node->class->vft[COLOR_ropes__RopeNode__balance_factor]))(var_parent_node) /* balance_factor on <var_parent_node:nullable ConcatNode(ConcatNode)>*/;
2020 var_node_balance = var2;
2021 var4 = 1;
2022 { /* Inline kernel#Int#unary - (var4) */
2023 var7 = -var4;
2024 var5 = var7;
2025 goto RET_LABEL6;
2026 RET_LABEL6:(void)0;
2027 }
2028 { /* Inline kernel#Int#< (var_node_balance,var5) */
2029 /* Covariant cast for argument 0 (i) <var5:Int> isa OTHER */
2030 /* <var5:Int> isa OTHER */
2031 var10 = 1; /* easy <var5:Int> isa OTHER*/
2032 if (!var10) {
2033 var_class_name = type_kernel__Int.name;
2034 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name);
2035 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 261);
2036 show_backtrace(1);
2037 }
2038 var11 = var_node_balance < var5;
2039 var8 = var11;
2040 goto RET_LABEL9;
2041 RET_LABEL9:(void)0;
2042 }
2043 var_ = var8;
2044 if (var8){
2045 var3 = var_;
2046 } else {
2047 var12 = 1;
2048 { /* Inline kernel#Int#> (var_node_balance,var12) */
2049 /* Covariant cast for argument 0 (i) <var12:Int> isa OTHER */
2050 /* <var12:Int> isa OTHER */
2051 var15 = 1; /* easy <var12:Int> isa OTHER*/
2052 if (!var15) {
2053 var_class_name18 = type_kernel__Int.name;
2054 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name18);
2055 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 263);
2056 show_backtrace(1);
2057 }
2058 var19 = var_node_balance > var12;
2059 var13 = var19;
2060 goto RET_LABEL14;
2061 RET_LABEL14:(void)0;
2062 }
2063 var3 = var13;
2064 }
2065 if (var3){
2066 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__balance_node]))(self, var_parent_node) /* balance_node on <self:BufferRope>*/;
2067 } else {
2068 }
2069 var20 = ((val* (*)(val*))(var_parent_node->class->vft[COLOR_ropes__RopeNode__parent]))(var_parent_node) /* parent on <var_parent_node:nullable ConcatNode(ConcatNode)>*/;
2070 var_parent_node = var20;
2071 CONTINUE_label: (void)0;
2072 }
2073 BREAK_label: (void)0;
2074 RET_LABEL:;
2075 }
2076 /* method ropes#BufferRope#balance_from_node for (self: Object, nullable ConcatNode) */
2077 void VIRTUAL_ropes__BufferRope__balance_from_node(val* self, val* p0) {
2078 ropes__BufferRope__balance_from_node(self, p0);
2079 RET_LABEL:;
2080 }
2081 /* method ropes#BufferRope#balance_node for (self: BufferRope, ConcatNode) */
2082 void ropes__BufferRope__balance_node(val* self, val* p0) {
2083 val* var_node /* var node: ConcatNode */;
2084 long var /* : Int */;
2085 long var_balance_factor /* var balance_factor: Int */;
2086 long var1 /* : Int */;
2087 long var2 /* : Int */;
2088 long var4 /* : Int */;
2089 short int var5 /* : Bool */;
2090 short int var7 /* : Bool */;
2091 int cltype;
2092 int idtype;
2093 const char* var_class_name;
2094 short int var8 /* : Bool */;
2095 val* var9 /* : nullable RopeNode */;
2096 long var10 /* : Int */;
2097 long var_right_balance /* var right_balance: Int */;
2098 long var11 /* : Int */;
2099 short int var12 /* : Bool */;
2100 short int var14 /* : Bool */;
2101 int cltype15;
2102 int idtype16;
2103 const char* var_class_name17;
2104 short int var18 /* : Bool */;
2105 val* var19 /* : nullable RopeNode */;
2106 short int var20 /* : Bool */;
2107 int cltype21;
2108 int idtype22;
2109 const char* var_class_name23;
2110 val* var24 /* : nullable RopeNode */;
2111 long var25 /* : Int */;
2112 long var_left_balance /* var left_balance: Int */;
2113 long var26 /* : Int */;
2114 short int var27 /* : Bool */;
2115 short int var29 /* : Bool */;
2116 int cltype30;
2117 int idtype31;
2118 const char* var_class_name32;
2119 short int var33 /* : Bool */;
2120 val* var34 /* : nullable RopeNode */;
2121 short int var35 /* : Bool */;
2122 int cltype36;
2123 int idtype37;
2124 const char* var_class_name38;
2125 var_node = p0;
2126 var = ((long (*)(val*))(var_node->class->vft[COLOR_ropes__RopeNode__balance_factor]))(var_node) /* balance_factor on <var_node:ConcatNode>*/;
2127 var_balance_factor = var;
2128 var1 = 1;
2129 { /* Inline kernel#Int#unary - (var1) */
2130 var4 = -var1;
2131 var2 = var4;
2132 goto RET_LABEL3;
2133 RET_LABEL3:(void)0;
2134 }
2135 { /* Inline kernel#Int#< (var_balance_factor,var2) */
2136 /* Covariant cast for argument 0 (i) <var2:Int> isa OTHER */
2137 /* <var2:Int> isa OTHER */
2138 var7 = 1; /* easy <var2:Int> isa OTHER*/
2139 if (!var7) {
2140 var_class_name = type_kernel__Int.name;
2141 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name);
2142 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 261);
2143 show_backtrace(1);
2144 }
2145 var8 = var_balance_factor < var2;
2146 var5 = var8;
2147 goto RET_LABEL6;
2148 RET_LABEL6:(void)0;
2149 }
2150 if (var5){
2151 var9 = ((val* (*)(val*))(var_node->class->vft[COLOR_ropes__ConcatNode__right_child]))(var_node) /* right_child on <var_node:ConcatNode>*/;
2152 if (var9 == NULL) {
2153 fprintf(stderr, "Runtime error: %s", "Reciever is null");
2154 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 429);
2155 show_backtrace(1);
2156 } else {
2157 var10 = ((long (*)(val*))(var9->class->vft[COLOR_ropes__RopeNode__balance_factor]))(var9) /* balance_factor on <var9:nullable RopeNode>*/;
2158 }
2159 var_right_balance = var10;
2160 var11 = 0;
2161 { /* Inline kernel#Int#< (var_right_balance,var11) */
2162 /* Covariant cast for argument 0 (i) <var11:Int> isa OTHER */
2163 /* <var11:Int> isa OTHER */
2164 var14 = 1; /* easy <var11:Int> isa OTHER*/
2165 if (!var14) {
2166 var_class_name17 = type_kernel__Int.name;
2167 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name17);
2168 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 261);
2169 show_backtrace(1);
2170 }
2171 var18 = var_right_balance < var11;
2172 var12 = var18;
2173 goto RET_LABEL13;
2174 RET_LABEL13:(void)0;
2175 }
2176 if (var12){
2177 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__rotate_left]))(self, var_node) /* rotate_left on <self:BufferRope>*/;
2178 } else {
2179 var19 = ((val* (*)(val*))(var_node->class->vft[COLOR_ropes__ConcatNode__right_child]))(var_node) /* right_child on <var_node:ConcatNode>*/;
2180 /* <var19:nullable RopeNode> isa ConcatNode */
2181 cltype21 = type_ropes__ConcatNode.color;
2182 idtype22 = type_ropes__ConcatNode.id;
2183 if(var19 == NULL) {
2184 var20 = 0;
2185 } else {
2186 if(cltype21 >= var19->type->table_size) {
2187 var20 = 0;
2188 } else {
2189 var20 = var19->type->type_table[cltype21] == idtype22;
2190 }
2191 }
2192 if (!var20) {
2193 var_class_name23 = var19 == NULL ? "null" : var19->type->name;
2194 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "ConcatNode", var_class_name23);
2195 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 433);
2196 show_backtrace(1);
2197 }
2198 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__rotate_right]))(self, var19) /* rotate_right on <self:BufferRope>*/;
2199 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__rotate_left]))(self, var_node) /* rotate_left on <self:BufferRope>*/;
2200 }
2201 } else {
2202 var24 = ((val* (*)(val*))(var_node->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_node) /* left_child on <var_node:ConcatNode>*/;
2203 if (var24 == NULL) {
2204 fprintf(stderr, "Runtime error: %s", "Reciever is null");
2205 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 437);
2206 show_backtrace(1);
2207 } else {
2208 var25 = ((long (*)(val*))(var24->class->vft[COLOR_ropes__RopeNode__balance_factor]))(var24) /* balance_factor on <var24:nullable RopeNode>*/;
2209 }
2210 var_left_balance = var25;
2211 var26 = 0;
2212 { /* Inline kernel#Int#> (var_left_balance,var26) */
2213 /* Covariant cast for argument 0 (i) <var26:Int> isa OTHER */
2214 /* <var26:Int> isa OTHER */
2215 var29 = 1; /* easy <var26:Int> isa OTHER*/
2216 if (!var29) {
2217 var_class_name32 = type_kernel__Int.name;
2218 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name32);
2219 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 263);
2220 show_backtrace(1);
2221 }
2222 var33 = var_left_balance > var26;
2223 var27 = var33;
2224 goto RET_LABEL28;
2225 RET_LABEL28:(void)0;
2226 }
2227 if (var27){
2228 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__rotate_right]))(self, var_node) /* rotate_right on <self:BufferRope>*/;
2229 } else {
2230 var34 = ((val* (*)(val*))(var_node->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_node) /* left_child on <var_node:ConcatNode>*/;
2231 /* <var34:nullable RopeNode> isa ConcatNode */
2232 cltype36 = type_ropes__ConcatNode.color;
2233 idtype37 = type_ropes__ConcatNode.id;
2234 if(var34 == NULL) {
2235 var35 = 0;
2236 } else {
2237 if(cltype36 >= var34->type->table_size) {
2238 var35 = 0;
2239 } else {
2240 var35 = var34->type->type_table[cltype36] == idtype37;
2241 }
2242 }
2243 if (!var35) {
2244 var_class_name38 = var34 == NULL ? "null" : var34->type->name;
2245 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "ConcatNode", var_class_name38);
2246 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 441);
2247 show_backtrace(1);
2248 }
2249 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__rotate_left]))(self, var34) /* rotate_left on <self:BufferRope>*/;
2250 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__rotate_right]))(self, var_node) /* rotate_right on <self:BufferRope>*/;
2251 }
2252 }
2253 RET_LABEL:;
2254 }
2255 /* method ropes#BufferRope#balance_node for (self: Object, ConcatNode) */
2256 void VIRTUAL_ropes__BufferRope__balance_node(val* self, val* p0) {
2257 ropes__BufferRope__balance_node(self, p0);
2258 RET_LABEL:;
2259 }
2260 /* method ropes#BufferRope#append for (self: BufferRope, Collection[Char]): BufferRope */
2261 val* ropes__BufferRope__append(val* self, val* p0) {
2262 val* var /* : BufferRope */;
2263 val* var_str /* var str: Collection[Char] */;
2264 short int var1 /* : Bool */;
2265 int cltype;
2266 int idtype;
2267 val* var2 /* : RopeNode */;
2268 val* var_last_node /* var last_node: RopeNode */;
2269 short int var3 /* : Bool */;
2270 short int var4 /* : Bool */;
2271 int cltype5;
2272 int idtype6;
2273 short int var_ /* var : Bool */;
2274 val* var7 /* : nullable RopeNode */;
2275 val* var8 /* : null */;
2276 short int var9 /* : Bool */;
2277 val* var10 /* : nullable RopeNode */;
2278 short int var11 /* : Bool */;
2279 int cltype12;
2280 int idtype13;
2281 val* var14 /* : LeafNode */;
2282 val* var15 /* : String */;
2283 short int var16 /* : Bool */;
2284 int cltype17;
2285 int idtype18;
2286 val* var19 /* : nullable ConcatNode */;
2287 val* var_last_node_parent /* var last_node_parent: nullable ConcatNode */;
2288 val* var20 /* : ConcatNode */;
2289 val* var_new_concat /* var new_concat: ConcatNode */;
2290 val* var21 /* : LeafNode */;
2291 val* var22 /* : String */;
2292 static val* varonce;
2293 val* var23 /* : String */;
2294 char* var24 /* : NativeString */;
2295 long var25 /* : Int */;
2296 val* var26 /* : String */;
2297 val* var27 /* : Buffer */;
2298 long var28 /* : Int */;
2299 val* var_buf /* var buf: Buffer */;
2300 val* var29 /* : Iterator[nullable Object] */;
2301 short int var30 /* : Bool */;
2302 val* var31 /* : nullable Object */;
2303 char var_i /* var i: Char */;
2304 char var32 /* : Char */;
2305 val* var33 /* : nullable Object */;
2306 val* var35 /* : BufferRope */;
2307 short int var36 /* : Bool */;
2308 short int var37 /* : Bool */;
2309 short int var38 /* : Bool */;
2310 var_str = p0;
2311 /* <var_str:Collection[Char]> isa AbstractString */
2312 cltype = type_string__AbstractString.color;
2313 idtype = type_string__AbstractString.id;
2314 if(cltype >= var_str->type->table_size) {
2315 var1 = 0;
2316 } else {
2317 var1 = var_str->type->type_table[cltype] == idtype;
2318 }
2319 if (var1){
2320 var2 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__parent_node]))(self) /* parent_node on <self:BufferRope>*/;
2321 var_last_node = var2;
2322 for(;;) {
2323 /* <var_last_node:RopeNode> isa ConcatNode */
2324 cltype5 = type_ropes__ConcatNode.color;
2325 idtype6 = type_ropes__ConcatNode.id;
2326 if(cltype5 >= var_last_node->type->table_size) {
2327 var4 = 0;
2328 } else {
2329 var4 = var_last_node->type->type_table[cltype5] == idtype6;
2330 }
2331 var_ = var4;
2332 if (var4){
2333 var7 = ((val* (*)(val*))(var_last_node->class->vft[COLOR_ropes__ConcatNode__right_child]))(var_last_node) /* right_child on <var_last_node:RopeNode(ConcatNode)>*/;
2334 var8 = NULL;
2335 if (var7 == NULL) {
2336 var9 = 0; /* is null */
2337 } else {
2338 var9 = 1; /* arg is null and recv is not */
2339 }
2340 var3 = var9;
2341 } else {
2342 var3 = var_;
2343 }
2344 if (!var3) break;
2345 var10 = ((val* (*)(val*))(var_last_node->class->vft[COLOR_ropes__ConcatNode__right_child]))(var_last_node) /* right_child on <var_last_node:RopeNode(ConcatNode)>*/;
2346 if (var10 == NULL) {
2347 fprintf(stderr, "Runtime error: %s", "Cast failed");
2348 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 458);
2349 show_backtrace(1);
2350 }
2351 var_last_node = var10;
2352 CONTINUE_label: (void)0;
2353 }
2354 BREAK_label: (void)0;
2355 /* <var_last_node:RopeNode> isa ConcatNode */
2356 cltype12 = type_ropes__ConcatNode.color;
2357 idtype13 = type_ropes__ConcatNode.id;
2358 if(cltype12 >= var_last_node->type->table_size) {
2359 var11 = 0;
2360 } else {
2361 var11 = var_last_node->type->type_table[cltype12] == idtype13;
2362 }
2363 if (var11){
2364 var14 = NEW_ropes__LeafNode(&type_ropes__LeafNode);
2365 var15 = ((val* (*)(val*))(var_str->class->vft[COLOR_string__Object__to_s]))(var_str) /* to_s on <var_str:Collection[Char](AbstractString)>*/;
2366 ((void (*)(val*, val*))(var14->class->vft[COLOR_ropes__LeafNode__init]))(var14, var15) /* init on <var14:LeafNode>*/;
2367 ((void (*)(val*, val*))(var_last_node->class->vft[COLOR_ropes__ConcatNode__right_child_61d]))(var_last_node, var14) /* right_child= on <var_last_node:RopeNode(ConcatNode)>*/;
2368 } else {
2369 /* <var_last_node:RopeNode> isa LeafNode */
2370 cltype17 = type_ropes__LeafNode.color;
2371 idtype18 = type_ropes__LeafNode.id;
2372 if(cltype17 >= var_last_node->type->table_size) {
2373 var16 = 0;
2374 } else {
2375 var16 = var_last_node->type->type_table[cltype17] == idtype18;
2376 }
2377 if (var16){
2378 var19 = ((val* (*)(val*))(var_last_node->class->vft[COLOR_ropes__RopeNode__parent]))(var_last_node) /* parent on <var_last_node:RopeNode(LeafNode)>*/;
2379 var_last_node_parent = var19;
2380 var20 = NEW_ropes__ConcatNode(&type_ropes__ConcatNode);
2381 ((void (*)(val*))(var20->class->vft[COLOR_ropes__ConcatNode__init]))(var20) /* init on <var20:ConcatNode>*/;
2382 var_new_concat = var20;
2383 if (var_last_node_parent == NULL) {
2384 fprintf(stderr, "Runtime error: %s", "Reciever is null");
2385 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 466);
2386 show_backtrace(1);
2387 } else {
2388 ((void (*)(val*, val*))(var_last_node_parent->class->vft[COLOR_ropes__ConcatNode__right_child_61d]))(var_last_node_parent, var_new_concat) /* right_child= on <var_last_node_parent:nullable ConcatNode>*/;
2389 }
2390 ((void (*)(val*, val*))(var_new_concat->class->vft[COLOR_ropes__ConcatNode__left_child_61d]))(var_new_concat, var_last_node) /* left_child= on <var_new_concat:ConcatNode>*/;
2391 var21 = NEW_ropes__LeafNode(&type_ropes__LeafNode);
2392 var22 = ((val* (*)(val*))(var_str->class->vft[COLOR_string__Object__to_s]))(var_str) /* to_s on <var_str:Collection[Char](AbstractString)>*/;
2393 ((void (*)(val*, val*))(var21->class->vft[COLOR_ropes__LeafNode__init]))(var21, var22) /* init on <var21:LeafNode>*/;
2394 ((void (*)(val*, val*))(var_new_concat->class->vft[COLOR_ropes__ConcatNode__right_child_61d]))(var_new_concat, var21) /* right_child= on <var_new_concat:ConcatNode>*/;
2395 var_last_node = var_new_concat;
2396 } else {
2397 if (varonce) {
2398 var23 = varonce;
2399 } else {
2400 var24 = "Fatal Error, please report to the developers for more insight.";
2401 var25 = 62;
2402 var26 = string__NativeString__to_s_with_length(var24, var25);
2403 var23 = var26;
2404 varonce = var23;
2405 }
2406 ((void (*)(val*, val*))(self->class->vft[COLOR_file__Object__print]))(self, var23) /* print on <self:BufferRope>*/;
2407 fprintf(stderr, "Runtime error: %s", "Aborted");
2408 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 472);
2409 show_backtrace(1);
2410 }
2411 }
2412 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__balance_from_node]))(self, var_last_node) /* balance_from_node on <self:BufferRope>*/;
2413 } else {
2414 var27 = NEW_string__Buffer(&type_string__Buffer);
2415 var28 = ((long (*)(val*))(var_str->class->vft[COLOR_abstract_collection__Collection__length]))(var_str) /* length on <var_str:Collection[Char]>*/;
2416 ((void (*)(val*, long))(var27->class->vft[COLOR_string__Buffer__with_capacity]))(var27, var28) /* with_capacity on <var27:Buffer>*/;
2417 var_buf = var27;
2418 var29 = ((val* (*)(val*))(var_str->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_str) /* iterator on <var_str:Collection[Char]>*/;
2419 for(;;) {
2420 var30 = ((short int (*)(val*))(var29->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var29) /* is_ok on <var29:Iterator[nullable Object]>*/;
2421 if(!var30) break;
2422 var31 = ((val* (*)(val*))(var29->class->vft[COLOR_abstract_collection__Iterator__item]))(var29) /* item on <var29:Iterator[nullable Object]>*/;
2423 var32 = ((struct instance_kernel__Char*)var31)->value; /* autounbox from nullable Object to Char */;
2424 var_i = var32;
2425 var33 = BOX_kernel__Char(var_i); /* autobox from Char to nullable Object */
2426 ((void (*)(val*, val*))(var_buf->class->vft[COLOR_abstract_collection__SimpleCollection__add]))(var_buf, var33) /* add on <var_buf:Buffer>*/;
2427 CONTINUE_label34: (void)0;
2428 ((void (*)(val*))(var29->class->vft[COLOR_abstract_collection__Iterator__next]))(var29) /* next on <var29:Iterator[nullable Object]>*/;
2429 }
2430 BREAK_label34: (void)0;
2431 var35 = ((val* (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__append]))(self, var_buf) /* append on <self:BufferRope>*/;
2432 var35;
2433 }
2434 var36 = ((short int (*)(val*))(self->class->vft[COLOR_ropes__BufferRope__is_dirty]))(self) /* is_dirty on <self:BufferRope>*/;
2435 var37 = !var36;
2436 if (var37){
2437 var38 = 1;
2438 ((void (*)(val*, short int))(self->class->vft[COLOR_ropes__BufferRope__is_dirty_61d]))(self, var38) /* is_dirty= on <self:BufferRope>*/;
2439 } else {
2440 }
2441 var = self;
2442 goto RET_LABEL;
2443 RET_LABEL:;
2444 return var;
2445 }
2446 /* method ropes#BufferRope#append for (self: Object, Collection[Char]): BufferRope */
2447 val* VIRTUAL_ropes__BufferRope__append(val* self, val* p0) {
2448 val* var /* : BufferRope */;
2449 val* var1 /* : BufferRope */;
2450 var1 = ropes__BufferRope__append(self, p0);
2451 var = var1;
2452 RET_LABEL:;
2453 return var;
2454 }
2455 /* method ropes#BufferRope#append_multi for (self: BufferRope, Array[Collection[Char]]): BufferRope */
2456 val* ropes__BufferRope__append_multi(val* self, val* p0) {
2457 val* var /* : BufferRope */;
2458 val* var_strs /* var strs: Array[Collection[Char]] */;
2459 val* var1 /* : Iterator[nullable Object] */;
2460 short int var2 /* : Bool */;
2461 val* var3 /* : nullable Object */;
2462 val* var_i /* var i: Collection[Char] */;
2463 val* var4 /* : BufferRope */;
2464 var_strs = p0;
2465 var1 = ((val* (*)(val*))(var_strs->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_strs) /* iterator on <var_strs:Array[Collection[Char]]>*/;
2466 for(;;) {
2467 var2 = ((short int (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var1) /* is_ok on <var1:Iterator[nullable Object]>*/;
2468 if(!var2) break;
2469 var3 = ((val* (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__item]))(var1) /* item on <var1:Iterator[nullable Object]>*/;
2470 var_i = var3;
2471 var4 = ((val* (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__append]))(self, var_i) /* append on <self:BufferRope>*/;
2472 var4;
2473 CONTINUE_label: (void)0;
2474 ((void (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__next]))(var1) /* next on <var1:Iterator[nullable Object]>*/;
2475 }
2476 BREAK_label: (void)0;
2477 var = self;
2478 goto RET_LABEL;
2479 RET_LABEL:;
2480 return var;
2481 }
2482 /* method ropes#BufferRope#append_multi for (self: Object, Array[Collection[Char]]): BufferRope */
2483 val* VIRTUAL_ropes__BufferRope__append_multi(val* self, val* p0) {
2484 val* var /* : BufferRope */;
2485 val* var1 /* : BufferRope */;
2486 var1 = ropes__BufferRope__append_multi(self, p0);
2487 var = var1;
2488 RET_LABEL:;
2489 return var;
2490 }
2491 /* method ropes#BufferRope#prepend for (self: BufferRope, Collection[Char]): BufferRope */
2492 val* ropes__BufferRope__prepend(val* self, val* p0) {
2493 val* var /* : BufferRope */;
2494 val* var_str /* var str: Collection[Char] */;
2495 short int var1 /* : Bool */;
2496 int cltype;
2497 int idtype;
2498 val* var2 /* : RopeNode */;
2499 val* var_curr_node /* var curr_node: RopeNode */;
2500 short int var3 /* : Bool */;
2501 short int var4 /* : Bool */;
2502 int cltype5;
2503 int idtype6;
2504 short int var_ /* var : Bool */;
2505 val* var7 /* : nullable RopeNode */;
2506 val* var8 /* : null */;
2507 short int var9 /* : Bool */;
2508 val* var10 /* : nullable RopeNode */;
2509 short int var11 /* : Bool */;
2510 int cltype12;
2511 int idtype13;
2512 val* var14 /* : LeafNode */;
2513 val* var15 /* : String */;
2514 short int var16 /* : Bool */;
2515 int cltype17;
2516 int idtype18;
2517 val* var19 /* : nullable ConcatNode */;
2518 val* var_parent /* var parent: nullable ConcatNode */;
2519 val* var20 /* : ConcatNode */;
2520 val* var_new_concat /* var new_concat: ConcatNode */;
2521 val* var21 /* : LeafNode */;
2522 val* var22 /* : String */;
2523 val* var_new_leaf /* var new_leaf: LeafNode */;
2524 static val* varonce;
2525 val* var23 /* : String */;
2526 char* var24 /* : NativeString */;
2527 long var25 /* : Int */;
2528 val* var26 /* : String */;
2529 val* var27 /* : Buffer */;
2530 long var28 /* : Int */;
2531 val* var_buf /* var buf: Buffer */;
2532 val* var29 /* : Iterator[nullable Object] */;
2533 short int var30 /* : Bool */;
2534 val* var31 /* : nullable Object */;
2535 char var_i /* var i: Char */;
2536 char var32 /* : Char */;
2537 val* var33 /* : nullable Object */;
2538 val* var35 /* : String */;
2539 val* var36 /* : BufferRope */;
2540 short int var37 /* : Bool */;
2541 short int var38 /* : Bool */;
2542 short int var39 /* : Bool */;
2543 var_str = p0;
2544 /* <var_str:Collection[Char]> isa AbstractString */
2545 cltype = type_string__AbstractString.color;
2546 idtype = type_string__AbstractString.id;
2547 if(cltype >= var_str->type->table_size) {
2548 var1 = 0;
2549 } else {
2550 var1 = var_str->type->type_table[cltype] == idtype;
2551 }
2552 if (var1){
2553 var2 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__parent_node]))(self) /* parent_node on <self:BufferRope>*/;
2554 var_curr_node = var2;
2555 for(;;) {
2556 /* <var_curr_node:RopeNode> isa ConcatNode */
2557 cltype5 = type_ropes__ConcatNode.color;
2558 idtype6 = type_ropes__ConcatNode.id;
2559 if(cltype5 >= var_curr_node->type->table_size) {
2560 var4 = 0;
2561 } else {
2562 var4 = var_curr_node->type->type_table[cltype5] == idtype6;
2563 }
2564 var_ = var4;
2565 if (var4){
2566 var7 = ((val* (*)(val*))(var_curr_node->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_curr_node) /* left_child on <var_curr_node:RopeNode(ConcatNode)>*/;
2567 var8 = NULL;
2568 if (var7 == NULL) {
2569 var9 = 0; /* is null */
2570 } else {
2571 var9 = 1; /* arg is null and recv is not */
2572 }
2573 var3 = var9;
2574 } else {
2575 var3 = var_;
2576 }
2577 if (!var3) break;
2578 var10 = ((val* (*)(val*))(var_curr_node->class->vft[COLOR_ropes__ConcatNode__left_child]))(var_curr_node) /* left_child on <var_curr_node:RopeNode(ConcatNode)>*/;
2579 if (var10 == NULL) {
2580 fprintf(stderr, "Runtime error: %s", "Cast failed");
2581 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 505);
2582 show_backtrace(1);
2583 }
2584 var_curr_node = var10;
2585 CONTINUE_label: (void)0;
2586 }
2587 BREAK_label: (void)0;
2588 /* <var_curr_node:RopeNode> isa ConcatNode */
2589 cltype12 = type_ropes__ConcatNode.color;
2590 idtype13 = type_ropes__ConcatNode.id;
2591 if(cltype12 >= var_curr_node->type->table_size) {
2592 var11 = 0;
2593 } else {
2594 var11 = var_curr_node->type->type_table[cltype12] == idtype13;
2595 }
2596 if (var11){
2597 var14 = NEW_ropes__LeafNode(&type_ropes__LeafNode);
2598 var15 = ((val* (*)(val*))(var_str->class->vft[COLOR_string__Object__to_s]))(var_str) /* to_s on <var_str:Collection[Char](AbstractString)>*/;
2599 ((void (*)(val*, val*))(var14->class->vft[COLOR_ropes__LeafNode__init]))(var14, var15) /* init on <var14:LeafNode>*/;
2600 ((void (*)(val*, val*))(var_curr_node->class->vft[COLOR_ropes__ConcatNode__left_child_61d]))(var_curr_node, var14) /* left_child= on <var_curr_node:RopeNode(ConcatNode)>*/;
2601 } else {
2602 /* <var_curr_node:RopeNode> isa LeafNode */
2603 cltype17 = type_ropes__LeafNode.color;
2604 idtype18 = type_ropes__LeafNode.id;
2605 if(cltype17 >= var_curr_node->type->table_size) {
2606 var16 = 0;
2607 } else {
2608 var16 = var_curr_node->type->type_table[cltype17] == idtype18;
2609 }
2610 if (var16){
2611 var19 = ((val* (*)(val*))(var_curr_node->class->vft[COLOR_ropes__RopeNode__parent]))(var_curr_node) /* parent on <var_curr_node:RopeNode(LeafNode)>*/;
2612 var_parent = var19;
2613 var20 = NEW_ropes__ConcatNode(&type_ropes__ConcatNode);
2614 ((void (*)(val*))(var20->class->vft[COLOR_ropes__ConcatNode__init]))(var20) /* init on <var20:ConcatNode>*/;
2615 var_new_concat = var20;
2616 var21 = NEW_ropes__LeafNode(&type_ropes__LeafNode);
2617 var22 = ((val* (*)(val*))(var_str->class->vft[COLOR_string__Object__to_s]))(var_str) /* to_s on <var_str:Collection[Char](AbstractString)>*/;
2618 ((void (*)(val*, val*))(var21->class->vft[COLOR_ropes__LeafNode__init]))(var21, var22) /* init on <var21:LeafNode>*/;
2619 var_new_leaf = var21;
2620 ((void (*)(val*, val*))(var_new_concat->class->vft[COLOR_ropes__ConcatNode__left_child_61d]))(var_new_concat, var_new_leaf) /* left_child= on <var_new_concat:ConcatNode>*/;
2621 ((void (*)(val*, val*))(var_new_concat->class->vft[COLOR_ropes__ConcatNode__right_child_61d]))(var_new_concat, var_curr_node) /* right_child= on <var_new_concat:ConcatNode>*/;
2622 if (var_parent == NULL) {
2623 fprintf(stderr, "Runtime error: %s", "Reciever is null");
2624 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 516);
2625 show_backtrace(1);
2626 } else {
2627 ((void (*)(val*, val*))(var_parent->class->vft[COLOR_ropes__ConcatNode__left_child_61d]))(var_parent, var_new_concat) /* left_child= on <var_parent:nullable ConcatNode>*/;
2628 }
2629 var_curr_node = var_new_concat;
2630 } else {
2631 if (varonce) {
2632 var23 = varonce;
2633 } else {
2634 var24 = "Fatal Error";
2635 var25 = 11;
2636 var26 = string__NativeString__to_s_with_length(var24, var25);
2637 var23 = var26;
2638 varonce = var23;
2639 }
2640 ((void (*)(val*, val*))(self->class->vft[COLOR_file__Object__print]))(self, var23) /* print on <self:BufferRope>*/;
2641 fprintf(stderr, "Runtime error: %s", "Aborted");
2642 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 520);
2643 show_backtrace(1);
2644 }
2645 }
2646 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__balance_from_node]))(self, var_curr_node) /* balance_from_node on <self:BufferRope>*/;
2647 } else {
2648 var27 = NEW_string__Buffer(&type_string__Buffer);
2649 var28 = ((long (*)(val*))(var_str->class->vft[COLOR_abstract_collection__Collection__length]))(var_str) /* length on <var_str:Collection[Char]>*/;
2650 ((void (*)(val*, long))(var27->class->vft[COLOR_string__Buffer__with_capacity]))(var27, var28) /* with_capacity on <var27:Buffer>*/;
2651 var_buf = var27;
2652 var29 = ((val* (*)(val*))(var_str->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_str) /* iterator on <var_str:Collection[Char]>*/;
2653 for(;;) {
2654 var30 = ((short int (*)(val*))(var29->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var29) /* is_ok on <var29:Iterator[nullable Object]>*/;
2655 if(!var30) break;
2656 var31 = ((val* (*)(val*))(var29->class->vft[COLOR_abstract_collection__Iterator__item]))(var29) /* item on <var29:Iterator[nullable Object]>*/;
2657 var32 = ((struct instance_kernel__Char*)var31)->value; /* autounbox from nullable Object to Char */;
2658 var_i = var32;
2659 var33 = BOX_kernel__Char(var_i); /* autobox from Char to nullable Object */
2660 ((void (*)(val*, val*))(var_buf->class->vft[COLOR_abstract_collection__SimpleCollection__add]))(var_buf, var33) /* add on <var_buf:Buffer>*/;
2661 CONTINUE_label34: (void)0;
2662 ((void (*)(val*))(var29->class->vft[COLOR_abstract_collection__Iterator__next]))(var29) /* next on <var29:Iterator[nullable Object]>*/;
2663 }
2664 BREAK_label34: (void)0;
2665 var35 = ((val* (*)(val*))(var_buf->class->vft[COLOR_string__Object__to_s]))(var_buf) /* to_s on <var_buf:Buffer>*/;
2666 var36 = ((val* (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__prepend]))(self, var35) /* prepend on <self:BufferRope>*/;
2667 var36;
2668 }
2669 var37 = ((short int (*)(val*))(self->class->vft[COLOR_ropes__BufferRope__is_dirty]))(self) /* is_dirty on <self:BufferRope>*/;
2670 var38 = !var37;
2671 if (var38){
2672 var39 = 1;
2673 ((void (*)(val*, short int))(self->class->vft[COLOR_ropes__BufferRope__is_dirty_61d]))(self, var39) /* is_dirty= on <self:BufferRope>*/;
2674 } else {
2675 }
2676 var = self;
2677 goto RET_LABEL;
2678 RET_LABEL:;
2679 return var;
2680 }
2681 /* method ropes#BufferRope#prepend for (self: Object, Collection[Char]): BufferRope */
2682 val* VIRTUAL_ropes__BufferRope__prepend(val* self, val* p0) {
2683 val* var /* : BufferRope */;
2684 val* var1 /* : BufferRope */;
2685 var1 = ropes__BufferRope__prepend(self, p0);
2686 var = var1;
2687 RET_LABEL:;
2688 return var;
2689 }
2690 /* method ropes#BufferRope#prepend_multi for (self: BufferRope, Array[Collection[Char]]): BufferRope */
2691 val* ropes__BufferRope__prepend_multi(val* self, val* p0) {
2692 val* var /* : BufferRope */;
2693 val* var_strs /* var strs: Array[Collection[Char]] */;
2694 val* var1 /* : Iterator[nullable Object] */;
2695 short int var2 /* : Bool */;
2696 val* var3 /* : nullable Object */;
2697 val* var_i /* var i: Collection[Char] */;
2698 val* var4 /* : BufferRope */;
2699 var_strs = p0;
2700 var1 = ((val* (*)(val*))(var_strs->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_strs) /* iterator on <var_strs:Array[Collection[Char]]>*/;
2701 for(;;) {
2702 var2 = ((short int (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var1) /* is_ok on <var1:Iterator[nullable Object]>*/;
2703 if(!var2) break;
2704 var3 = ((val* (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__item]))(var1) /* item on <var1:Iterator[nullable Object]>*/;
2705 var_i = var3;
2706 var4 = ((val* (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__prepend]))(self, var_i) /* prepend on <self:BufferRope>*/;
2707 var4;
2708 CONTINUE_label: (void)0;
2709 ((void (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__next]))(var1) /* next on <var1:Iterator[nullable Object]>*/;
2710 }
2711 BREAK_label: (void)0;
2712 var = self;
2713 goto RET_LABEL;
2714 RET_LABEL:;
2715 return var;
2716 }
2717 /* method ropes#BufferRope#prepend_multi for (self: Object, Array[Collection[Char]]): BufferRope */
2718 val* VIRTUAL_ropes__BufferRope__prepend_multi(val* self, val* p0) {
2719 val* var /* : BufferRope */;
2720 val* var1 /* : BufferRope */;
2721 var1 = ropes__BufferRope__prepend_multi(self, p0);
2722 var = var1;
2723 RET_LABEL:;
2724 return var;
2725 }
2726 /* method ropes#BufferRope#concat for (self: BufferRope, Rope): Rope */
2727 val* ropes__BufferRope__concat(val* self, val* p0) {
2728 val* var /* : Rope */;
2729 val* var_str /* var str: Rope */;
2730 val* var1 /* : DFSRopeLeafIterator */;
2731 val* var_other_iter /* var other_iter: DFSRopeLeafIterator */;
2732 val* var2 /* : List[String] */;
2733 val* var_modif_list /* var modif_list: List[String] */;
2734 short int var3 /* : Bool */;
2735 val* var4 /* : nullable Object */;
2736 val* var5 /* : String */;
2737 long var6 /* : Int */;
2738 long var7 /* : Int */;
2739 short int var8 /* : Bool */;
2740 short int var10 /* : Bool */;
2741 int cltype;
2742 int idtype;
2743 const char* var_class_name;
2744 short int var11 /* : Bool */;
2745 val* var12 /* : nullable Object */;
2746 val* var13 /* : BufferRope */;
2747 short int var15 /* : Bool */;
2748 short int var16 /* : Bool */;
2749 short int var17 /* : Bool */;
2750 var_str = p0;
2751 var1 = NEW_ropes__DFSRopeLeafIterator(&type_ropes__DFSRopeLeafIterator);
2752 ((void (*)(val*, val*))(var1->class->vft[COLOR_ropes__DFSRopeLeafIterator__init]))(var1, var_str) /* init on <var1:DFSRopeLeafIterator>*/;
2753 var_other_iter = var1;
2754 var2 = NEW_list__List(&type_list__Liststring__String);
2755 ((void (*)(val*))(var2->class->vft[COLOR_list__List__init]))(var2) /* init on <var2:List[String]>*/;
2756 var_modif_list = var2;
2757 for(;;) {
2758 var3 = ((short int (*)(val*))(var_other_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_other_iter) /* is_ok on <var_other_iter:DFSRopeLeafIterator>*/;
2759 if (!var3) break;
2760 var4 = ((val* (*)(val*))(var_other_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_other_iter) /* item on <var_other_iter:DFSRopeLeafIterator>*/;
2761 var5 = ((val* (*)(val*))(var4->class->vft[COLOR_ropes__LeafNode__value]))(var4) /* value on <var4:nullable Object(LeafNode)>*/;
2762 ((void (*)(val*, val*))(var_modif_list->class->vft[COLOR_abstract_collection__Sequence__push]))(var_modif_list, var5) /* push on <var_modif_list:List[String]>*/;
2763 ((void (*)(val*))(var_other_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_other_iter) /* next on <var_other_iter:DFSRopeLeafIterator>*/;
2764 CONTINUE_label: (void)0;
2765 }
2766 BREAK_label: (void)0;
2767 for(;;) {
2768 var6 = ((long (*)(val*))(var_modif_list->class->vft[COLOR_abstract_collection__Collection__length]))(var_modif_list) /* length on <var_modif_list:List[String]>*/;
2769 var7 = 0;
2770 { /* Inline kernel#Int#> (var6,var7) */
2771 /* Covariant cast for argument 0 (i) <var7:Int> isa OTHER */
2772 /* <var7:Int> isa OTHER */
2773 var10 = 1; /* easy <var7:Int> isa OTHER*/
2774 if (!var10) {
2775 var_class_name = type_kernel__Int.name;
2776 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name);
2777 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 263);
2778 show_backtrace(1);
2779 }
2780 var11 = var6 > var7;
2781 var8 = var11;
2782 goto RET_LABEL9;
2783 RET_LABEL9:(void)0;
2784 }
2785 if (!var8) break;
2786 var12 = ((val* (*)(val*))(var_modif_list->class->vft[COLOR_abstract_collection__Sequence__shift]))(var_modif_list) /* shift on <var_modif_list:List[String]>*/;
2787 var13 = ((val* (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__append]))(self, var12) /* append on <self:BufferRope>*/;
2788 var13;
2789 CONTINUE_label14: (void)0;
2790 }
2791 BREAK_label14: (void)0;
2792 var15 = ((short int (*)(val*))(self->class->vft[COLOR_ropes__BufferRope__is_dirty]))(self) /* is_dirty on <self:BufferRope>*/;
2793 var16 = !var15;
2794 if (var16){
2795 var17 = 1;
2796 ((void (*)(val*, short int))(self->class->vft[COLOR_ropes__BufferRope__is_dirty_61d]))(self, var17) /* is_dirty= on <self:BufferRope>*/;
2797 } else {
2798 }
2799 var = self;
2800 goto RET_LABEL;
2801 RET_LABEL:;
2802 return var;
2803 }
2804 /* method ropes#BufferRope#concat for (self: Object, Rope): Rope */
2805 val* VIRTUAL_ropes__BufferRope__concat(val* self, val* p0) {
2806 val* var /* : Rope */;
2807 val* var1 /* : Rope */;
2808 var1 = ropes__BufferRope__concat(self, p0);
2809 var = var1;
2810 RET_LABEL:;
2811 return var;
2812 }
2813 /* method ropes#BufferRope#freeze for (self: BufferRope): ImmutableRope */
2814 val* ropes__BufferRope__freeze(val* self) {
2815 val* var /* : ImmutableRope */;
2816 val* var1 /* : BufferRope */;
2817 val* var_buffer_rope /* var buffer_rope: BufferRope */;
2818 val* var2 /* : ImmutableRope */;
2819 val* var_new_rope /* var new_rope: ImmutableRope */;
2820 val* var3 /* : DFSRopeLeafIterator */;
2821 val* var_iter /* var iter: DFSRopeLeafIterator */;
2822 short int var4 /* : Bool */;
2823 val* var5 /* : nullable Object */;
2824 val* var6 /* : String */;
2825 val* var7 /* : BufferRope */;
2826 val* var8 /* : RopeNode */;
2827 short int var9 /* : Bool */;
2828 short int var10 /* : Bool */;
2829 val* var11 /* : nullable String */;
2830 var1 = NEW_ropes__BufferRope(&type_ropes__BufferRope);
2831 ((void (*)(val*))(var1->class->vft[COLOR_ropes__BufferRope__init]))(var1) /* init on <var1:BufferRope>*/;
2832 var_buffer_rope = var1;
2833 var2 = NEW_ropes__ImmutableRope(&type_ropes__ImmutableRope);
2834 ((void (*)(val*))(var2->class->vft[COLOR_ropes__ImmutableRope__init]))(var2) /* init on <var2:ImmutableRope>*/;
2835 var_new_rope = var2;
2836 var3 = NEW_ropes__DFSRopeLeafIterator(&type_ropes__DFSRopeLeafIterator);
2837 ((void (*)(val*, val*))(var3->class->vft[COLOR_ropes__DFSRopeLeafIterator__init]))(var3, self) /* init on <var3:DFSRopeLeafIterator>*/;
2838 var_iter = var3;
2839 for(;;) {
2840 var4 = ((short int (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_iter) /* is_ok on <var_iter:DFSRopeLeafIterator>*/;
2841 if (!var4) break;
2842 var5 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:DFSRopeLeafIterator>*/;
2843 var6 = ((val* (*)(val*))(var5->class->vft[COLOR_ropes__LeafNode__value]))(var5) /* value on <var5:nullable Object(LeafNode)>*/;
2844 var7 = ((val* (*)(val*, val*))(var_buffer_rope->class->vft[COLOR_ropes__BufferRope__append]))(var_buffer_rope, var6) /* append on <var_buffer_rope:BufferRope>*/;
2845 var7;
2846 ((void (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_iter) /* next on <var_iter:DFSRopeLeafIterator>*/;
2847 CONTINUE_label: (void)0;
2848 }
2849 BREAK_label: (void)0;
2850 var8 = ((val* (*)(val*))(var_buffer_rope->class->vft[COLOR_ropes__Rope__parent_node]))(var_buffer_rope) /* parent_node on <var_buffer_rope:BufferRope>*/;
2851 ((void (*)(val*, val*))(var_new_rope->class->vft[COLOR_ropes__Rope__parent_node_61d]))(var_new_rope, var8) /* parent_node= on <var_new_rope:ImmutableRope>*/;
2852 var9 = ((short int (*)(val*))(self->class->vft[COLOR_ropes__BufferRope__is_dirty]))(self) /* is_dirty on <self:BufferRope>*/;
2853 var10 = !var9;
2854 if (var10){
2855 var11 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__str_representation]))(self) /* str_representation on <self:BufferRope>*/;
2856 ((void (*)(val*, val*))(var_new_rope->class->vft[COLOR_ropes__Rope__str_representation_61d]))(var_new_rope, var11) /* str_representation= on <var_new_rope:ImmutableRope>*/;
2857 } else {
2858 }
2859 var = var_new_rope;
2860 goto RET_LABEL;
2861 RET_LABEL:;
2862 return var;
2863 }
2864 /* method ropes#BufferRope#freeze for (self: Object): ImmutableRope */
2865 val* VIRTUAL_ropes__BufferRope__freeze(val* self) {
2866 val* var /* : ImmutableRope */;
2867 val* var1 /* : ImmutableRope */;
2868 var1 = ropes__BufferRope__freeze(self);
2869 var = var1;
2870 RET_LABEL:;
2871 return var;
2872 }
2873 /* method ropes#BufferRope#to_immutable for (self: BufferRope): ImmutableRope */
2874 val* ropes__BufferRope__to_immutable(val* self) {
2875 val* var /* : ImmutableRope */;
2876 val* var1 /* : ImmutableRope */;
2877 val* var_immutable_self /* var immutable_self: ImmutableRope */;
2878 val* var2 /* : RopeNode */;
2879 var1 = NEW_ropes__ImmutableRope(&type_ropes__ImmutableRope);
2880 ((void (*)(val*))(var1->class->vft[COLOR_ropes__ImmutableRope__init]))(var1) /* init on <var1:ImmutableRope>*/;
2881 var_immutable_self = var1;
2882 var2 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__parent_node]))(self) /* parent_node on <self:BufferRope>*/;
2883 ((void (*)(val*, val*))(var_immutable_self->class->vft[COLOR_ropes__Rope__parent_node_61d]))(var_immutable_self, var2) /* parent_node= on <var_immutable_self:ImmutableRope>*/;
2884 var = var_immutable_self;
2885 goto RET_LABEL;
2886 RET_LABEL:;
2887 return var;
2888 }
2889 /* method ropes#BufferRope#to_immutable for (self: Object): ImmutableRope */
2890 val* VIRTUAL_ropes__BufferRope__to_immutable(val* self) {
2891 val* var /* : ImmutableRope */;
2892 val* var1 /* : ImmutableRope */;
2893 var1 = ropes__BufferRope__to_immutable(self);
2894 var = var1;
2895 RET_LABEL:;
2896 return var;
2897 }
2898 /* method ropes#BufferRope#subrope for (self: BufferRope, Int, Int): BufferRope */
2899 val* ropes__BufferRope__subrope(val* self, long p0, long p1) {
2900 val* var /* : BufferRope */;
2901 long var_index_from /* var index_from: Int */;
2902 long var_count /* var count: Int */;
2903 val* var1 /* : Rope */;
2904 short int var2 /* : Bool */;
2905 int cltype;
2906 int idtype;
2907 const char* var_class_name;
2908 var_index_from = p0;
2909 var_count = p1;
2910 var1 = ((val* (*)(val*, long, long))(self->class->vft[COLOR_ropes__BufferRope__subrope]))(self, p0, p1) /* subrope on <self:BufferRope>*/;
2911 /* <var1:Rope> isa BufferRope */
2912 cltype = type_ropes__BufferRope.color;
2913 idtype = type_ropes__BufferRope.id;
2914 if(cltype >= var1->type->table_size) {
2915 var2 = 0;
2916 } else {
2917 var2 = var1->type->type_table[cltype] == idtype;
2918 }
2919 if (!var2) {
2920 var_class_name = var1 == NULL ? "null" : var1->type->name;
2921 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "BufferRope", var_class_name);
2922 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 603);
2923 show_backtrace(1);
2924 }
2925 var = var1;
2926 goto RET_LABEL;
2927 RET_LABEL:;
2928 return var;
2929 }
2930 /* method ropes#BufferRope#subrope for (self: Object, Int, Int): Rope */
2931 val* VIRTUAL_ropes__BufferRope__subrope(val* self, long p0, long p1) {
2932 val* var /* : Rope */;
2933 val* var1 /* : BufferRope */;
2934 var1 = ropes__BufferRope__subrope(self, p0, p1);
2935 var = var1;
2936 RET_LABEL:;
2937 return var;
2938 }
2939 /* method ropes#BufferRope#* for (self: BufferRope, Int): BufferRope */
2940 val* ropes__BufferRope___42d(val* self, long p0) {
2941 val* var /* : BufferRope */;
2942 long var_repeats /* var repeats: Int */;
2943 val* var1 /* : Rope */;
2944 short int var2 /* : Bool */;
2945 int cltype;
2946 int idtype;
2947 const char* var_class_name;
2948 var_repeats = p0;
2949 var1 = ((val* (*)(val*, long))(self->class->vft[COLOR_ropes__BufferRope___42d]))(self, p0) /* * on <self:BufferRope>*/;
2950 /* <var1:Rope> isa BufferRope */
2951 cltype = type_ropes__BufferRope.color;
2952 idtype = type_ropes__BufferRope.id;
2953 if(cltype >= var1->type->table_size) {
2954 var2 = 0;
2955 } else {
2956 var2 = var1->type->type_table[cltype] == idtype;
2957 }
2958 if (!var2) {
2959 var_class_name = var1 == NULL ? "null" : var1->type->name;
2960 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "BufferRope", var_class_name);
2961 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 608);
2962 show_backtrace(1);
2963 }
2964 var = var1;
2965 goto RET_LABEL;
2966 RET_LABEL:;
2967 return var;
2968 }
2969 /* method ropes#BufferRope#* for (self: Object, Int): Rope */
2970 val* VIRTUAL_ropes__BufferRope___42d(val* self, long p0) {
2971 val* var /* : Rope */;
2972 val* var1 /* : BufferRope */;
2973 var1 = ropes__BufferRope___42d(self, p0);
2974 var = var1;
2975 RET_LABEL:;
2976 return var;
2977 }
2978 /* method ropes#BufferRope#+ for (self: BufferRope, Rope): BufferRope */
2979 val* ropes__BufferRope___43d(val* self, val* p0) {
2980 val* var /* : BufferRope */;
2981 val* var_other /* var other: Rope */;
2982 val* var1 /* : Rope */;
2983 short int var2 /* : Bool */;
2984 int cltype;
2985 int idtype;
2986 const char* var_class_name;
2987 var_other = p0;
2988 var1 = ((val* (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope___43d]))(self, p0) /* + on <self:BufferRope>*/;
2989 /* <var1:Rope> isa BufferRope */
2990 cltype = type_ropes__BufferRope.color;
2991 idtype = type_ropes__BufferRope.id;
2992 if(cltype >= var1->type->table_size) {
2993 var2 = 0;
2994 } else {
2995 var2 = var1->type->type_table[cltype] == idtype;
2996 }
2997 if (!var2) {
2998 var_class_name = var1 == NULL ? "null" : var1->type->name;
2999 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "BufferRope", var_class_name);
3000 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 613);
3001 show_backtrace(1);
3002 }
3003 var = var1;
3004 goto RET_LABEL;
3005 RET_LABEL:;
3006 return var;
3007 }
3008 /* method ropes#BufferRope#+ for (self: Object, Rope): Rope */
3009 val* VIRTUAL_ropes__BufferRope___43d(val* self, val* p0) {
3010 val* var /* : Rope */;
3011 val* var1 /* : BufferRope */;
3012 var1 = ropes__BufferRope___43d(self, p0);
3013 var = var1;
3014 RET_LABEL:;
3015 return var;
3016 }
3017 /* method ropes#BufferRope#multi_concat for (self: BufferRope, Array[Rope]): BufferRope */
3018 val* ropes__BufferRope__multi_concat(val* self, val* p0) {
3019 val* var /* : BufferRope */;
3020 val* var_ropes /* var ropes: Array[Rope] */;
3021 val* var1 /* : Rope */;
3022 short int var2 /* : Bool */;
3023 int cltype;
3024 int idtype;
3025 const char* var_class_name;
3026 var_ropes = p0;
3027 var1 = ((val* (*)(val*, val*))(self->class->vft[COLOR_ropes__BufferRope__multi_concat]))(self, p0) /* multi_concat on <self:BufferRope>*/;
3028 /* <var1:Rope> isa BufferRope */
3029 cltype = type_ropes__BufferRope.color;
3030 idtype = type_ropes__BufferRope.id;
3031 if(cltype >= var1->type->table_size) {
3032 var2 = 0;
3033 } else {
3034 var2 = var1->type->type_table[cltype] == idtype;
3035 }
3036 if (!var2) {
3037 var_class_name = var1 == NULL ? "null" : var1->type->name;
3038 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "BufferRope", var_class_name);
3039 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 618);
3040 show_backtrace(1);
3041 }
3042 var = var1;
3043 goto RET_LABEL;
3044 RET_LABEL:;
3045 return var;
3046 }
3047 /* method ropes#BufferRope#multi_concat for (self: Object, Array[Rope]): Rope */
3048 val* VIRTUAL_ropes__BufferRope__multi_concat(val* self, val* p0) {
3049 val* var /* : Rope */;
3050 val* var1 /* : BufferRope */;
3051 var1 = ropes__BufferRope__multi_concat(self, p0);
3052 var = var1;
3053 RET_LABEL:;
3054 return var;
3055 }
3056 /* method ropes#BufferRope#to_s for (self: BufferRope): String */
3057 val* ropes__BufferRope__to_s(val* self) {
3058 val* var /* : String */;
3059 short int var1 /* : Bool */;
3060 val* var2 /* : nullable String */;
3061 val* var3 /* : null */;
3062 short int var4 /* : Bool */;
3063 short int var_ /* var : Bool */;
3064 short int var5 /* : Bool */;
3065 val* var6 /* : String */;
3066 short int var7 /* : Bool */;
3067 val* var8 /* : nullable String */;
3068 var2 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__str_representation]))(self) /* str_representation on <self:BufferRope>*/;
3069 var3 = NULL;
3070 if (var2 == NULL) {
3071 var4 = 1; /* is null */
3072 } else {
3073 var4 = 0; /* arg is null but recv is not */
3074 }
3075 var_ = var4;
3076 if (var4){
3077 var1 = var_;
3078 } else {
3079 var5 = ((short int (*)(val*))(self->class->vft[COLOR_ropes__BufferRope__is_dirty]))(self) /* is_dirty on <self:BufferRope>*/;
3080 var1 = var5;
3081 }
3082 if (var1){
3083 var6 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__flatten]))(self) /* flatten on <self:BufferRope>*/;
3084 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__Rope__str_representation_61d]))(self, var6) /* str_representation= on <self:BufferRope>*/;
3085 var7 = 0;
3086 ((void (*)(val*, short int))(self->class->vft[COLOR_ropes__BufferRope__is_dirty_61d]))(self, var7) /* is_dirty= on <self:BufferRope>*/;
3087 } else {
3088 }
3089 var8 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__Rope__str_representation]))(self) /* str_representation on <self:BufferRope>*/;
3090 if (var8 == NULL) {
3091 fprintf(stderr, "Runtime error: %s", "Cast failed");
3092 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 629);
3093 show_backtrace(1);
3094 }
3095 var = var8;
3096 goto RET_LABEL;
3097 RET_LABEL:;
3098 return var;
3099 }
3100 /* method ropes#BufferRope#to_s for (self: Object): String */
3101 val* VIRTUAL_ropes__BufferRope__to_s(val* self) {
3102 val* var /* : String */;
3103 val* var1 /* : String */;
3104 var1 = ropes__BufferRope__to_s(self);
3105 var = var1;
3106 RET_LABEL:;
3107 return var;
3108 }
3109 /* method ropes#ImmutableRope#init for (self: ImmutableRope) */
3110 void ropes__ImmutableRope__init(val* self) {
3111 ((void (*)(val*))(self->class->vft[COLOR_ropes__Rope__init]))(self) /* init on <self:ImmutableRope>*/;
3112 RET_LABEL:;
3113 }
3114 /* method ropes#ImmutableRope#init for (self: Object) */
3115 void VIRTUAL_ropes__ImmutableRope__init(val* self) {
3116 ropes__ImmutableRope__init(self);
3117 RET_LABEL:;
3118 }
3119 /* method ropes#ImmutableRope#with_string for (self: ImmutableRope, AbstractString) */
3120 void ropes__ImmutableRope__with_string(val* self, val* p0) {
3121 val* var_str /* var str: AbstractString */;
3122 var_str = p0;
3123 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__Rope__with_string]))(self, p0) /* with_string on <self:ImmutableRope>*/;
3124 RET_LABEL:;
3125 }
3126 /* method ropes#ImmutableRope#with_string for (self: Object, AbstractString) */
3127 void VIRTUAL_ropes__ImmutableRope__with_string(val* self, val* p0) {
3128 ropes__ImmutableRope__with_string(self, p0);
3129 RET_LABEL:;
3130 }
3131 /* method ropes#ImmutableRope#subrope for (self: ImmutableRope, Int, Int): ImmutableRope */
3132 val* ropes__ImmutableRope__subrope(val* self, long p0, long p1) {
3133 val* var /* : ImmutableRope */;
3134 long var_index_from /* var index_from: Int */;
3135 long var_count /* var count: Int */;
3136 val* var1 /* : Rope */;
3137 short int var2 /* : Bool */;
3138 int cltype;
3139 int idtype;
3140 const char* var_class_name;
3141 val* var3 /* : ImmutableRope */;
3142 var_index_from = p0;
3143 var_count = p1;
3144 var1 = ((val* (*)(val*, long, long))(self->class->vft[COLOR_ropes__ImmutableRope__subrope]))(self, p0, p1) /* subrope on <self:ImmutableRope>*/;
3145 /* <var1:Rope> isa BufferRope */
3146 cltype = type_ropes__BufferRope.color;
3147 idtype = type_ropes__BufferRope.id;
3148 if(cltype >= var1->type->table_size) {
3149 var2 = 0;
3150 } else {
3151 var2 = var1->type->type_table[cltype] == idtype;
3152 }
3153 if (!var2) {
3154 var_class_name = var1 == NULL ? "null" : var1->type->name;
3155 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "BufferRope", var_class_name);
3156 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 654);
3157 show_backtrace(1);
3158 }
3159 var3 = ((val* (*)(val*))(var1->class->vft[COLOR_ropes__BufferRope__to_immutable]))(var1) /* to_immutable on <var1:Rope(BufferRope)>*/;
3160 var = var3;
3161 goto RET_LABEL;
3162 RET_LABEL:;
3163 return var;
3164 }
3165 /* method ropes#ImmutableRope#subrope for (self: Object, Int, Int): Rope */
3166 val* VIRTUAL_ropes__ImmutableRope__subrope(val* self, long p0, long p1) {
3167 val* var /* : Rope */;
3168 val* var1 /* : ImmutableRope */;
3169 var1 = ropes__ImmutableRope__subrope(self, p0, p1);
3170 var = var1;
3171 RET_LABEL:;
3172 return var;
3173 }
3174 /* method ropes#ImmutableRope#* for (self: ImmutableRope, Int): ImmutableRope */
3175 val* ropes__ImmutableRope___42d(val* self, long p0) {
3176 val* var /* : ImmutableRope */;
3177 long var_repeats /* var repeats: Int */;
3178 val* var1 /* : Rope */;
3179 short int var2 /* : Bool */;
3180 int cltype;
3181 int idtype;
3182 const char* var_class_name;
3183 val* var3 /* : ImmutableRope */;
3184 var_repeats = p0;
3185 var1 = ((val* (*)(val*, long))(self->class->vft[COLOR_ropes__ImmutableRope___42d]))(self, p0) /* * on <self:ImmutableRope>*/;
3186 /* <var1:Rope> isa BufferRope */
3187 cltype = type_ropes__BufferRope.color;
3188 idtype = type_ropes__BufferRope.id;
3189 if(cltype >= var1->type->table_size) {
3190 var2 = 0;
3191 } else {
3192 var2 = var1->type->type_table[cltype] == idtype;
3193 }
3194 if (!var2) {
3195 var_class_name = var1 == NULL ? "null" : var1->type->name;
3196 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "BufferRope", var_class_name);
3197 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 659);
3198 show_backtrace(1);
3199 }
3200 var3 = ((val* (*)(val*))(var1->class->vft[COLOR_ropes__BufferRope__to_immutable]))(var1) /* to_immutable on <var1:Rope(BufferRope)>*/;
3201 var = var3;
3202 goto RET_LABEL;
3203 RET_LABEL:;
3204 return var;
3205 }
3206 /* method ropes#ImmutableRope#* for (self: Object, Int): Rope */
3207 val* VIRTUAL_ropes__ImmutableRope___42d(val* self, long p0) {
3208 val* var /* : Rope */;
3209 val* var1 /* : ImmutableRope */;
3210 var1 = ropes__ImmutableRope___42d(self, p0);
3211 var = var1;
3212 RET_LABEL:;
3213 return var;
3214 }
3215 /* method ropes#ImmutableRope#+ for (self: ImmutableRope, Rope): ImmutableRope */
3216 val* ropes__ImmutableRope___43d(val* self, val* p0) {
3217 val* var /* : ImmutableRope */;
3218 val* var_other /* var other: Rope */;
3219 val* var1 /* : Rope */;
3220 short int var2 /* : Bool */;
3221 int cltype;
3222 int idtype;
3223 const char* var_class_name;
3224 val* var3 /* : ImmutableRope */;
3225 var_other = p0;
3226 var1 = ((val* (*)(val*, val*))(self->class->vft[COLOR_ropes__ImmutableRope___43d]))(self, p0) /* + on <self:ImmutableRope>*/;
3227 /* <var1:Rope> isa BufferRope */
3228 cltype = type_ropes__BufferRope.color;
3229 idtype = type_ropes__BufferRope.id;
3230 if(cltype >= var1->type->table_size) {
3231 var2 = 0;
3232 } else {
3233 var2 = var1->type->type_table[cltype] == idtype;
3234 }
3235 if (!var2) {
3236 var_class_name = var1 == NULL ? "null" : var1->type->name;
3237 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "BufferRope", var_class_name);
3238 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 664);
3239 show_backtrace(1);
3240 }
3241 var3 = ((val* (*)(val*))(var1->class->vft[COLOR_ropes__BufferRope__to_immutable]))(var1) /* to_immutable on <var1:Rope(BufferRope)>*/;
3242 var = var3;
3243 goto RET_LABEL;
3244 RET_LABEL:;
3245 return var;
3246 }
3247 /* method ropes#ImmutableRope#+ for (self: Object, Rope): Rope */
3248 val* VIRTUAL_ropes__ImmutableRope___43d(val* self, val* p0) {
3249 val* var /* : Rope */;
3250 val* var1 /* : ImmutableRope */;
3251 var1 = ropes__ImmutableRope___43d(self, p0);
3252 var = var1;
3253 RET_LABEL:;
3254 return var;
3255 }
3256 /* method ropes#ImmutableRope#multi_concat for (self: ImmutableRope, Array[Rope]): ImmutableRope */
3257 val* ropes__ImmutableRope__multi_concat(val* self, val* p0) {
3258 val* var /* : ImmutableRope */;
3259 val* var_ropes /* var ropes: Array[Rope] */;
3260 val* var1 /* : Rope */;
3261 short int var2 /* : Bool */;
3262 int cltype;
3263 int idtype;
3264 const char* var_class_name;
3265 val* var3 /* : ImmutableRope */;
3266 var_ropes = p0;
3267 var1 = ((val* (*)(val*, val*))(self->class->vft[COLOR_ropes__ImmutableRope__multi_concat]))(self, p0) /* multi_concat on <self:ImmutableRope>*/;
3268 /* <var1:Rope> isa BufferRope */
3269 cltype = type_ropes__BufferRope.color;
3270 idtype = type_ropes__BufferRope.id;
3271 if(cltype >= var1->type->table_size) {
3272 var2 = 0;
3273 } else {
3274 var2 = var1->type->type_table[cltype] == idtype;
3275 }
3276 if (!var2) {
3277 var_class_name = var1 == NULL ? "null" : var1->type->name;
3278 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "BufferRope", var_class_name);
3279 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 669);
3280 show_backtrace(1);
3281 }
3282 var3 = ((val* (*)(val*))(var1->class->vft[COLOR_ropes__BufferRope__to_immutable]))(var1) /* to_immutable on <var1:Rope(BufferRope)>*/;
3283 var = var3;
3284 goto RET_LABEL;
3285 RET_LABEL:;
3286 return var;
3287 }
3288 /* method ropes#ImmutableRope#multi_concat for (self: Object, Array[Rope]): Rope */
3289 val* VIRTUAL_ropes__ImmutableRope__multi_concat(val* self, val* p0) {
3290 val* var /* : Rope */;
3291 val* var1 /* : ImmutableRope */;
3292 var1 = ropes__ImmutableRope__multi_concat(self, p0);
3293 var = var1;
3294 RET_LABEL:;
3295 return var;
3296 }
3297 /* method ropes#CharRopeView#target for (self: CharRopeView): Rope */
3298 val* ropes__CharRopeView__target(val* self) {
3299 val* var /* : Rope */;
3300 val* var1 /* : Rope */;
3301 var1 = self->attrs[COLOR_ropes__CharRopeView___64dtarget].val; /* @target on <self:CharRopeView> */
3302 if (var1 == NULL) {
3303 fprintf(stderr, "Runtime error: %s", "Uninitialized attribute @target");
3304 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 681);
3305 show_backtrace(1);
3306 }
3307 var = var1;
3308 RET_LABEL:;
3309 return var;
3310 }
3311 /* method ropes#CharRopeView#target for (self: Object): Rope */
3312 val* VIRTUAL_ropes__CharRopeView__target(val* self) {
3313 val* var /* : Rope */;
3314 val* var1 /* : Rope */;
3315 var1 = ropes__CharRopeView__target(self);
3316 var = var1;
3317 RET_LABEL:;
3318 return var;
3319 }
3320 /* method ropes#CharRopeView#target= for (self: CharRopeView, Rope) */
3321 void ropes__CharRopeView__target_61d(val* self, val* p0) {
3322 self->attrs[COLOR_ropes__CharRopeView___64dtarget].val = p0; /* @target on <self:CharRopeView> */
3323 RET_LABEL:;
3324 }
3325 /* method ropes#CharRopeView#target= for (self: Object, Rope) */
3326 void VIRTUAL_ropes__CharRopeView__target_61d(val* self, val* p0) {
3327 ropes__CharRopeView__target_61d(self, p0);
3328 RET_LABEL:;
3329 }
3330 /* method ropes#CharRopeView#init for (self: CharRopeView, Rope) */
3331 void ropes__CharRopeView__init(val* self, val* p0) {
3332 val* var_tgt /* var tgt: Rope */;
3333 var_tgt = p0;
3334 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__CharRopeView__target_61d]))(self, var_tgt) /* target= on <self:CharRopeView>*/;
3335 RET_LABEL:;
3336 }
3337 /* method ropes#CharRopeView#init for (self: Object, Rope) */
3338 void VIRTUAL_ropes__CharRopeView__init(val* self, val* p0) {
3339 ropes__CharRopeView__init(self, p0);
3340 RET_LABEL:;
3341 }
3342 /* method ropes#CharRopeView#[] for (self: CharRopeView, Int): Char */
3343 char ropes__CharRopeView___91d_93d(val* self, long p0) {
3344 char var /* : Char */;
3345 long var_position /* var position: Int */;
3346 val* var1 /* : Rope */;
3347 val* var2 /* : TupleLeafNodePos */;
3348 val* var_tuple /* var tuple: TupleLeafNodePos */;
3349 val* var3 /* : LeafNode */;
3350 val* var4 /* : String */;
3351 long var5 /* : Int */;
3352 val* var6 /* : nullable Object */;
3353 char var7 /* : Char */;
3354 var_position = p0;
3355 var1 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__CharRopeView__target]))(self) /* target on <self:CharRopeView>*/;
3356 var2 = ((val* (*)(val*, long))(var1->class->vft[COLOR_ropes__Rope__get_node_for_pos]))(var1, var_position) /* get_node_for_pos on <var1:Rope>*/;
3357 var_tuple = var2;
3358 var3 = ((val* (*)(val*))(var_tuple->class->vft[COLOR_ropes__TupleLeafNodePos__curr_node]))(var_tuple) /* curr_node on <var_tuple:TupleLeafNodePos>*/;
3359 var4 = ((val* (*)(val*))(var3->class->vft[COLOR_ropes__LeafNode__value]))(var3) /* value on <var3:LeafNode>*/;
3360 var5 = ((long (*)(val*))(var_tuple->class->vft[COLOR_ropes__TupleLeafNodePos__corrected_pos]))(var_tuple) /* corrected_pos on <var_tuple:TupleLeafNodePos>*/;
3361 var6 = ((val* (*)(val*, long))(var4->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(var4, var5) /* [] on <var4:String>*/;
3362 var7 = ((struct instance_kernel__Char*)var6)->value; /* autounbox from nullable Object to Char */;
3363 var = var7;
3364 goto RET_LABEL;
3365 RET_LABEL:;
3366 return var;
3367 }
3368 /* method ropes#CharRopeView#[] for (self: Object, Int): nullable Object */
3369 val* VIRTUAL_ropes__CharRopeView___91d_93d(val* self, long p0) {
3370 val* var /* : nullable Object */;
3371 char var1 /* : Char */;
3372 val* var2 /* : nullable Object */;
3373 var1 = ropes__CharRopeView___91d_93d(self, p0);
3374 var2 = BOX_kernel__Char(var1); /* autobox from Char to nullable Object */
3375 var = var2;
3376 RET_LABEL:;
3377 return var;
3378 }
3379 /* method ropes#CharRopeView#first for (self: CharRopeView): Char */
3380 char ropes__CharRopeView__first(val* self) {
3381 char var /* : Char */;
3382 long var1 /* : Int */;
3383 val* var2 /* : nullable Object */;
3384 char var3 /* : Char */;
3385 var1 = 0;
3386 var2 = ((val* (*)(val*, long))(self->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(self, var1) /* [] on <self:CharRopeView>*/;
3387 var3 = ((struct instance_kernel__Char*)var2)->value; /* autounbox from nullable Object to Char */;
3388 var = var3;
3389 goto RET_LABEL;
3390 RET_LABEL:;
3391 return var;
3392 }
3393 /* method ropes#CharRopeView#first for (self: Object): nullable Object */
3394 val* VIRTUAL_ropes__CharRopeView__first(val* self) {
3395 val* var /* : nullable Object */;
3396 char var1 /* : Char */;
3397 val* var2 /* : nullable Object */;
3398 var1 = ropes__CharRopeView__first(self);
3399 var2 = BOX_kernel__Char(var1); /* autobox from Char to nullable Object */
3400 var = var2;
3401 RET_LABEL:;
3402 return var;
3403 }
3404 /* method ropes#CharRopeView#index_of for (self: CharRopeView, Char): Int */
3405 long ropes__CharRopeView__index_of(val* self, char p0) {
3406 long var /* : Int */;
3407 short int var1 /* : Bool */;
3408 int cltype;
3409 int idtype;
3410 const char* var_class_name;
3411 char var_char /* var char: Char */;
3412 val* var2 /* : RopeCharIterator */;
3413 val* var3 /* : Rope */;
3414 val* var_intern_iter /* var intern_iter: RopeCharIterator */;
3415 short int var4 /* : Bool */;
3416 val* var5 /* : nullable Object */;
3417 short int var6 /* : Bool */;
3418 short int var8 /* : Bool */;
3419 char var9 /* : Char */;
3420 long var10 /* : Int */;
3421 long var11 /* : Int */;
3422 long var12 /* : Int */;
3423 long var14 /* : Int */;
3424 /* Covariant cast for argument 0 (char) <p0:Char> isa SequenceRead#0 */
3425 /* <p0:Char> isa SequenceRead#0 */
3426 var1 = 1; /* easy <p0:Char> isa SequenceRead#0*/
3427 if (!var1) {
3428 var_class_name = type_kernel__Char.name;
3429 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "SequenceRead#0", var_class_name);
3430 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 697);
3431 show_backtrace(1);
3432 }
3433 var_char = p0;
3434 var2 = NEW_ropes__RopeCharIterator(&type_ropes__RopeCharIterator);
3435 var3 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__CharRopeView__target]))(self) /* target on <self:CharRopeView>*/;
3436 ((void (*)(val*, val*))(var2->class->vft[COLOR_ropes__RopeCharIterator__init]))(var2, var3) /* init on <var2:RopeCharIterator>*/;
3437 var_intern_iter = var2;
3438 for(;;) {
3439 var4 = ((short int (*)(val*))(var_intern_iter->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var_intern_iter) /* is_ok on <var_intern_iter:RopeCharIterator>*/;
3440 if (!var4) break;
3441 var5 = ((val* (*)(val*))(var_intern_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_intern_iter) /* item on <var_intern_iter:RopeCharIterator>*/;
3442 { /* Inline kernel#Char#== (var5,var_char) */
3443 var8 = (var5 != NULL) && (var5->class == &class_kernel__Char);
3444 if (var8) {
3445 var9 = ((struct instance_kernel__Char*)var5)->value; /* autounbox from nullable Object to Char */;
3446 var8 = (var9 == var_char);
3447 }
3448 var6 = var8;
3449 goto RET_LABEL7;
3450 RET_LABEL7:(void)0;
3451 }
3452 if (var6){
3453 var10 = ((long (*)(val*))(var_intern_iter->class->vft[COLOR_abstract_collection__IndexedIterator__index]))(var_intern_iter) /* index on <var_intern_iter:RopeCharIterator>*/;
3454 var = var10;
3455 goto RET_LABEL;
3456 } else {
3457 }
3458 ((void (*)(val*))(var_intern_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_intern_iter) /* next on <var_intern_iter:RopeCharIterator>*/;
3459 CONTINUE_label: (void)0;
3460 }
3461 BREAK_label: (void)0;
3462 var11 = 1;
3463 { /* Inline kernel#Int#unary - (var11) */
3464 var14 = -var11;
3465 var12 = var14;
3466 goto RET_LABEL13;
3467 RET_LABEL13:(void)0;
3468 }
3469 var = var12;
3470 goto RET_LABEL;
3471 RET_LABEL:;
3472 return var;
3473 }
3474 /* method ropes#CharRopeView#index_of for (self: Object, nullable Object): Int */
3475 long VIRTUAL_ropes__CharRopeView__index_of(val* self, val* p0) {
3476 long var /* : Int */;
3477 long var1 /* : Int */;
3478 char var2 /* : Char */;
3479 var2 = ((struct instance_kernel__Char*)p0)->value; /* autounbox from nullable Object to Char */;
3480 var1 = ropes__CharRopeView__index_of(self, var2);
3481 var = var1;
3482 RET_LABEL:;
3483 return var;
3484 }
3485 /* method ropes#CharRopeView#iterator for (self: CharRopeView): Iterator[Char] */
3486 val* ropes__CharRopeView__iterator(val* self) {
3487 val* var /* : Iterator[Char] */;
3488 val* var1 /* : RopeCharIterator */;
3489 val* var2 /* : Rope */;
3490 var1 = NEW_ropes__RopeCharIterator(&type_ropes__RopeCharIterator);
3491 var2 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__CharRopeView__target]))(self) /* target on <self:CharRopeView>*/;
3492 ((void (*)(val*, val*))(var1->class->vft[COLOR_ropes__RopeCharIterator__init]))(var1, var2) /* init on <var1:RopeCharIterator>*/;
3493 var = var1;
3494 goto RET_LABEL;
3495 RET_LABEL:;
3496 return var;
3497 }
3498 /* method ropes#CharRopeView#iterator for (self: Object): Iterator[nullable Object] */
3499 val* VIRTUAL_ropes__CharRopeView__iterator(val* self) {
3500 val* var /* : Iterator[nullable Object] */;
3501 val* var1 /* : Iterator[Char] */;
3502 var1 = ropes__CharRopeView__iterator(self);
3503 var = var1;
3504 RET_LABEL:;
3505 return var;
3506 }
3507 /* method ropes#CharRopeView#last for (self: CharRopeView): Char */
3508 char ropes__CharRopeView__last(val* self) {
3509 char var /* : Char */;
3510 long var1 /* : Int */;
3511 long var2 /* : Int */;
3512 long var3 /* : Int */;
3513 long var5 /* : Int */;
3514 val* var6 /* : nullable Object */;
3515 char var7 /* : Char */;
3516 var1 = ((long (*)(val*))(self->class->vft[COLOR_abstract_collection__Collection__length]))(self) /* length on <self:CharRopeView>*/;
3517 var2 = 1;
3518 { /* Inline kernel#Int#- (var1,var2) */
3519 var5 = var1 - var2;
3520 var3 = var5;
3521 goto RET_LABEL4;
3522 RET_LABEL4:(void)0;
3523 }
3524 var6 = ((val* (*)(val*, long))(self->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(self, var3) /* [] on <self:CharRopeView>*/;
3525 var7 = ((struct instance_kernel__Char*)var6)->value; /* autounbox from nullable Object to Char */;
3526 var = var7;
3527 goto RET_LABEL;
3528 RET_LABEL:;
3529 return var;
3530 }
3531 /* method ropes#CharRopeView#last for (self: Object): nullable Object */
3532 val* VIRTUAL_ropes__CharRopeView__last(val* self) {
3533 val* var /* : nullable Object */;
3534 char var1 /* : Char */;
3535 val* var2 /* : nullable Object */;
3536 var1 = ropes__CharRopeView__last(self);
3537 var2 = BOX_kernel__Char(var1); /* autobox from Char to nullable Object */
3538 var = var2;
3539 RET_LABEL:;
3540 return var;
3541 }
3542 /* method ropes#CharRopeView#length for (self: CharRopeView): Int */
3543 long ropes__CharRopeView__length(val* self) {
3544 long var /* : Int */;
3545 val* var1 /* : Rope */;
3546 long var2 /* : Int */;
3547 var1 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__CharRopeView__target]))(self) /* target on <self:CharRopeView>*/;
3548 var2 = ((long (*)(val*))(var1->class->vft[COLOR_ropes__Rope__length]))(var1) /* length on <var1:Rope>*/;
3549 var = var2;
3550 goto RET_LABEL;
3551 RET_LABEL:;
3552 return var;
3553 }
3554 /* method ropes#CharRopeView#length for (self: Object): Int */
3555 long VIRTUAL_ropes__CharRopeView__length(val* self) {
3556 long var /* : Int */;
3557 long var1 /* : Int */;
3558 var1 = ropes__CharRopeView__length(self);
3559 var = var1;
3560 RET_LABEL:;
3561 return var;
3562 }
3563 /* method ropes#CharRopeView#count for (self: CharRopeView, Char): Int */
3564 long ropes__CharRopeView__count(val* self, char p0) {
3565 long var /* : Int */;
3566 short int var1 /* : Bool */;
3567 int cltype;
3568 int idtype;
3569 const char* var_class_name;
3570 char var_item /* var item: Char */;
3571 long var2 /* : Int */;
3572 long var_count /* var count: Int */;
3573 val* var3 /* : Iterator[nullable Object] */;
3574 val* var_iter /* var iter: Iterator[Char] */;
3575 val* var4 /* : Iterator[nullable Object] */;
3576 short int var5 /* : Bool */;
3577 val* var6 /* : nullable Object */;
3578 char var_i /* var i: Char */;
3579 char var7 /* : Char */;
3580 short int var8 /* : Bool */;
3581 short int var10 /* : Bool */;
3582 long var11 /* : Int */;
3583 long var12 /* : Int */;
3584 long var14 /* : Int */;
3585 /* Covariant cast for argument 0 (item) <p0:Char> isa Collection#0 */
3586 /* <p0:Char> isa Collection#0 */
3587 var1 = 1; /* easy <p0:Char> isa Collection#0*/
3588 if (!var1) {
3589 var_class_name = type_kernel__Char.name;
3590 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "Collection#0", var_class_name);
3591 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 715);
3592 show_backtrace(1);
3593 }
3594 var_item = p0;
3595 var2 = 0;
3596 var_count = var2;
3597 var3 = ((val* (*)(val*))(self->class->vft[COLOR_abstract_collection__Collection__iterator]))(self) /* iterator on <self:CharRopeView>*/;
3598 var_iter = var3;
3599 var4 = ((val* (*)(val*))(self->class->vft[COLOR_abstract_collection__Collection__iterator]))(self) /* iterator on <self:CharRopeView>*/;
3600 for(;;) {
3601 var5 = ((short int (*)(val*))(var4->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var4) /* is_ok on <var4:Iterator[nullable Object]>*/;
3602 if(!var5) break;
3603 var6 = ((val* (*)(val*))(var4->class->vft[COLOR_abstract_collection__Iterator__item]))(var4) /* item on <var4:Iterator[nullable Object]>*/;
3604 var7 = ((struct instance_kernel__Char*)var6)->value; /* autounbox from nullable Object to Char */;
3605 var_i = var7;
3606 { /* Inline kernel#Char#== (var_i,var_item) */
3607 var10 = var_i == var_item;
3608 var8 = var10;
3609 goto RET_LABEL9;
3610 RET_LABEL9:(void)0;
3611 }
3612 if (var8){
3613 var11 = 1;
3614 { /* Inline kernel#Int#+ (var_count,var11) */
3615 var14 = var_count + var11;
3616 var12 = var14;
3617 goto RET_LABEL13;
3618 RET_LABEL13:(void)0;
3619 }
3620 var_count = var12;
3621 } else {
3622 }
3623 CONTINUE_label: (void)0;
3624 ((void (*)(val*))(var4->class->vft[COLOR_abstract_collection__Iterator__next]))(var4) /* next on <var4:Iterator[nullable Object]>*/;
3625 }
3626 BREAK_label: (void)0;
3627 var = var_count;
3628 goto RET_LABEL;
3629 RET_LABEL:;
3630 return var;
3631 }
3632 /* method ropes#CharRopeView#count for (self: Object, nullable Object): Int */
3633 long VIRTUAL_ropes__CharRopeView__count(val* self, val* p0) {
3634 long var /* : Int */;
3635 long var1 /* : Int */;
3636 char var2 /* : Char */;
3637 var2 = ((struct instance_kernel__Char*)p0)->value; /* autounbox from nullable Object to Char */;
3638 var1 = ropes__CharRopeView__count(self, var2);
3639 var = var1;
3640 RET_LABEL:;
3641 return var;
3642 }
3643 /* method ropes#CharRopeView#has_only for (self: CharRopeView, Char): Bool */
3644 short int ropes__CharRopeView__has_only(val* self, char p0) {
3645 short int var /* : Bool */;
3646 short int var1 /* : Bool */;
3647 int cltype;
3648 int idtype;
3649 const char* var_class_name;
3650 char var_item /* var item: Char */;
3651 val* var2 /* : Iterator[nullable Object] */;
3652 short int var3 /* : Bool */;
3653 val* var4 /* : nullable Object */;
3654 char var_i /* var i: Char */;
3655 char var5 /* : Char */;
3656 short int var6 /* : Bool */;
3657 short int var8 /* : Bool */;
3658 short int var9 /* : Bool */;
3659 short int var10 /* : Bool */;
3660 short int var11 /* : Bool */;
3661 /* Covariant cast for argument 0 (item) <p0:Char> isa Collection#0 */
3662 /* <p0:Char> isa Collection#0 */
3663 var1 = 1; /* easy <p0:Char> isa Collection#0*/
3664 if (!var1) {
3665 var_class_name = type_kernel__Char.name;
3666 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "Collection#0", var_class_name);
3667 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 727);
3668 show_backtrace(1);
3669 }
3670 var_item = p0;
3671 var2 = ((val* (*)(val*))(self->class->vft[COLOR_abstract_collection__Collection__iterator]))(self) /* iterator on <self:CharRopeView>*/;
3672 for(;;) {
3673 var3 = ((short int (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var2) /* is_ok on <var2:Iterator[nullable Object]>*/;
3674 if(!var3) break;
3675 var4 = ((val* (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__item]))(var2) /* item on <var2:Iterator[nullable Object]>*/;
3676 var5 = ((struct instance_kernel__Char*)var4)->value; /* autounbox from nullable Object to Char */;
3677 var_i = var5;
3678 { /* Inline kernel#Char#!= (var_i,var_item) */
3679 var8 = var_i == var_item;
3680 var9 = !var8;
3681 var6 = var9;
3682 goto RET_LABEL7;
3683 RET_LABEL7:(void)0;
3684 }
3685 if (var6){
3686 var10 = 0;
3687 var = var10;
3688 goto RET_LABEL;
3689 } else {
3690 }
3691 CONTINUE_label: (void)0;
3692 ((void (*)(val*))(var2->class->vft[COLOR_abstract_collection__Iterator__next]))(var2) /* next on <var2:Iterator[nullable Object]>*/;
3693 }
3694 BREAK_label: (void)0;
3695 var11 = 1;
3696 var = var11;
3697 goto RET_LABEL;
3698 RET_LABEL:;
3699 return var;
3700 }
3701 /* method ropes#CharRopeView#has_only for (self: Object, nullable Object): Bool */
3702 short int VIRTUAL_ropes__CharRopeView__has_only(val* self, val* p0) {
3703 short int var /* : Bool */;
3704 short int var1 /* : Bool */;
3705 char var2 /* : Char */;
3706 var2 = ((struct instance_kernel__Char*)p0)->value; /* autounbox from nullable Object to Char */;
3707 var1 = ropes__CharRopeView__has_only(self, var2);
3708 var = var1;
3709 RET_LABEL:;
3710 return var;
3711 }
3712 /* method ropes#CharRopeView#is_empty for (self: CharRopeView): Bool */
3713 short int ropes__CharRopeView__is_empty(val* self) {
3714 short int var /* : Bool */;
3715 long var1 /* : Int */;
3716 long var2 /* : Int */;
3717 short int var3 /* : Bool */;
3718 short int var5 /* : Bool */;
3719 var1 = ((long (*)(val*))(self->class->vft[COLOR_abstract_collection__Collection__length]))(self) /* length on <self:CharRopeView>*/;
3720 var2 = 0;
3721 { /* Inline kernel#Int#== (var1,var2) */
3722 var5 = var1 == var2;
3723 var3 = var5;
3724 goto RET_LABEL4;
3725 RET_LABEL4:(void)0;
3726 }
3727 var = var3;
3728 goto RET_LABEL;
3729 RET_LABEL:;
3730 return var;
3731 }
3732 /* method ropes#CharRopeView#is_empty for (self: Object): Bool */
3733 short int VIRTUAL_ropes__CharRopeView__is_empty(val* self) {
3734 short int var /* : Bool */;
3735 short int var1 /* : Bool */;
3736 var1 = ropes__CharRopeView__is_empty(self);
3737 var = var1;
3738 RET_LABEL:;
3739 return var;
3740 }
3741 /* method ropes#CharRopeView#to_a for (self: CharRopeView): Array[Char] */
3742 val* ropes__CharRopeView__to_a(val* self) {
3743 val* var /* : Array[Char] */;
3744 val* var1 /* : String */;
3745 val* var2 /* : Array[nullable Object] */;
3746 var1 = ((val* (*)(val*))(self->class->vft[COLOR_string__Object__to_s]))(self) /* to_s on <self:CharRopeView>*/;
3747 var2 = ((val* (*)(val*))(var1->class->vft[COLOR_array__Collection__to_a]))(var1) /* to_a on <var1:String>*/;
3748 var = var2;
3749 goto RET_LABEL;
3750 RET_LABEL:;
3751 return var;
3752 }
3753 /* method ropes#CharRopeView#to_a for (self: Object): Array[nullable Object] */
3754 val* VIRTUAL_ropes__CharRopeView__to_a(val* self) {
3755 val* var /* : Array[nullable Object] */;
3756 val* var1 /* : Array[Char] */;
3757 var1 = ropes__CharRopeView__to_a(self);
3758 var = var1;
3759 RET_LABEL:;
3760 return var;
3761 }
3762 /* method ropes#CharRopeView#to_s for (self: CharRopeView): String */
3763 val* ropes__CharRopeView__to_s(val* self) {
3764 val* var /* : String */;
3765 val* var1 /* : Rope */;
3766 val* var2 /* : String */;
3767 var1 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__CharRopeView__target]))(self) /* target on <self:CharRopeView>*/;
3768 var2 = ((val* (*)(val*))(var1->class->vft[COLOR_string__Object__to_s]))(var1) /* to_s on <var1:Rope>*/;
3769 var = var2;
3770 goto RET_LABEL;
3771 RET_LABEL:;
3772 return var;
3773 }
3774 /* method ropes#CharRopeView#to_s for (self: Object): String */
3775 val* VIRTUAL_ropes__CharRopeView__to_s(val* self) {
3776 val* var /* : String */;
3777 val* var1 /* : String */;
3778 var1 = ropes__CharRopeView__to_s(self);
3779 var = var1;
3780 RET_LABEL:;
3781 return var;
3782 }
3783 /* method ropes#CharRopeView#== for (self: CharRopeView, nullable Object): Bool */
3784 short int ropes__CharRopeView___61d_61d(val* self, val* p0) {
3785 short int var /* : Bool */;
3786 val* var_other /* var other: nullable Object */;
3787 short int var1 /* : Bool */;
3788 int cltype;
3789 int idtype;
3790 short int var2 /* : Bool */;
3791 short int var3 /* : Bool */;
3792 long var4 /* : Int */;
3793 short int var5 /* : Bool */;
3794 short int var7 /* : Bool */;
3795 long var8 /* : Int */;
3796 short int var9 /* : Bool */;
3797 short int var10 /* : Bool */;
3798 val* var11 /* : Iterator[nullable Object] */;
3799 val* var_iter /* var iter: IndexedIterator[Char] */;
3800 val* var12 /* : Iterator[nullable Object] */;
3801 short int var13 /* : Bool */;
3802 val* var14 /* : nullable Object */;
3803 char var_i /* var i: Char */;
3804 char var15 /* : Char */;
3805 val* var16 /* : nullable Object */;
3806 short int var17 /* : Bool */;
3807 short int var19 /* : Bool */;
3808 char var20 /* : Char */;
3809 short int var21 /* : Bool */;
3810 short int var22 /* : Bool */;
3811 short int var23 /* : Bool */;
3812 var_other = p0;
3813 /* <var_other:nullable Object> isa SequenceRead[Char] */
3814 cltype = type_abstract_collection__SequenceReadkernel__Char.color;
3815 idtype = type_abstract_collection__SequenceReadkernel__Char.id;
3816 if(var_other == NULL) {
3817 var1 = 0;
3818 } else {
3819 if(cltype >= var_other->type->table_size) {
3820 var1 = 0;
3821 } else {
3822 var1 = var_other->type->type_table[cltype] == idtype;
3823 }
3824 }
3825 var2 = !var1;
3826 if (var2){
3827 var3 = 0;
3828 var = var3;
3829 goto RET_LABEL;
3830 } else {
3831 }
3832 var4 = ((long (*)(val*))(self->class->vft[COLOR_abstract_collection__Collection__length]))(self) /* length on <self:CharRopeView>*/;
3833 { /* Inline kernel#Int#!= (var4,var_other) */
3834 var7 = (var_other != NULL) && (var_other->class == &class_kernel__Int);
3835 if (var7) {
3836 var8 = ((struct instance_kernel__Int*)var_other)->value; /* autounbox from nullable Object to Int */;
3837 var7 = (var8 == var4);
3838 }
3839 var9 = !var7;
3840 var5 = var9;
3841 goto RET_LABEL6;
3842 RET_LABEL6:(void)0;
3843 }
3844 if (var5){
3845 var10 = 0;
3846 var = var10;
3847 goto RET_LABEL;
3848 } else {
3849 }
3850 var11 = ((val* (*)(val*))(var_other->class->vft[COLOR_abstract_collection__Collection__iterator]))(var_other) /* iterator on <var_other:nullable Object(SequenceRead[Char])>*/;
3851 var_iter = var11;
3852 var12 = ((val* (*)(val*))(self->class->vft[COLOR_abstract_collection__Collection__iterator]))(self) /* iterator on <self:CharRopeView>*/;
3853 for(;;) {
3854 var13 = ((short int (*)(val*))(var12->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var12) /* is_ok on <var12:Iterator[nullable Object]>*/;
3855 if(!var13) break;
3856 var14 = ((val* (*)(val*))(var12->class->vft[COLOR_abstract_collection__Iterator__item]))(var12) /* item on <var12:Iterator[nullable Object]>*/;
3857 var15 = ((struct instance_kernel__Char*)var14)->value; /* autounbox from nullable Object to Char */;
3858 var_i = var15;
3859 var16 = ((val* (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__item]))(var_iter) /* item on <var_iter:IndexedIterator[Char]>*/;
3860 { /* Inline kernel#Char#!= (var_i,var16) */
3861 var19 = (var16 != NULL) && (var16->class == &class_kernel__Char);
3862 if (var19) {
3863 var20 = ((struct instance_kernel__Char*)var16)->value; /* autounbox from nullable Object to Char */;
3864 var19 = (var20 == var_i);
3865 }
3866 var21 = !var19;
3867 var17 = var21;
3868 goto RET_LABEL18;
3869 RET_LABEL18:(void)0;
3870 }
3871 if (var17){
3872 var22 = 0;
3873 var = var22;
3874 goto RET_LABEL;
3875 } else {
3876 }
3877 ((void (*)(val*))(var_iter->class->vft[COLOR_abstract_collection__Iterator__next]))(var_iter) /* next on <var_iter:IndexedIterator[Char]>*/;
3878 CONTINUE_label: (void)0;
3879 ((void (*)(val*))(var12->class->vft[COLOR_abstract_collection__Iterator__next]))(var12) /* next on <var12:Iterator[nullable Object]>*/;
3880 }
3881 BREAK_label: (void)0;
3882 var23 = 1;
3883 var = var23;
3884 goto RET_LABEL;
3885 RET_LABEL:;
3886 return var;
3887 }
3888 /* method ropes#CharRopeView#== for (self: Object, nullable Object): Bool */
3889 short int VIRTUAL_ropes__CharRopeView___61d_61d(val* self, val* p0) {
3890 short int var /* : Bool */;
3891 short int var1 /* : Bool */;
3892 var1 = ropes__CharRopeView___61d_61d(self, p0);
3893 var = var1;
3894 RET_LABEL:;
3895 return var;
3896 }
3897 /* method ropes#TupleVisitNode#init for (self: TupleVisitNode, ConcatNode) */
3898 void ropes__TupleVisitNode__init(val* self, val* p0) {
3899 val* var_tgt /* var tgt: ConcatNode */;
3900 var_tgt = p0;
3901 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__TupleVisitNode__node_61d]))(self, var_tgt) /* node= on <self:TupleVisitNode>*/;
3902 RET_LABEL:;
3903 }
3904 /* method ropes#TupleVisitNode#init for (self: Object, ConcatNode) */
3905 void VIRTUAL_ropes__TupleVisitNode__init(val* self, val* p0) {
3906 ropes__TupleVisitNode__init(self, p0);
3907 RET_LABEL:;
3908 }
3909 /* method ropes#TupleVisitNode#node for (self: TupleVisitNode): ConcatNode */
3910 val* ropes__TupleVisitNode__node(val* self) {
3911 val* var /* : ConcatNode */;
3912 val* var1 /* : ConcatNode */;
3913 var1 = self->attrs[COLOR_ropes__TupleVisitNode___64dnode].val; /* @node on <self:TupleVisitNode> */
3914 if (var1 == NULL) {
3915 fprintf(stderr, "Runtime error: %s", "Uninitialized attribute @node");
3916 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 775);
3917 show_backtrace(1);
3918 }
3919 var = var1;
3920 RET_LABEL:;
3921 return var;
3922 }
3923 /* method ropes#TupleVisitNode#node for (self: Object): ConcatNode */
3924 val* VIRTUAL_ropes__TupleVisitNode__node(val* self) {
3925 val* var /* : ConcatNode */;
3926 val* var1 /* : ConcatNode */;
3927 var1 = ropes__TupleVisitNode__node(self);
3928 var = var1;
3929 RET_LABEL:;
3930 return var;
3931 }
3932 /* method ropes#TupleVisitNode#node= for (self: TupleVisitNode, ConcatNode) */
3933 void ropes__TupleVisitNode__node_61d(val* self, val* p0) {
3934 self->attrs[COLOR_ropes__TupleVisitNode___64dnode].val = p0; /* @node on <self:TupleVisitNode> */
3935 RET_LABEL:;
3936 }
3937 /* method ropes#TupleVisitNode#node= for (self: Object, ConcatNode) */
3938 void VIRTUAL_ropes__TupleVisitNode__node_61d(val* self, val* p0) {
3939 ropes__TupleVisitNode__node_61d(self, p0);
3940 RET_LABEL:;
3941 }
3942 /* method ropes#TupleVisitNode#left_visited for (self: TupleVisitNode): Bool */
3943 short int ropes__TupleVisitNode__left_visited(val* self) {
3944 short int var /* : Bool */;
3945 short int var1 /* : Bool */;
3946 var1 = self->attrs[COLOR_ropes__TupleVisitNode___64dleft_visited].s; /* @left_visited on <self:TupleVisitNode> */
3947 var = var1;
3948 RET_LABEL:;
3949 return var;
3950 }
3951 /* method ropes#TupleVisitNode#left_visited for (self: Object): Bool */
3952 short int VIRTUAL_ropes__TupleVisitNode__left_visited(val* self) {
3953 short int var /* : Bool */;
3954 short int var1 /* : Bool */;
3955 var1 = ropes__TupleVisitNode__left_visited(self);
3956 var = var1;
3957 RET_LABEL:;
3958 return var;
3959 }
3960 /* method ropes#TupleVisitNode#left_visited= for (self: TupleVisitNode, Bool) */
3961 void ropes__TupleVisitNode__left_visited_61d(val* self, short int p0) {
3962 self->attrs[COLOR_ropes__TupleVisitNode___64dleft_visited].s = p0; /* @left_visited on <self:TupleVisitNode> */
3963 RET_LABEL:;
3964 }
3965 /* method ropes#TupleVisitNode#left_visited= for (self: Object, Bool) */
3966 void VIRTUAL_ropes__TupleVisitNode__left_visited_61d(val* self, short int p0) {
3967 ropes__TupleVisitNode__left_visited_61d(self, p0);
3968 RET_LABEL:;
3969 }
3970 /* method ropes#TupleVisitNode#right_visited for (self: TupleVisitNode): Bool */
3971 short int ropes__TupleVisitNode__right_visited(val* self) {
3972 short int var /* : Bool */;
3973 short int var1 /* : Bool */;
3974 var1 = self->attrs[COLOR_ropes__TupleVisitNode___64dright_visited].s; /* @right_visited on <self:TupleVisitNode> */
3975 var = var1;
3976 RET_LABEL:;
3977 return var;
3978 }
3979 /* method ropes#TupleVisitNode#right_visited for (self: Object): Bool */
3980 short int VIRTUAL_ropes__TupleVisitNode__right_visited(val* self) {
3981 short int var /* : Bool */;
3982 short int var1 /* : Bool */;
3983 var1 = ropes__TupleVisitNode__right_visited(self);
3984 var = var1;
3985 RET_LABEL:;
3986 return var;
3987 }
3988 /* method ropes#TupleVisitNode#right_visited= for (self: TupleVisitNode, Bool) */
3989 void ropes__TupleVisitNode__right_visited_61d(val* self, short int p0) {
3990 self->attrs[COLOR_ropes__TupleVisitNode___64dright_visited].s = p0; /* @right_visited on <self:TupleVisitNode> */
3991 RET_LABEL:;
3992 }
3993 /* method ropes#TupleVisitNode#right_visited= for (self: Object, Bool) */
3994 void VIRTUAL_ropes__TupleVisitNode__right_visited_61d(val* self, short int p0) {
3995 ropes__TupleVisitNode__right_visited_61d(self, p0);
3996 RET_LABEL:;
3997 }
3998 /* method ropes#RopeIterator#target for (self: RopeIterator): Rope */
3999 val* ropes__RopeIterator__target(val* self) {
4000 val* var /* : Rope */;
4001 val* var1 /* : Rope */;
4002 var1 = self->attrs[COLOR_ropes__RopeIterator___target].val; /* _target on <self:RopeIterator> */
4003 if (var1 == NULL) {
4004 fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _target");
4005 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 789);
4006 show_backtrace(1);
4007 }
4008 var = var1;
4009 goto RET_LABEL;
4010 RET_LABEL:;
4011 return var;
4012 }
4013 /* method ropes#RopeIterator#target for (self: Object): Rope */
4014 val* VIRTUAL_ropes__RopeIterator__target(val* self) {
4015 val* var /* : Rope */;
4016 val* var1 /* : Rope */;
4017 var1 = ropes__RopeIterator__target(self);
4018 var = var1;
4019 RET_LABEL:;
4020 return var;
4021 }
4022 /* method ropes#RopeIterator#pos for (self: RopeIterator): Int */
4023 long ropes__RopeIterator__pos(val* self) {
4024 long var /* : Int */;
4025 long var1 /* : Int */;
4026 var1 = self->attrs[COLOR_ropes__RopeIterator___64dpos].l; /* @pos on <self:RopeIterator> */
4027 var = var1;
4028 RET_LABEL:;
4029 return var;
4030 }
4031 /* method ropes#RopeIterator#pos for (self: Object): Int */
4032 long VIRTUAL_ropes__RopeIterator__pos(val* self) {
4033 long var /* : Int */;
4034 long var1 /* : Int */;
4035 var1 = ropes__RopeIterator__pos(self);
4036 var = var1;
4037 RET_LABEL:;
4038 return var;
4039 }
4040 /* method ropes#RopeIterator#pos= for (self: RopeIterator, Int) */
4041 void ropes__RopeIterator__pos_61d(val* self, long p0) {
4042 self->attrs[COLOR_ropes__RopeIterator___64dpos].l = p0; /* @pos on <self:RopeIterator> */
4043 RET_LABEL:;
4044 }
4045 /* method ropes#RopeIterator#pos= for (self: Object, Int) */
4046 void VIRTUAL_ropes__RopeIterator__pos_61d(val* self, long p0) {
4047 ropes__RopeIterator__pos_61d(self, p0);
4048 RET_LABEL:;
4049 }
4050 /* method ropes#RopeIterator#init for (self: RopeIterator, Rope) */
4051 void ropes__RopeIterator__init(val* self, val* p0) {
4052 val* var_tgt /* var tgt: Rope */;
4053 var_tgt = p0;
4054 self->attrs[COLOR_ropes__RopeIterator___target].val = var_tgt; /* _target on <self:RopeIterator> */
4055 RET_LABEL:;
4056 }
4057 /* method ropes#RopeIterator#init for (self: Object, Rope) */
4058 void VIRTUAL_ropes__RopeIterator__init(val* self, val* p0) {
4059 ropes__RopeIterator__init(self, p0);
4060 RET_LABEL:;
4061 }
4062 /* method ropes#RopeIterator#with_index for (self: RopeIterator, Rope, Int) */
4063 void ropes__RopeIterator__with_index(val* self, val* p0, long p1) {
4064 val* var_tgt /* var tgt: Rope */;
4065 long var_index /* var index: Int */;
4066 var_tgt = p0;
4067 var_index = p1;
4068 self->attrs[COLOR_ropes__RopeIterator___target].val = var_tgt; /* _target on <self:RopeIterator> */
4069 RET_LABEL:;
4070 }
4071 /* method ropes#RopeIterator#with_index for (self: Object, Rope, Int) */
4072 void VIRTUAL_ropes__RopeIterator__with_index(val* self, val* p0, long p1) {
4073 ropes__RopeIterator__with_index(self, p0, p1);
4074 RET_LABEL:;
4075 }
4076 /* method ropes#RopeCharIterator#sub_str_iter for (self: RopeCharIterator): DFSRopeLeafIterator */
4077 val* ropes__RopeCharIterator__sub_str_iter(val* self) {
4078 val* var /* : DFSRopeLeafIterator */;
4079 val* var1 /* : DFSRopeLeafIterator */;
4080 var1 = self->attrs[COLOR_ropes__RopeCharIterator___64dsub_str_iter].val; /* @sub_str_iter on <self:RopeCharIterator> */
4081 if (var1 == NULL) {
4082 fprintf(stderr, "Runtime error: %s", "Uninitialized attribute @sub_str_iter");
4083 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 810);
4084 show_backtrace(1);
4085 }
4086 var = var1;
4087 RET_LABEL:;
4088 return var;
4089 }
4090 /* method ropes#RopeCharIterator#sub_str_iter for (self: Object): DFSRopeLeafIterator */
4091 val* VIRTUAL_ropes__RopeCharIterator__sub_str_iter(val* self) {
4092 val* var /* : DFSRopeLeafIterator */;
4093 val* var1 /* : DFSRopeLeafIterator */;
4094 var1 = ropes__RopeCharIterator__sub_str_iter(self);
4095 var = var1;
4096 RET_LABEL:;
4097 return var;
4098 }
4099 /* method ropes#RopeCharIterator#sub_str_iter= for (self: RopeCharIterator, DFSRopeLeafIterator) */
4100 void ropes__RopeCharIterator__sub_str_iter_61d(val* self, val* p0) {
4101 self->attrs[COLOR_ropes__RopeCharIterator___64dsub_str_iter].val = p0; /* @sub_str_iter on <self:RopeCharIterator> */
4102 RET_LABEL:;
4103 }
4104 /* method ropes#RopeCharIterator#sub_str_iter= for (self: Object, DFSRopeLeafIterator) */
4105 void VIRTUAL_ropes__RopeCharIterator__sub_str_iter_61d(val* self, val* p0) {
4106 ropes__RopeCharIterator__sub_str_iter_61d(self, p0);
4107 RET_LABEL:;
4108 }
4109 /* method ropes#RopeCharIterator#abs_pos for (self: RopeCharIterator): Int */
4110 long ropes__RopeCharIterator__abs_pos(val* self) {
4111 long var /* : Int */;
4112 long var1 /* : Int */;
4113 var1 = self->attrs[COLOR_ropes__RopeCharIterator___64dabs_pos].l; /* @abs_pos on <self:RopeCharIterator> */
4114 var = var1;
4115 RET_LABEL:;
4116 return var;
4117 }
4118 /* method ropes#RopeCharIterator#abs_pos for (self: Object): Int */
4119 long VIRTUAL_ropes__RopeCharIterator__abs_pos(val* self) {
4120 long var /* : Int */;
4121 long var1 /* : Int */;
4122 var1 = ropes__RopeCharIterator__abs_pos(self);
4123 var = var1;
4124 RET_LABEL:;
4125 return var;
4126 }
4127 /* method ropes#RopeCharIterator#abs_pos= for (self: RopeCharIterator, Int) */
4128 void ropes__RopeCharIterator__abs_pos_61d(val* self, long p0) {
4129 self->attrs[COLOR_ropes__RopeCharIterator___64dabs_pos].l = p0; /* @abs_pos on <self:RopeCharIterator> */
4130 RET_LABEL:;
4131 }
4132 /* method ropes#RopeCharIterator#abs_pos= for (self: Object, Int) */
4133 void VIRTUAL_ropes__RopeCharIterator__abs_pos_61d(val* self, long p0) {
4134 ropes__RopeCharIterator__abs_pos_61d(self, p0);
4135 RET_LABEL:;
4136 }
4137 /* method ropes#RopeCharIterator#sub_pos for (self: RopeCharIterator): Int */
4138 long ropes__RopeCharIterator__sub_pos(val* self) {
4139 long var /* : Int */;
4140 long var1 /* : Int */;
4141 var1 = self->attrs[COLOR_ropes__RopeCharIterator___64dsub_pos].l; /* @sub_pos on <self:RopeCharIterator> */
4142 var = var1;
4143 RET_LABEL:;
4144 return var;
4145 }
4146 /* method ropes#RopeCharIterator#sub_pos for (self: Object): Int */
4147 long VIRTUAL_ropes__RopeCharIterator__sub_pos(val* self) {
4148 long var /* : Int */;
4149 long var1 /* : Int */;
4150 var1 = ropes__RopeCharIterator__sub_pos(self);
4151 var = var1;
4152 RET_LABEL:;
4153 return var;
4154 }
4155 /* method ropes#RopeCharIterator#sub_pos= for (self: RopeCharIterator, Int) */
4156 void ropes__RopeCharIterator__sub_pos_61d(val* self, long p0) {
4157 self->attrs[COLOR_ropes__RopeCharIterator___64dsub_pos].l = p0; /* @sub_pos on <self:RopeCharIterator> */
4158 RET_LABEL:;
4159 }
4160 /* method ropes#RopeCharIterator#sub_pos= for (self: Object, Int) */
4161 void VIRTUAL_ropes__RopeCharIterator__sub_pos_61d(val* self, long p0) {
4162 ropes__RopeCharIterator__sub_pos_61d(self, p0);
4163 RET_LABEL:;
4164 }
4165 /* method ropes#RopeCharIterator#curr_substring for (self: RopeCharIterator): nullable String */
4166 val* ropes__RopeCharIterator__curr_substring(val* self) {
4167 val* var /* : nullable String */;
4168 val* var1 /* : nullable String */;
4169 var1 = self->attrs[COLOR_ropes__RopeCharIterator___64dcurr_substring].val; /* @curr_substring on <self:RopeCharIterator> */
4170 var = var1;
4171 RET_LABEL:;
4172 return var;
4173 }
4174 /* method ropes#RopeCharIterator#curr_substring for (self: Object): nullable String */
4175 val* VIRTUAL_ropes__RopeCharIterator__curr_substring(val* self) {
4176 val* var /* : nullable String */;
4177 val* var1 /* : nullable String */;
4178 var1 = ropes__RopeCharIterator__curr_substring(self);
4179 var = var1;
4180 RET_LABEL:;
4181 return var;
4182 }
4183 /* method ropes#RopeCharIterator#curr_substring= for (self: RopeCharIterator, nullable String) */
4184 void ropes__RopeCharIterator__curr_substring_61d(val* self, val* p0) {
4185 self->attrs[COLOR_ropes__RopeCharIterator___64dcurr_substring].val = p0; /* @curr_substring on <self:RopeCharIterator> */
4186 RET_LABEL:;
4187 }
4188 /* method ropes#RopeCharIterator#curr_substring= for (self: Object, nullable String) */
4189 void VIRTUAL_ropes__RopeCharIterator__curr_substring_61d(val* self, val* p0) {
4190 ropes__RopeCharIterator__curr_substring_61d(self, p0);
4191 RET_LABEL:;
4192 }
4193 /* method ropes#RopeCharIterator#init for (self: RopeCharIterator, Rope) */
4194 void ropes__RopeCharIterator__init(val* self, val* p0) {
4195 val* var_tgt /* var tgt: Rope */;
4196 val* var /* : DFSRopeLeafIterator */;
4197 val* var1 /* : DFSRopeLeafIterator */;
4198 short int var2 /* : Bool */;
4199 val* var3 /* : DFSRopeLeafIterator */;
4200 val* var4 /* : nullable Object */;
4201 val* var5 /* : String */;
4202 var_tgt = p0;
4203 var = NEW_ropes__DFSRopeLeafIterator(&type_ropes__DFSRopeLeafIterator);
4204 ((void (*)(val*, val*))(var->class->vft[COLOR_ropes__DFSRopeLeafIterator__init]))(var, var_tgt) /* init on <var:DFSRopeLeafIterator>*/;
4205 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_str_iter_61d]))(self, var) /* sub_str_iter= on <self:RopeCharIterator>*/;
4206 var1 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_str_iter]))(self) /* sub_str_iter on <self:RopeCharIterator>*/;
4207 var2 = ((short int (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var1) /* is_ok on <var1:DFSRopeLeafIterator>*/;
4208 if (var2){
4209 var3 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_str_iter]))(self) /* sub_str_iter on <self:RopeCharIterator>*/;
4210 var4 = ((val* (*)(val*))(var3->class->vft[COLOR_abstract_collection__Iterator__item]))(var3) /* item on <var3:DFSRopeLeafIterator>*/;
4211 var5 = ((val* (*)(val*))(var4->class->vft[COLOR_ropes__LeafNode__value]))(var4) /* value on <var4:nullable Object(LeafNode)>*/;
4212 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__RopeCharIterator__curr_substring_61d]))(self, var5) /* curr_substring= on <self:RopeCharIterator>*/;
4213 } else {
4214 }
4215 RET_LABEL:;
4216 }
4217 /* method ropes#RopeCharIterator#init for (self: Object, Rope) */
4218 void VIRTUAL_ropes__RopeCharIterator__init(val* self, val* p0) {
4219 ropes__RopeCharIterator__init(self, p0);
4220 RET_LABEL:;
4221 }
4222 /* method ropes#RopeCharIterator#item for (self: RopeCharIterator): Char */
4223 char ropes__RopeCharIterator__item(val* self) {
4224 char var /* : Char */;
4225 val* var1 /* : nullable String */;
4226 long var2 /* : Int */;
4227 val* var3 /* : nullable Object */;
4228 char var4 /* : Char */;
4229 var1 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__curr_substring]))(self) /* curr_substring on <self:RopeCharIterator>*/;
4230 var2 = ((long (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_pos]))(self) /* sub_pos on <self:RopeCharIterator>*/;
4231 if (var1 == NULL) {
4232 fprintf(stderr, "Runtime error: %s", "Reciever is null");
4233 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 828);
4234 show_backtrace(1);
4235 } else {
4236 var3 = ((val* (*)(val*, long))(var1->class->vft[COLOR_abstract_collection__SequenceRead___91d_93d]))(var1, var2) /* [] on <var1:nullable String>*/;
4237 }
4238 var4 = ((struct instance_kernel__Char*)var3)->value; /* autounbox from nullable Object to Char */;
4239 var = var4;
4240 goto RET_LABEL;
4241 RET_LABEL:;
4242 return var;
4243 }
4244 /* method ropes#RopeCharIterator#item for (self: Object): nullable Object */
4245 val* VIRTUAL_ropes__RopeCharIterator__item(val* self) {
4246 val* var /* : nullable Object */;
4247 char var1 /* : Char */;
4248 val* var2 /* : nullable Object */;
4249 var1 = ropes__RopeCharIterator__item(self);
4250 var2 = BOX_kernel__Char(var1); /* autobox from Char to nullable Object */
4251 var = var2;
4252 RET_LABEL:;
4253 return var;
4254 }
4255 /* method ropes#RopeCharIterator#is_ok for (self: RopeCharIterator): Bool */
4256 short int ropes__RopeCharIterator__is_ok(val* self) {
4257 short int var /* : Bool */;
4258 val* var1 /* : DFSRopeLeafIterator */;
4259 short int var2 /* : Bool */;
4260 short int var3 /* : Bool */;
4261 short int var4 /* : Bool */;
4262 short int var5 /* : Bool */;
4263 val* var6 /* : DFSRopeLeafIterator */;
4264 short int var7 /* : Bool */;
4265 short int var8 /* : Bool */;
4266 short int var_ /* var : Bool */;
4267 val* var9 /* : nullable String */;
4268 val* var10 /* : null */;
4269 short int var11 /* : Bool */;
4270 short int var_12 /* var : Bool */;
4271 long var13 /* : Int */;
4272 val* var14 /* : nullable String */;
4273 long var15 /* : Int */;
4274 short int var16 /* : Bool */;
4275 short int var18 /* : Bool */;
4276 int cltype;
4277 int idtype;
4278 const char* var_class_name;
4279 short int var19 /* : Bool */;
4280 short int var20 /* : Bool */;
4281 short int var21 /* : Bool */;
4282 var1 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_str_iter]))(self) /* sub_str_iter on <self:RopeCharIterator>*/;
4283 var2 = ((short int (*)(val*))(var1->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var1) /* is_ok on <var1:DFSRopeLeafIterator>*/;
4284 if (var2){
4285 var3 = 1;
4286 var = var3;
4287 goto RET_LABEL;
4288 } else {
4289 }
4290 var6 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_str_iter]))(self) /* sub_str_iter on <self:RopeCharIterator>*/;
4291 var7 = ((short int (*)(val*))(var6->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var6) /* is_ok on <var6:DFSRopeLeafIterator>*/;
4292 var8 = !var7;
4293 var_ = var8;
4294 if (var8){
4295 var9 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__curr_substring]))(self) /* curr_substring on <self:RopeCharIterator>*/;
4296 var10 = NULL;
4297 if (var9 == NULL) {
4298 var11 = 0; /* is null */
4299 } else {
4300 var11 = 1; /* arg is null and recv is not */
4301 }
4302 var5 = var11;
4303 } else {
4304 var5 = var_;
4305 }
4306 var_12 = var5;
4307 if (var5){
4308 var13 = ((long (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_pos]))(self) /* sub_pos on <self:RopeCharIterator>*/;
4309 var14 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__curr_substring]))(self) /* curr_substring on <self:RopeCharIterator>*/;
4310 if (var14 == NULL) {
4311 fprintf(stderr, "Runtime error: %s", "Reciever is null");
4312 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 833);
4313 show_backtrace(1);
4314 } else {
4315 var15 = ((long (*)(val*))(var14->class->vft[COLOR_abstract_collection__Collection__length]))(var14) /* length on <var14:nullable String>*/;
4316 }
4317 { /* Inline kernel#Int#< (var13,var15) */
4318 /* Covariant cast for argument 0 (i) <var15:Int> isa OTHER */
4319 /* <var15:Int> isa OTHER */
4320 var18 = 1; /* easy <var15:Int> isa OTHER*/
4321 if (!var18) {
4322 var_class_name = type_kernel__Int.name;
4323 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name);
4324 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 261);
4325 show_backtrace(1);
4326 }
4327 var19 = var13 < var15;
4328 var16 = var19;
4329 goto RET_LABEL17;
4330 RET_LABEL17:(void)0;
4331 }
4332 var4 = var16;
4333 } else {
4334 var4 = var_12;
4335 }
4336 if (var4){
4337 var20 = 1;
4338 var = var20;
4339 goto RET_LABEL;
4340 } else {
4341 }
4342 var21 = 0;
4343 var = var21;
4344 goto RET_LABEL;
4345 RET_LABEL:;
4346 return var;
4347 }
4348 /* method ropes#RopeCharIterator#is_ok for (self: Object): Bool */
4349 short int VIRTUAL_ropes__RopeCharIterator__is_ok(val* self) {
4350 short int var /* : Bool */;
4351 short int var1 /* : Bool */;
4352 var1 = ropes__RopeCharIterator__is_ok(self);
4353 var = var1;
4354 RET_LABEL:;
4355 return var;
4356 }
4357 /* method ropes#RopeCharIterator#next for (self: RopeCharIterator) */
4358 void ropes__RopeCharIterator__next(val* self) {
4359 short int var /* : Bool */;
4360 long var1 /* : Int */;
4361 val* var2 /* : nullable String */;
4362 long var3 /* : Int */;
4363 long var4 /* : Int */;
4364 long var5 /* : Int */;
4365 long var7 /* : Int */;
4366 short int var8 /* : Bool */;
4367 short int var10 /* : Bool */;
4368 int cltype;
4369 int idtype;
4370 const char* var_class_name;
4371 short int var11 /* : Bool */;
4372 val* var_ /* var : RopeCharIterator */;
4373 long var12 /* : Int */;
4374 long var13 /* : Int */;
4375 long var14 /* : Int */;
4376 long var16 /* : Int */;
4377 val* var17 /* : DFSRopeLeafIterator */;
4378 val* var18 /* : DFSRopeLeafIterator */;
4379 short int var19 /* : Bool */;
4380 val* var20 /* : DFSRopeLeafIterator */;
4381 val* var21 /* : nullable Object */;
4382 val* var22 /* : String */;
4383 long var23 /* : Int */;
4384 val* var24 /* : nullable String */;
4385 long var25 /* : Int */;
4386 val* var_26 /* var : RopeCharIterator */;
4387 long var27 /* : Int */;
4388 long var28 /* : Int */;
4389 long var29 /* : Int */;
4390 long var31 /* : Int */;
4391 var = ((short int (*)(val*))(self->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(self) /* is_ok on <self:RopeCharIterator>*/;
4392 if (!var) {
4393 fprintf(stderr, "Runtime error: %s", "Assert failed");
4394 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 839);
4395 show_backtrace(1);
4396 }
4397 var1 = ((long (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_pos]))(self) /* sub_pos on <self:RopeCharIterator>*/;
4398 var2 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__curr_substring]))(self) /* curr_substring on <self:RopeCharIterator>*/;
4399 if (var2 == NULL) {
4400 fprintf(stderr, "Runtime error: %s", "Reciever is null");
4401 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 840);
4402 show_backtrace(1);
4403 } else {
4404 var3 = ((long (*)(val*))(var2->class->vft[COLOR_abstract_collection__Collection__length]))(var2) /* length on <var2:nullable String>*/;
4405 }
4406 var4 = 1;
4407 { /* Inline kernel#Int#- (var3,var4) */
4408 var7 = var3 - var4;
4409 var5 = var7;
4410 goto RET_LABEL6;
4411 RET_LABEL6:(void)0;
4412 }
4413 { /* Inline kernel#Int#< (var1,var5) */
4414 /* Covariant cast for argument 0 (i) <var5:Int> isa OTHER */
4415 /* <var5:Int> isa OTHER */
4416 var10 = 1; /* easy <var5:Int> isa OTHER*/
4417 if (!var10) {
4418 var_class_name = type_kernel__Int.name;
4419 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name);
4420 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 261);
4421 show_backtrace(1);
4422 }
4423 var11 = var1 < var5;
4424 var8 = var11;
4425 goto RET_LABEL9;
4426 RET_LABEL9:(void)0;
4427 }
4428 if (var8){
4429 var_ = self;
4430 var12 = ((long (*)(val*))(var_->class->vft[COLOR_ropes__RopeCharIterator__sub_pos]))(var_) /* sub_pos on <var_:RopeCharIterator>*/;
4431 var13 = 1;
4432 { /* Inline kernel#Int#+ (var12,var13) */
4433 var16 = var12 + var13;
4434 var14 = var16;
4435 goto RET_LABEL15;
4436 RET_LABEL15:(void)0;
4437 }
4438 ((void (*)(val*, long))(var_->class->vft[COLOR_ropes__RopeCharIterator__sub_pos_61d]))(var_, var14) /* sub_pos= on <var_:RopeCharIterator>*/;
4439 } else {
4440 var17 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_str_iter]))(self) /* sub_str_iter on <self:RopeCharIterator>*/;
4441 ((void (*)(val*))(var17->class->vft[COLOR_abstract_collection__Iterator__next]))(var17) /* next on <var17:DFSRopeLeafIterator>*/;
4442 var18 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_str_iter]))(self) /* sub_str_iter on <self:RopeCharIterator>*/;
4443 var19 = ((short int (*)(val*))(var18->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(var18) /* is_ok on <var18:DFSRopeLeafIterator>*/;
4444 if (var19){
4445 var20 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_str_iter]))(self) /* sub_str_iter on <self:RopeCharIterator>*/;
4446 var21 = ((val* (*)(val*))(var20->class->vft[COLOR_abstract_collection__Iterator__item]))(var20) /* item on <var20:DFSRopeLeafIterator>*/;
4447 var22 = ((val* (*)(val*))(var21->class->vft[COLOR_ropes__LeafNode__value]))(var21) /* value on <var21:nullable Object(LeafNode)>*/;
4448 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__RopeCharIterator__curr_substring_61d]))(self, var22) /* curr_substring= on <self:RopeCharIterator>*/;
4449 var23 = 0;
4450 ((void (*)(val*, long))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_pos_61d]))(self, var23) /* sub_pos= on <self:RopeCharIterator>*/;
4451 } else {
4452 var24 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__curr_substring]))(self) /* curr_substring on <self:RopeCharIterator>*/;
4453 if (var24 == NULL) {
4454 fprintf(stderr, "Runtime error: %s", "Reciever is null");
4455 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 848);
4456 show_backtrace(1);
4457 } else {
4458 var25 = ((long (*)(val*))(var24->class->vft[COLOR_abstract_collection__Collection__length]))(var24) /* length on <var24:nullable String>*/;
4459 }
4460 ((void (*)(val*, long))(self->class->vft[COLOR_ropes__RopeCharIterator__sub_pos_61d]))(self, var25) /* sub_pos= on <self:RopeCharIterator>*/;
4461 }
4462 }
4463 var_26 = self;
4464 var27 = ((long (*)(val*))(var_26->class->vft[COLOR_ropes__RopeCharIterator__abs_pos]))(var_26) /* abs_pos on <var_26:RopeCharIterator>*/;
4465 var28 = 1;
4466 { /* Inline kernel#Int#+ (var27,var28) */
4467 var31 = var27 + var28;
4468 var29 = var31;
4469 goto RET_LABEL30;
4470 RET_LABEL30:(void)0;
4471 }
4472 ((void (*)(val*, long))(var_26->class->vft[COLOR_ropes__RopeCharIterator__abs_pos_61d]))(var_26, var29) /* abs_pos= on <var_26:RopeCharIterator>*/;
4473 RET_LABEL:;
4474 }
4475 /* method ropes#RopeCharIterator#next for (self: Object) */
4476 void VIRTUAL_ropes__RopeCharIterator__next(val* self) {
4477 ropes__RopeCharIterator__next(self);
4478 RET_LABEL:;
4479 }
4480 /* method ropes#RopeCharIterator#index for (self: RopeCharIterator): Int */
4481 long ropes__RopeCharIterator__index(val* self) {
4482 long var /* : Int */;
4483 long var1 /* : Int */;
4484 var1 = ((long (*)(val*))(self->class->vft[COLOR_ropes__RopeCharIterator__abs_pos]))(self) /* abs_pos on <self:RopeCharIterator>*/;
4485 var = var1;
4486 goto RET_LABEL;
4487 RET_LABEL:;
4488 return var;
4489 }
4490 /* method ropes#RopeCharIterator#index for (self: Object): Int */
4491 long VIRTUAL_ropes__RopeCharIterator__index(val* self) {
4492 long var /* : Int */;
4493 long var1 /* : Int */;
4494 var1 = ropes__RopeCharIterator__index(self);
4495 var = var1;
4496 RET_LABEL:;
4497 return var;
4498 }
4499 /* method ropes#DFSRopeLeafIterator#visit_stack for (self: DFSRopeLeafIterator): List[TupleVisitNode] */
4500 val* ropes__DFSRopeLeafIterator__visit_stack(val* self) {
4501 val* var /* : List[TupleVisitNode] */;
4502 val* var1 /* : List[TupleVisitNode] */;
4503 var1 = self->attrs[COLOR_ropes__DFSRopeLeafIterator___64dvisit_stack].val; /* @visit_stack on <self:DFSRopeLeafIterator> */
4504 if (var1 == NULL) {
4505 fprintf(stderr, "Runtime error: %s", "Uninitialized attribute @visit_stack");
4506 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 865);
4507 show_backtrace(1);
4508 }
4509 var = var1;
4510 RET_LABEL:;
4511 return var;
4512 }
4513 /* method ropes#DFSRopeLeafIterator#visit_stack for (self: Object): List[TupleVisitNode] */
4514 val* VIRTUAL_ropes__DFSRopeLeafIterator__visit_stack(val* self) {
4515 val* var /* : List[TupleVisitNode] */;
4516 val* var1 /* : List[TupleVisitNode] */;
4517 var1 = ropes__DFSRopeLeafIterator__visit_stack(self);
4518 var = var1;
4519 RET_LABEL:;
4520 return var;
4521 }
4522 /* method ropes#DFSRopeLeafIterator#visit_stack= for (self: DFSRopeLeafIterator, List[TupleVisitNode]) */
4523 void ropes__DFSRopeLeafIterator__visit_stack_61d(val* self, val* p0) {
4524 self->attrs[COLOR_ropes__DFSRopeLeafIterator___64dvisit_stack].val = p0; /* @visit_stack on <self:DFSRopeLeafIterator> */
4525 RET_LABEL:;
4526 }
4527 /* method ropes#DFSRopeLeafIterator#visit_stack= for (self: Object, List[TupleVisitNode]) */
4528 void VIRTUAL_ropes__DFSRopeLeafIterator__visit_stack_61d(val* self, val* p0) {
4529 ropes__DFSRopeLeafIterator__visit_stack_61d(self, p0);
4530 RET_LABEL:;
4531 }
4532 /* method ropes#DFSRopeLeafIterator#curr_leaf for (self: DFSRopeLeafIterator): nullable LeafNode */
4533 val* ropes__DFSRopeLeafIterator__curr_leaf(val* self) {
4534 val* var /* : nullable LeafNode */;
4535 val* var1 /* : nullable LeafNode */;
4536 var1 = self->attrs[COLOR_ropes__DFSRopeLeafIterator___64dcurr_leaf].val; /* @curr_leaf on <self:DFSRopeLeafIterator> */
4537 var = var1;
4538 RET_LABEL:;
4539 return var;
4540 }
4541 /* method ropes#DFSRopeLeafIterator#curr_leaf for (self: Object): nullable LeafNode */
4542 val* VIRTUAL_ropes__DFSRopeLeafIterator__curr_leaf(val* self) {
4543 val* var /* : nullable LeafNode */;
4544 val* var1 /* : nullable LeafNode */;
4545 var1 = ropes__DFSRopeLeafIterator__curr_leaf(self);
4546 var = var1;
4547 RET_LABEL:;
4548 return var;
4549 }
4550 /* method ropes#DFSRopeLeafIterator#curr_leaf= for (self: DFSRopeLeafIterator, nullable LeafNode) */
4551 void ropes__DFSRopeLeafIterator__curr_leaf_61d(val* self, val* p0) {
4552 self->attrs[COLOR_ropes__DFSRopeLeafIterator___64dcurr_leaf].val = p0; /* @curr_leaf on <self:DFSRopeLeafIterator> */
4553 RET_LABEL:;
4554 }
4555 /* method ropes#DFSRopeLeafIterator#curr_leaf= for (self: Object, nullable LeafNode) */
4556 void VIRTUAL_ropes__DFSRopeLeafIterator__curr_leaf_61d(val* self, val* p0) {
4557 ropes__DFSRopeLeafIterator__curr_leaf_61d(self, p0);
4558 RET_LABEL:;
4559 }
4560 /* method ropes#DFSRopeLeafIterator#init for (self: DFSRopeLeafIterator, Rope) */
4561 void ropes__DFSRopeLeafIterator__init(val* self, val* p0) {
4562 val* var_tgt /* var tgt: Rope */;
4563 val* var /* : Rope */;
4564 val* var1 /* : RopeNode */;
4565 val* var_first_node /* var first_node: RopeNode */;
4566 short int var2 /* : Bool */;
4567 int cltype;
4568 int idtype;
4569 val* var3 /* : List[TupleVisitNode] */;
4570 val* var4 /* : TupleVisitNode */;
4571 short int var5 /* : Bool */;
4572 int cltype6;
4573 int idtype7;
4574 var_tgt = p0;
4575 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__RopeIterator__init]))(self, p0) /* init on <self:DFSRopeLeafIterator>*/;
4576 var = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeIterator__target]))(self) /* target on <self:DFSRopeLeafIterator>*/;
4577 var1 = ((val* (*)(val*))(var->class->vft[COLOR_ropes__Rope__parent_node]))(var) /* parent_node on <var:Rope>*/;
4578 var_first_node = var1;
4579 /* <var_first_node:RopeNode> isa ConcatNode */
4580 cltype = type_ropes__ConcatNode.color;
4581 idtype = type_ropes__ConcatNode.id;
4582 if(cltype >= var_first_node->type->table_size) {
4583 var2 = 0;
4584 } else {
4585 var2 = var_first_node->type->type_table[cltype] == idtype;
4586 }
4587 if (var2){
4588 var3 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__visit_stack]))(self) /* visit_stack on <self:DFSRopeLeafIterator>*/;
4589 var4 = NEW_ropes__TupleVisitNode(&type_ropes__TupleVisitNode);
4590 ((void (*)(val*, val*))(var4->class->vft[COLOR_ropes__TupleVisitNode__init]))(var4, var_first_node) /* init on <var4:TupleVisitNode>*/;
4591 ((void (*)(val*, val*))(var3->class->vft[COLOR_abstract_collection__Sequence__push]))(var3, var4) /* push on <var3:List[TupleVisitNode]>*/;
4592 } else {
4593 /* <var_first_node:RopeNode> isa LeafNode */
4594 cltype6 = type_ropes__LeafNode.color;
4595 idtype7 = type_ropes__LeafNode.id;
4596 if(cltype6 >= var_first_node->type->table_size) {
4597 var5 = 0;
4598 } else {
4599 var5 = var_first_node->type->type_table[cltype6] == idtype7;
4600 }
4601 if (var5){
4602 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__curr_leaf_61d]))(self, var_first_node) /* curr_leaf= on <self:DFSRopeLeafIterator>*/;
4603 goto RET_LABEL;
4604 } else {
4605 }
4606 }
4607 ((void (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__next_body]))(self) /* next_body on <self:DFSRopeLeafIterator>*/;
4608 RET_LABEL:;
4609 }
4610 /* method ropes#DFSRopeLeafIterator#init for (self: Object, Rope) */
4611 void VIRTUAL_ropes__DFSRopeLeafIterator__init(val* self, val* p0) {
4612 ropes__DFSRopeLeafIterator__init(self, p0);
4613 RET_LABEL:;
4614 }
4615 /* method ropes#DFSRopeLeafIterator#with_index for (self: DFSRopeLeafIterator, Rope, Int) */
4616 void ropes__DFSRopeLeafIterator__with_index(val* self, val* p0, long p1) {
4617 val* var_tgt /* var tgt: Rope */;
4618 long var_index /* var index: Int */;
4619 val* var /* : Rope */;
4620 val* var1 /* : TupleLeafNodePos */;
4621 val* var_returned_tuple /* var returned_tuple: TupleLeafNodePos */;
4622 val* var2 /* : LeafNode */;
4623 val* var3 /* : List[TupleVisitNode] */;
4624 long var4 /* : Int */;
4625 long var5 /* : Int */;
4626 long var7 /* : Int */;
4627 var_tgt = p0;
4628 var_index = p1;
4629 ((void (*)(val*, val*, long))(self->class->vft[COLOR_ropes__RopeIterator__with_index]))(self, p0, p1) /* with_index on <self:DFSRopeLeafIterator>*/;
4630 var = ((val* (*)(val*))(self->class->vft[COLOR_ropes__RopeIterator__target]))(self) /* target on <self:DFSRopeLeafIterator>*/;
4631 var1 = ((val* (*)(val*, long))(var->class->vft[COLOR_ropes__Rope__get_node_for_pos]))(var, var_index) /* get_node_for_pos on <var:Rope>*/;
4632 var_returned_tuple = var1;
4633 var2 = ((val* (*)(val*))(var_returned_tuple->class->vft[COLOR_ropes__TupleLeafNodePos__curr_node]))(var_returned_tuple) /* curr_node on <var_returned_tuple:TupleLeafNodePos>*/;
4634 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__curr_leaf_61d]))(self, var2) /* curr_leaf= on <self:DFSRopeLeafIterator>*/;
4635 var3 = ((val* (*)(val*))(var_returned_tuple->class->vft[COLOR_ropes__TupleLeafNodePos__visit_stack]))(var_returned_tuple) /* visit_stack on <var_returned_tuple:TupleLeafNodePos>*/;
4636 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__visit_stack_61d]))(self, var3) /* visit_stack= on <self:DFSRopeLeafIterator>*/;
4637 var4 = ((long (*)(val*))(var_returned_tuple->class->vft[COLOR_ropes__TupleLeafNodePos__corrected_pos]))(var_returned_tuple) /* corrected_pos on <var_returned_tuple:TupleLeafNodePos>*/;
4638 { /* Inline kernel#Int#- (var_index,var4) */
4639 var7 = var_index - var4;
4640 var5 = var7;
4641 goto RET_LABEL6;
4642 RET_LABEL6:(void)0;
4643 }
4644 ((void (*)(val*, long))(self->class->vft[COLOR_ropes__RopeIterator__pos_61d]))(self, var5) /* pos= on <self:DFSRopeLeafIterator>*/;
4645 RET_LABEL:;
4646 }
4647 /* method ropes#DFSRopeLeafIterator#with_index for (self: Object, Rope, Int) */
4648 void VIRTUAL_ropes__DFSRopeLeafIterator__with_index(val* self, val* p0, long p1) {
4649 ropes__DFSRopeLeafIterator__with_index(self, p0, p1);
4650 RET_LABEL:;
4651 }
4652 /* method ropes#DFSRopeLeafIterator#is_ok for (self: DFSRopeLeafIterator): Bool */
4653 short int ropes__DFSRopeLeafIterator__is_ok(val* self) {
4654 short int var /* : Bool */;
4655 val* var1 /* : nullable LeafNode */;
4656 val* var2 /* : null */;
4657 short int var3 /* : Bool */;
4658 var1 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__curr_leaf]))(self) /* curr_leaf on <self:DFSRopeLeafIterator>*/;
4659 var2 = NULL;
4660 if (var1 == NULL) {
4661 var3 = 0; /* is null */
4662 } else {
4663 var3 = 1; /* arg is null and recv is not */
4664 }
4665 var = var3;
4666 goto RET_LABEL;
4667 RET_LABEL:;
4668 return var;
4669 }
4670 /* method ropes#DFSRopeLeafIterator#is_ok for (self: Object): Bool */
4671 short int VIRTUAL_ropes__DFSRopeLeafIterator__is_ok(val* self) {
4672 short int var /* : Bool */;
4673 short int var1 /* : Bool */;
4674 var1 = ropes__DFSRopeLeafIterator__is_ok(self);
4675 var = var1;
4676 RET_LABEL:;
4677 return var;
4678 }
4679 /* method ropes#DFSRopeLeafIterator#next for (self: DFSRopeLeafIterator) */
4680 void ropes__DFSRopeLeafIterator__next(val* self) {
4681 short int var /* : Bool */;
4682 val* var_ /* var : DFSRopeLeafIterator */;
4683 long var1 /* : Int */;
4684 val* var2 /* : nullable LeafNode */;
4685 val* var3 /* : String */;
4686 long var4 /* : Int */;
4687 long var5 /* : Int */;
4688 long var7 /* : Int */;
4689 var = ((short int (*)(val*))(self->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(self) /* is_ok on <self:DFSRopeLeafIterator>*/;
4690 if (!var) {
4691 fprintf(stderr, "Runtime error: %s", "Assert failed");
4692 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 902);
4693 show_backtrace(1);
4694 }
4695 var_ = self;
4696 var1 = ((long (*)(val*))(var_->class->vft[COLOR_ropes__RopeIterator__pos]))(var_) /* pos on <var_:DFSRopeLeafIterator>*/;
4697 var2 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__curr_leaf]))(self) /* curr_leaf on <self:DFSRopeLeafIterator>*/;
4698 if (var2 == NULL) {
4699 fprintf(stderr, "Runtime error: %s", "Reciever is null");
4700 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 903);
4701 show_backtrace(1);
4702 } else {
4703 var3 = ((val* (*)(val*))(var2->class->vft[COLOR_ropes__LeafNode__value]))(var2) /* value on <var2:nullable LeafNode>*/;
4704 }
4705 var4 = ((long (*)(val*))(var3->class->vft[COLOR_abstract_collection__Collection__length]))(var3) /* length on <var3:String>*/;
4706 { /* Inline kernel#Int#+ (var1,var4) */
4707 var7 = var1 + var4;
4708 var5 = var7;
4709 goto RET_LABEL6;
4710 RET_LABEL6:(void)0;
4711 }
4712 ((void (*)(val*, long))(var_->class->vft[COLOR_ropes__RopeIterator__pos_61d]))(var_, var5) /* pos= on <var_:DFSRopeLeafIterator>*/;
4713 ((void (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__next_body]))(self) /* next_body on <self:DFSRopeLeafIterator>*/;
4714 RET_LABEL:;
4715 }
4716 /* method ropes#DFSRopeLeafIterator#next for (self: Object) */
4717 void VIRTUAL_ropes__DFSRopeLeafIterator__next(val* self) {
4718 ropes__DFSRopeLeafIterator__next(self);
4719 RET_LABEL:;
4720 }
4721 /* method ropes#DFSRopeLeafIterator#next_body for (self: DFSRopeLeafIterator) */
4722 void ropes__DFSRopeLeafIterator__next_body(val* self) {
4723 val* var /* : List[TupleVisitNode] */;
4724 short int var1 /* : Bool */;
4725 short int var2 /* : Bool */;
4726 val* var3 /* : List[TupleVisitNode] */;
4727 val* var4 /* : nullable Object */;
4728 val* var_curr_concat_tuple /* var curr_concat_tuple: TupleVisitNode */;
4729 short int var5 /* : Bool */;
4730 short int var6 /* : Bool */;
4731 short int var7 /* : Bool */;
4732 val* var8 /* : ConcatNode */;
4733 val* var9 /* : nullable RopeNode */;
4734 val* var_next_node /* var next_node: nullable RopeNode */;
4735 val* var10 /* : null */;
4736 short int var11 /* : Bool */;
4737 short int var12 /* : Bool */;
4738 int cltype;
4739 int idtype;
4740 val* var13 /* : List[TupleVisitNode] */;
4741 val* var14 /* : TupleVisitNode */;
4742 short int var15 /* : Bool */;
4743 int cltype16;
4744 int idtype17;
4745 short int var18 /* : Bool */;
4746 short int var19 /* : Bool */;
4747 short int var20 /* : Bool */;
4748 val* var21 /* : ConcatNode */;
4749 val* var22 /* : nullable RopeNode */;
4750 val* var23 /* : null */;
4751 short int var24 /* : Bool */;
4752 short int var25 /* : Bool */;
4753 int cltype26;
4754 int idtype27;
4755 val* var28 /* : List[TupleVisitNode] */;
4756 val* var29 /* : TupleVisitNode */;
4757 short int var30 /* : Bool */;
4758 int cltype31;
4759 int idtype32;
4760 val* var33 /* : List[TupleVisitNode] */;
4761 val* var34 /* : nullable Object */;
4762 val* var35 /* : null */;
4763 for(;;) {
4764 var = ((val* (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__visit_stack]))(self) /* visit_stack on <self:DFSRopeLeafIterator>*/;
4765 var1 = ((short int (*)(val*))(var->class->vft[COLOR_abstract_collection__Collection__is_empty]))(var) /* is_empty on <var:List[TupleVisitNode]>*/;
4766 var2 = !var1;
4767 if (!var2) break;
4768 var3 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__visit_stack]))(self) /* visit_stack on <self:DFSRopeLeafIterator>*/;
4769 var4 = ((val* (*)(val*))(var3->class->vft[COLOR_abstract_collection__SequenceRead__last]))(var3) /* last on <var3:List[TupleVisitNode]>*/;
4770 var_curr_concat_tuple = var4;
4771 var5 = ((short int (*)(val*))(var_curr_concat_tuple->class->vft[COLOR_ropes__TupleVisitNode__left_visited]))(var_curr_concat_tuple) /* left_visited on <var_curr_concat_tuple:TupleVisitNode>*/;
4772 var6 = !var5;
4773 if (var6){
4774 var7 = 1;
4775 ((void (*)(val*, short int))(var_curr_concat_tuple->class->vft[COLOR_ropes__TupleVisitNode__left_visited_61d]))(var_curr_concat_tuple, var7) /* left_visited= on <var_curr_concat_tuple:TupleVisitNode>*/;
4776 var8 = ((val* (*)(val*))(var_curr_concat_tuple->class->vft[COLOR_ropes__TupleVisitNode__node]))(var_curr_concat_tuple) /* node on <var_curr_concat_tuple:TupleVisitNode>*/;
4777 var9 = ((val* (*)(val*))(var8->class->vft[COLOR_ropes__ConcatNode__left_child]))(var8) /* left_child on <var8:ConcatNode>*/;
4778 var_next_node = var9;
4779 var10 = NULL;
4780 if (var_next_node == NULL) {
4781 var11 = 1; /* is null */
4782 } else {
4783 var11 = 0; /* arg is null but recv is not */
4784 }
4785 if (var11){
4786 goto CONTINUE_label;
4787 } else {
4788 }
4789 /* <var_next_node:nullable RopeNode(RopeNode)> isa ConcatNode */
4790 cltype = type_ropes__ConcatNode.color;
4791 idtype = type_ropes__ConcatNode.id;
4792 if(cltype >= var_next_node->type->table_size) {
4793 var12 = 0;
4794 } else {
4795 var12 = var_next_node->type->type_table[cltype] == idtype;
4796 }
4797 if (var12){
4798 var13 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__visit_stack]))(self) /* visit_stack on <self:DFSRopeLeafIterator>*/;
4799 var14 = NEW_ropes__TupleVisitNode(&type_ropes__TupleVisitNode);
4800 ((void (*)(val*, val*))(var14->class->vft[COLOR_ropes__TupleVisitNode__init]))(var14, var_next_node) /* init on <var14:TupleVisitNode>*/;
4801 ((void (*)(val*, val*))(var13->class->vft[COLOR_abstract_collection__Sequence__push]))(var13, var14) /* push on <var13:List[TupleVisitNode]>*/;
4802 } else {
4803 /* <var_next_node:nullable RopeNode(RopeNode)> isa LeafNode */
4804 cltype16 = type_ropes__LeafNode.color;
4805 idtype17 = type_ropes__LeafNode.id;
4806 if(cltype16 >= var_next_node->type->table_size) {
4807 var15 = 0;
4808 } else {
4809 var15 = var_next_node->type->type_table[cltype16] == idtype17;
4810 }
4811 if (var15){
4812 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__curr_leaf_61d]))(self, var_next_node) /* curr_leaf= on <self:DFSRopeLeafIterator>*/;
4813 goto RET_LABEL;
4814 } else {
4815 }
4816 }
4817 } else {
4818 var18 = ((short int (*)(val*))(var_curr_concat_tuple->class->vft[COLOR_ropes__TupleVisitNode__right_visited]))(var_curr_concat_tuple) /* right_visited on <var_curr_concat_tuple:TupleVisitNode>*/;
4819 var19 = !var18;
4820 if (var19){
4821 var20 = 1;
4822 ((void (*)(val*, short int))(var_curr_concat_tuple->class->vft[COLOR_ropes__TupleVisitNode__right_visited_61d]))(var_curr_concat_tuple, var20) /* right_visited= on <var_curr_concat_tuple:TupleVisitNode>*/;
4823 var21 = ((val* (*)(val*))(var_curr_concat_tuple->class->vft[COLOR_ropes__TupleVisitNode__node]))(var_curr_concat_tuple) /* node on <var_curr_concat_tuple:TupleVisitNode>*/;
4824 var22 = ((val* (*)(val*))(var21->class->vft[COLOR_ropes__ConcatNode__right_child]))(var21) /* right_child on <var21:ConcatNode>*/;
4825 var_next_node = var22;
4826 var23 = NULL;
4827 if (var_next_node == NULL) {
4828 var24 = 1; /* is null */
4829 } else {
4830 var24 = 0; /* arg is null but recv is not */
4831 }
4832 if (var24){
4833 goto CONTINUE_label;
4834 } else {
4835 }
4836 /* <var_next_node:nullable RopeNode(RopeNode)> isa ConcatNode */
4837 cltype26 = type_ropes__ConcatNode.color;
4838 idtype27 = type_ropes__ConcatNode.id;
4839 if(cltype26 >= var_next_node->type->table_size) {
4840 var25 = 0;
4841 } else {
4842 var25 = var_next_node->type->type_table[cltype26] == idtype27;
4843 }
4844 if (var25){
4845 var28 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__visit_stack]))(self) /* visit_stack on <self:DFSRopeLeafIterator>*/;
4846 var29 = NEW_ropes__TupleVisitNode(&type_ropes__TupleVisitNode);
4847 ((void (*)(val*, val*))(var29->class->vft[COLOR_ropes__TupleVisitNode__init]))(var29, var_next_node) /* init on <var29:TupleVisitNode>*/;
4848 ((void (*)(val*, val*))(var28->class->vft[COLOR_abstract_collection__Sequence__push]))(var28, var29) /* push on <var28:List[TupleVisitNode]>*/;
4849 } else {
4850 /* <var_next_node:nullable RopeNode(RopeNode)> isa LeafNode */
4851 cltype31 = type_ropes__LeafNode.color;
4852 idtype32 = type_ropes__LeafNode.id;
4853 if(cltype31 >= var_next_node->type->table_size) {
4854 var30 = 0;
4855 } else {
4856 var30 = var_next_node->type->type_table[cltype31] == idtype32;
4857 }
4858 if (var30){
4859 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__curr_leaf_61d]))(self, var_next_node) /* curr_leaf= on <self:DFSRopeLeafIterator>*/;
4860 goto RET_LABEL;
4861 } else {
4862 }
4863 }
4864 } else {
4865 var33 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__visit_stack]))(self) /* visit_stack on <self:DFSRopeLeafIterator>*/;
4866 var34 = ((val* (*)(val*))(var33->class->vft[COLOR_abstract_collection__Sequence__pop]))(var33) /* pop on <var33:List[TupleVisitNode]>*/;
4867 var34;
4868 }
4869 }
4870 CONTINUE_label: (void)0;
4871 }
4872 BREAK_label: (void)0;
4873 var35 = NULL;
4874 ((void (*)(val*, val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__curr_leaf_61d]))(self, var35) /* curr_leaf= on <self:DFSRopeLeafIterator>*/;
4875 RET_LABEL:;
4876 }
4877 /* method ropes#DFSRopeLeafIterator#next_body for (self: Object) */
4878 void VIRTUAL_ropes__DFSRopeLeafIterator__next_body(val* self) {
4879 ropes__DFSRopeLeafIterator__next_body(self);
4880 RET_LABEL:;
4881 }
4882 /* method ropes#DFSRopeLeafIterator#item for (self: DFSRopeLeafIterator): LeafNode */
4883 val* ropes__DFSRopeLeafIterator__item(val* self) {
4884 val* var /* : LeafNode */;
4885 short int var1 /* : Bool */;
4886 val* var2 /* : nullable LeafNode */;
4887 var1 = ((short int (*)(val*))(self->class->vft[COLOR_abstract_collection__Iterator__is_ok]))(self) /* is_ok on <self:DFSRopeLeafIterator>*/;
4888 if (!var1) {
4889 fprintf(stderr, "Runtime error: %s", "Assert failed");
4890 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 951);
4891 show_backtrace(1);
4892 }
4893 var2 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__DFSRopeLeafIterator__curr_leaf]))(self) /* curr_leaf on <self:DFSRopeLeafIterator>*/;
4894 if (var2 == NULL) {
4895 fprintf(stderr, "Runtime error: %s", "Cast failed");
4896 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 952);
4897 show_backtrace(1);
4898 }
4899 var = var2;
4900 goto RET_LABEL;
4901 RET_LABEL:;
4902 return var;
4903 }
4904 /* method ropes#DFSRopeLeafIterator#item for (self: Object): nullable Object */
4905 val* VIRTUAL_ropes__DFSRopeLeafIterator__item(val* self) {
4906 val* var /* : nullable Object */;
4907 val* var1 /* : LeafNode */;
4908 var1 = ropes__DFSRopeLeafIterator__item(self);
4909 var = var1;
4910 RET_LABEL:;
4911 return var;
4912 }
4913 /* method ropes#RopeNode#parent for (self: RopeNode): nullable ConcatNode */
4914 val* ropes__RopeNode__parent(val* self) {
4915 val* var /* : nullable ConcatNode */;
4916 val* var1 /* : nullable ConcatNode */;
4917 var1 = self->attrs[COLOR_ropes__RopeNode___64dparent].val; /* @parent on <self:RopeNode> */
4918 var = var1;
4919 RET_LABEL:;
4920 return var;
4921 }
4922 /* method ropes#RopeNode#parent for (self: Object): nullable ConcatNode */
4923 val* VIRTUAL_ropes__RopeNode__parent(val* self) {
4924 val* var /* : nullable ConcatNode */;
4925 val* var1 /* : nullable ConcatNode */;
4926 var1 = ropes__RopeNode__parent(self);
4927 var = var1;
4928 RET_LABEL:;
4929 return var;
4930 }
4931 /* method ropes#RopeNode#parent= for (self: RopeNode, nullable ConcatNode) */
4932 void ropes__RopeNode__parent_61d(val* self, val* p0) {
4933 self->attrs[COLOR_ropes__RopeNode___64dparent].val = p0; /* @parent on <self:RopeNode> */
4934 RET_LABEL:;
4935 }
4936 /* method ropes#RopeNode#parent= for (self: Object, nullable ConcatNode) */
4937 void VIRTUAL_ropes__RopeNode__parent_61d(val* self, val* p0) {
4938 ropes__RopeNode__parent_61d(self, p0);
4939 RET_LABEL:;
4940 }
4941 /* method ropes#RopeNode#height for (self: RopeNode): Int */
4942 long ropes__RopeNode__height(val* self) {
4943 long var /* : Int */;
4944 long var1 /* : Int */;
4945 var1 = self->attrs[COLOR_ropes__RopeNode___64dheight].l; /* @height on <self:RopeNode> */
4946 var = var1;
4947 RET_LABEL:;
4948 return var;
4949 }
4950 /* method ropes#RopeNode#height for (self: Object): Int */
4951 long VIRTUAL_ropes__RopeNode__height(val* self) {
4952 long var /* : Int */;
4953 long var1 /* : Int */;
4954 var1 = ropes__RopeNode__height(self);
4955 var = var1;
4956 RET_LABEL:;
4957 return var;
4958 }
4959 /* method ropes#RopeNode#height= for (self: RopeNode, Int) */
4960 void ropes__RopeNode__height_61d(val* self, long p0) {
4961 self->attrs[COLOR_ropes__RopeNode___64dheight].l = p0; /* @height on <self:RopeNode> */
4962 RET_LABEL:;
4963 }
4964 /* method ropes#RopeNode#height= for (self: Object, Int) */
4965 void VIRTUAL_ropes__RopeNode__height_61d(val* self, long p0) {
4966 ropes__RopeNode__height_61d(self, p0);
4967 RET_LABEL:;
4968 }
4969 /* method ropes#RopeNode#balance_factor for (self: RopeNode): Int */
4970 long ropes__RopeNode__balance_factor(val* self) {
4971 long var /* : Int */;
4972 long var1 /* : Int */;
4973 var1 = ((long (*)(val*))(self->class->vft[COLOR_ropes__RopeNode__height]))(self) /* height on <self:RopeNode>*/;
4974 var = var1;
4975 goto RET_LABEL;
4976 RET_LABEL:;
4977 return var;
4978 }
4979 /* method ropes#RopeNode#balance_factor for (self: Object): Int */
4980 long VIRTUAL_ropes__RopeNode__balance_factor(val* self) {
4981 long var /* : Int */;
4982 long var1 /* : Int */;
4983 var1 = ropes__RopeNode__balance_factor(self);
4984 var = var1;
4985 RET_LABEL:;
4986 return var;
4987 }
4988 /* method ropes#RopeNode#length for (self: RopeNode): Int */
4989 long ropes__RopeNode__length(val* self) {
4990 long var /* : Int */;
4991 long var1 /* : Int */;
4992 var1 = self->attrs[COLOR_ropes__RopeNode___length].l; /* _length on <self:RopeNode> */
4993 var = var1;
4994 goto RET_LABEL;
4995 RET_LABEL:;
4996 return var;
4997 }
4998 /* method ropes#RopeNode#length for (self: Object): Int */
4999 long VIRTUAL_ropes__RopeNode__length(val* self) {
5000 long var /* : Int */;
5001 long var1 /* : Int */;
5002 var1 = ropes__RopeNode__length(self);
5003 var = var1;
5004 RET_LABEL:;
5005 return var;
5006 }
5007 /* method ropes#RopeNode#length= for (self: RopeNode, Int) */
5008 void ropes__RopeNode__length_61d(val* self, long p0) {
5009 long var_len /* var len: Int */;
5010 var_len = p0;
5011 self->attrs[COLOR_ropes__RopeNode___length].l = var_len; /* _length on <self:RopeNode> */
5012 RET_LABEL:;
5013 }
5014 /* method ropes#RopeNode#length= for (self: Object, Int) */
5015 void VIRTUAL_ropes__RopeNode__length_61d(val* self, long p0) {
5016 ropes__RopeNode__length_61d(self, p0);
5017 RET_LABEL:;
5018 }
5019 /* method ropes#RopeNode#init for (self: RopeNode) */
5020 void ropes__RopeNode__init(val* self) {
5021 RET_LABEL:;
5022 }
5023 /* method ropes#RopeNode#init for (self: Object) */
5024 void VIRTUAL_ropes__RopeNode__init(val* self) {
5025 ropes__RopeNode__init(self);
5026 RET_LABEL:;
5027 }
5028 /* method ropes#ConcatNode#left_child for (self: ConcatNode): nullable RopeNode */
5029 val* ropes__ConcatNode__left_child(val* self) {
5030 val* var /* : nullable RopeNode */;
5031 val* var1 /* : nullable RopeNode */;
5032 val* var2 /* : null */;
5033 short int var3 /* : Bool */;
5034 val* var4 /* : nullable RopeNode */;
5035 val* var5 /* : null */;
5036 var1 = self->attrs[COLOR_ropes__ConcatNode___left_child].val; /* _left_child on <self:ConcatNode> */
5037 var2 = NULL;
5038 if (var1 == NULL) {
5039 var3 = 0; /* is null */
5040 } else {
5041 var3 = 1; /* arg is null and recv is not */
5042 }
5043 if (var3){
5044 var4 = self->attrs[COLOR_ropes__ConcatNode___left_child].val; /* _left_child on <self:ConcatNode> */
5045 var = var4;
5046 goto RET_LABEL;
5047 } else {
5048 var5 = NULL;
5049 var = var5;
5050 goto RET_LABEL;
5051 }
5052 RET_LABEL:;
5053 return var;
5054 }
5055 /* method ropes#ConcatNode#left_child for (self: Object): nullable RopeNode */
5056 val* VIRTUAL_ropes__ConcatNode__left_child(val* self) {
5057 val* var /* : nullable RopeNode */;
5058 val* var1 /* : nullable RopeNode */;
5059 var1 = ropes__ConcatNode__left_child(self);
5060 var = var1;
5061 RET_LABEL:;
5062 return var;
5063 }
5064 /* method ropes#ConcatNode#right_child for (self: ConcatNode): nullable RopeNode */
5065 val* ropes__ConcatNode__right_child(val* self) {
5066 val* var /* : nullable RopeNode */;
5067 val* var1 /* : nullable RopeNode */;
5068 val* var2 /* : null */;
5069 short int var3 /* : Bool */;
5070 val* var4 /* : nullable RopeNode */;
5071 val* var5 /* : null */;
5072 var1 = self->attrs[COLOR_ropes__ConcatNode___right_child].val; /* _right_child on <self:ConcatNode> */
5073 var2 = NULL;
5074 if (var1 == NULL) {
5075 var3 = 0; /* is null */
5076 } else {
5077 var3 = 1; /* arg is null and recv is not */
5078 }
5079 if (var3){
5080 var4 = self->attrs[COLOR_ropes__ConcatNode___right_child].val; /* _right_child on <self:ConcatNode> */
5081 var = var4;
5082 goto RET_LABEL;
5083 } else {
5084 var5 = NULL;
5085 var = var5;
5086 goto RET_LABEL;
5087 }
5088 RET_LABEL:;
5089 return var;
5090 }
5091 /* method ropes#ConcatNode#right_child for (self: Object): nullable RopeNode */
5092 val* VIRTUAL_ropes__ConcatNode__right_child(val* self) {
5093 val* var /* : nullable RopeNode */;
5094 val* var1 /* : nullable RopeNode */;
5095 var1 = ropes__ConcatNode__right_child(self);
5096 var = var1;
5097 RET_LABEL:;
5098 return var;
5099 }
5100 /* method ropes#ConcatNode#left_child= for (self: ConcatNode, nullable RopeNode) */
5101 void ropes__ConcatNode__left_child_61d(val* self, val* p0) {
5102 val* var_new_node /* var new_node: nullable RopeNode */;
5103 var_new_node = p0;
5104 self->attrs[COLOR_ropes__ConcatNode___left_child].val = var_new_node; /* _left_child on <self:ConcatNode> */
5105 if (var_new_node == NULL) {
5106 fprintf(stderr, "Runtime error: %s", "Reciever is null");
5107 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1010);
5108 show_backtrace(1);
5109 } else {
5110 ((void (*)(val*, val*))(var_new_node->class->vft[COLOR_ropes__RopeNode__parent_61d]))(var_new_node, self) /* parent= on <var_new_node:nullable RopeNode>*/;
5111 }
5112 ((void (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__update_data]))(self) /* update_data on <self:ConcatNode>*/;
5113 RET_LABEL:;
5114 }
5115 /* method ropes#ConcatNode#left_child= for (self: Object, nullable RopeNode) */
5116 void VIRTUAL_ropes__ConcatNode__left_child_61d(val* self, val* p0) {
5117 ropes__ConcatNode__left_child_61d(self, p0);
5118 RET_LABEL:;
5119 }
5120 /* method ropes#ConcatNode#right_child= for (self: ConcatNode, nullable RopeNode) */
5121 void ropes__ConcatNode__right_child_61d(val* self, val* p0) {
5122 val* var_new_node /* var new_node: nullable RopeNode */;
5123 var_new_node = p0;
5124 self->attrs[COLOR_ropes__ConcatNode___right_child].val = var_new_node; /* _right_child on <self:ConcatNode> */
5125 if (var_new_node == NULL) {
5126 fprintf(stderr, "Runtime error: %s", "Reciever is null");
5127 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1017);
5128 show_backtrace(1);
5129 } else {
5130 ((void (*)(val*, val*))(var_new_node->class->vft[COLOR_ropes__RopeNode__parent_61d]))(var_new_node, self) /* parent= on <var_new_node:nullable RopeNode>*/;
5131 }
5132 ((void (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__update_data]))(self) /* update_data on <self:ConcatNode>*/;
5133 RET_LABEL:;
5134 }
5135 /* method ropes#ConcatNode#right_child= for (self: Object, nullable RopeNode) */
5136 void VIRTUAL_ropes__ConcatNode__right_child_61d(val* self, val* p0) {
5137 ropes__ConcatNode__right_child_61d(self, p0);
5138 RET_LABEL:;
5139 }
5140 /* method ropes#ConcatNode#update_data for (self: ConcatNode) */
5141 void ropes__ConcatNode__update_data(val* self) {
5142 long var /* : Int */;
5143 long var1 /* : Int */;
5144 val* var2 /* : nullable RopeNode */;
5145 val* var3 /* : null */;
5146 short int var4 /* : Bool */;
5147 val* var_ /* var : ConcatNode */;
5148 long var5 /* : Int */;
5149 val* var6 /* : nullable RopeNode */;
5150 long var7 /* : Int */;
5151 long var8 /* : Int */;
5152 long var10 /* : Int */;
5153 val* var11 /* : nullable RopeNode */;
5154 long var12 /* : Int */;
5155 long var13 /* : Int */;
5156 long var14 /* : Int */;
5157 long var16 /* : Int */;
5158 long var17 /* : Int */;
5159 short int var18 /* : Bool */;
5160 short int var20 /* : Bool */;
5161 int cltype;
5162 int idtype;
5163 const char* var_class_name;
5164 short int var21 /* : Bool */;
5165 val* var22 /* : nullable RopeNode */;
5166 long var23 /* : Int */;
5167 long var24 /* : Int */;
5168 long var25 /* : Int */;
5169 long var27 /* : Int */;
5170 val* var28 /* : nullable RopeNode */;
5171 val* var29 /* : null */;
5172 short int var30 /* : Bool */;
5173 val* var_31 /* var : ConcatNode */;
5174 long var32 /* : Int */;
5175 val* var33 /* : nullable RopeNode */;
5176 long var34 /* : Int */;
5177 long var35 /* : Int */;
5178 long var37 /* : Int */;
5179 val* var38 /* : nullable RopeNode */;
5180 long var39 /* : Int */;
5181 long var40 /* : Int */;
5182 long var41 /* : Int */;
5183 long var43 /* : Int */;
5184 long var44 /* : Int */;
5185 short int var45 /* : Bool */;
5186 short int var47 /* : Bool */;
5187 int cltype48;
5188 int idtype49;
5189 const char* var_class_name50;
5190 short int var51 /* : Bool */;
5191 val* var52 /* : nullable RopeNode */;
5192 long var53 /* : Int */;
5193 long var54 /* : Int */;
5194 long var55 /* : Int */;
5195 long var57 /* : Int */;
5196 var = 0;
5197 ((void (*)(val*, long))(self->class->vft[COLOR_ropes__RopeNode__length_61d]))(self, var) /* length= on <self:ConcatNode>*/;
5198 var1 = 1;
5199 ((void (*)(val*, long))(self->class->vft[COLOR_ropes__RopeNode__height_61d]))(self, var1) /* height= on <self:ConcatNode>*/;
5200 var2 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__left_child]))(self) /* left_child on <self:ConcatNode>*/;
5201 var3 = NULL;
5202 if (var2 == NULL) {
5203 var4 = 0; /* is null */
5204 } else {
5205 var4 = 1; /* arg is null and recv is not */
5206 }
5207 if (var4){
5208 var_ = self;
5209 var5 = ((long (*)(val*))(var_->class->vft[COLOR_ropes__RopeNode__length]))(var_) /* length on <var_:ConcatNode>*/;
5210 var6 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__left_child]))(self) /* left_child on <self:ConcatNode>*/;
5211 if (var6 == NULL) {
5212 fprintf(stderr, "Runtime error: %s", "Reciever is null");
5213 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1029);
5214 show_backtrace(1);
5215 } else {
5216 var7 = ((long (*)(val*))(var6->class->vft[COLOR_ropes__RopeNode__length]))(var6) /* length on <var6:nullable RopeNode>*/;
5217 }
5218 { /* Inline kernel#Int#+ (var5,var7) */
5219 var10 = var5 + var7;
5220 var8 = var10;
5221 goto RET_LABEL9;
5222 RET_LABEL9:(void)0;
5223 }
5224 ((void (*)(val*, long))(var_->class->vft[COLOR_ropes__RopeNode__length_61d]))(var_, var8) /* length= on <var_:ConcatNode>*/;
5225 var11 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__left_child]))(self) /* left_child on <self:ConcatNode>*/;
5226 if (var11 == NULL) {
5227 fprintf(stderr, "Runtime error: %s", "Reciever is null");
5228 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1030);
5229 show_backtrace(1);
5230 } else {
5231 var12 = ((long (*)(val*))(var11->class->vft[COLOR_ropes__RopeNode__height]))(var11) /* height on <var11:nullable RopeNode>*/;
5232 }
5233 var13 = 1;
5234 { /* Inline kernel#Int#+ (var12,var13) */
5235 var16 = var12 + var13;
5236 var14 = var16;
5237 goto RET_LABEL15;
5238 RET_LABEL15:(void)0;
5239 }
5240 var17 = ((long (*)(val*))(self->class->vft[COLOR_ropes__RopeNode__height]))(self) /* height on <self:ConcatNode>*/;
5241 { /* Inline kernel#Int#> (var14,var17) */
5242 /* Covariant cast for argument 0 (i) <var17:Int> isa OTHER */
5243 /* <var17:Int> isa OTHER */
5244 var20 = 1; /* easy <var17:Int> isa OTHER*/
5245 if (!var20) {
5246 var_class_name = type_kernel__Int.name;
5247 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name);
5248 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 263);
5249 show_backtrace(1);
5250 }
5251 var21 = var14 > var17;
5252 var18 = var21;
5253 goto RET_LABEL19;
5254 RET_LABEL19:(void)0;
5255 }
5256 if (var18){
5257 var22 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__left_child]))(self) /* left_child on <self:ConcatNode>*/;
5258 if (var22 == NULL) {
5259 fprintf(stderr, "Runtime error: %s", "Reciever is null");
5260 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1030);
5261 show_backtrace(1);
5262 } else {
5263 var23 = ((long (*)(val*))(var22->class->vft[COLOR_ropes__RopeNode__height]))(var22) /* height on <var22:nullable RopeNode>*/;
5264 }
5265 var24 = 1;
5266 { /* Inline kernel#Int#+ (var23,var24) */
5267 var27 = var23 + var24;
5268 var25 = var27;
5269 goto RET_LABEL26;
5270 RET_LABEL26:(void)0;
5271 }
5272 ((void (*)(val*, long))(self->class->vft[COLOR_ropes__RopeNode__height_61d]))(self, var25) /* height= on <self:ConcatNode>*/;
5273 } else {
5274 }
5275 } else {
5276 }
5277 var28 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__right_child]))(self) /* right_child on <self:ConcatNode>*/;
5278 var29 = NULL;
5279 if (var28 == NULL) {
5280 var30 = 0; /* is null */
5281 } else {
5282 var30 = 1; /* arg is null and recv is not */
5283 }
5284 if (var30){
5285 var_31 = self;
5286 var32 = ((long (*)(val*))(var_31->class->vft[COLOR_ropes__RopeNode__length]))(var_31) /* length on <var_31:ConcatNode>*/;
5287 var33 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__right_child]))(self) /* right_child on <self:ConcatNode>*/;
5288 if (var33 == NULL) {
5289 fprintf(stderr, "Runtime error: %s", "Reciever is null");
5290 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1033);
5291 show_backtrace(1);
5292 } else {
5293 var34 = ((long (*)(val*))(var33->class->vft[COLOR_ropes__RopeNode__length]))(var33) /* length on <var33:nullable RopeNode>*/;
5294 }
5295 { /* Inline kernel#Int#+ (var32,var34) */
5296 var37 = var32 + var34;
5297 var35 = var37;
5298 goto RET_LABEL36;
5299 RET_LABEL36:(void)0;
5300 }
5301 ((void (*)(val*, long))(var_31->class->vft[COLOR_ropes__RopeNode__length_61d]))(var_31, var35) /* length= on <var_31:ConcatNode>*/;
5302 var38 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__right_child]))(self) /* right_child on <self:ConcatNode>*/;
5303 if (var38 == NULL) {
5304 fprintf(stderr, "Runtime error: %s", "Reciever is null");
5305 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1034);
5306 show_backtrace(1);
5307 } else {
5308 var39 = ((long (*)(val*))(var38->class->vft[COLOR_ropes__RopeNode__height]))(var38) /* height on <var38:nullable RopeNode>*/;
5309 }
5310 var40 = 1;
5311 { /* Inline kernel#Int#+ (var39,var40) */
5312 var43 = var39 + var40;
5313 var41 = var43;
5314 goto RET_LABEL42;
5315 RET_LABEL42:(void)0;
5316 }
5317 var44 = ((long (*)(val*))(self->class->vft[COLOR_ropes__RopeNode__height]))(self) /* height on <self:ConcatNode>*/;
5318 { /* Inline kernel#Int#> (var41,var44) */
5319 /* Covariant cast for argument 0 (i) <var44:Int> isa OTHER */
5320 /* <var44:Int> isa OTHER */
5321 var47 = 1; /* easy <var44:Int> isa OTHER*/
5322 if (!var47) {
5323 var_class_name50 = type_kernel__Int.name;
5324 fprintf(stderr, "Runtime error: Cast failed. Expected `%s`, got `%s`", "OTHER", var_class_name50);
5325 fprintf(stderr, " (%s:%d)\n", "lib/standard/kernel.nit", 263);
5326 show_backtrace(1);
5327 }
5328 var51 = var41 > var44;
5329 var45 = var51;
5330 goto RET_LABEL46;
5331 RET_LABEL46:(void)0;
5332 }
5333 if (var45){
5334 var52 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__right_child]))(self) /* right_child on <self:ConcatNode>*/;
5335 if (var52 == NULL) {
5336 fprintf(stderr, "Runtime error: %s", "Reciever is null");
5337 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1034);
5338 show_backtrace(1);
5339 } else {
5340 var53 = ((long (*)(val*))(var52->class->vft[COLOR_ropes__RopeNode__height]))(var52) /* height on <var52:nullable RopeNode>*/;
5341 }
5342 var54 = 1;
5343 { /* Inline kernel#Int#+ (var53,var54) */
5344 var57 = var53 + var54;
5345 var55 = var57;
5346 goto RET_LABEL56;
5347 RET_LABEL56:(void)0;
5348 }
5349 ((void (*)(val*, long))(self->class->vft[COLOR_ropes__RopeNode__height_61d]))(self, var55) /* height= on <self:ConcatNode>*/;
5350 } else {
5351 }
5352 } else {
5353 }
5354 RET_LABEL:;
5355 }
5356 /* method ropes#ConcatNode#update_data for (self: Object) */
5357 void VIRTUAL_ropes__ConcatNode__update_data(val* self) {
5358 ropes__ConcatNode__update_data(self);
5359 RET_LABEL:;
5360 }
5361 /* method ropes#ConcatNode#balance_factor for (self: ConcatNode): Int */
5362 long ropes__ConcatNode__balance_factor(val* self) {
5363 long var /* : Int */;
5364 long var1 /* : Int */;
5365 long var_left_height /* var left_height: Int */;
5366 long var2 /* : Int */;
5367 long var_right_height /* var right_height: Int */;
5368 val* var3 /* : nullable RopeNode */;
5369 val* var4 /* : null */;
5370 short int var5 /* : Bool */;
5371 val* var6 /* : nullable RopeNode */;
5372 long var7 /* : Int */;
5373 val* var8 /* : nullable RopeNode */;
5374 val* var9 /* : null */;
5375 short int var10 /* : Bool */;
5376 val* var11 /* : nullable RopeNode */;
5377 long var12 /* : Int */;
5378 long var13 /* : Int */;
5379 long var15 /* : Int */;
5380 var1 = 0;
5381 var_left_height = var1;
5382 var2 = 0;
5383 var_right_height = var2;
5384 var3 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__left_child]))(self) /* left_child on <self:ConcatNode>*/;
5385 var4 = NULL;
5386 if (var3 == NULL) {
5387 var5 = 0; /* is null */
5388 } else {
5389 var5 = 1; /* arg is null and recv is not */
5390 }
5391 if (var5){
5392 var6 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__left_child]))(self) /* left_child on <self:ConcatNode>*/;
5393 if (var6 == NULL) {
5394 fprintf(stderr, "Runtime error: %s", "Reciever is null");
5395 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1045);
5396 show_backtrace(1);
5397 } else {
5398 var7 = ((long (*)(val*))(var6->class->vft[COLOR_ropes__RopeNode__height]))(var6) /* height on <var6:nullable RopeNode>*/;
5399 }
5400 var_left_height = var7;
5401 } else {
5402 }
5403 var8 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__right_child]))(self) /* right_child on <self:ConcatNode>*/;
5404 var9 = NULL;
5405 if (var8 == NULL) {
5406 var10 = 0; /* is null */
5407 } else {
5408 var10 = 1; /* arg is null and recv is not */
5409 }
5410 if (var10){
5411 var11 = ((val* (*)(val*))(self->class->vft[COLOR_ropes__ConcatNode__right_child]))(self) /* right_child on <self:ConcatNode>*/;
5412 if (var11 == NULL) {
5413 fprintf(stderr, "Runtime error: %s", "Reciever is null");
5414 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1046);
5415 show_backtrace(1);
5416 } else {
5417 var12 = ((long (*)(val*))(var11->class->vft[COLOR_ropes__RopeNode__height]))(var11) /* height on <var11:nullable RopeNode>*/;
5418 }
5419 var_right_height = var12;
5420 } else {
5421 }
5422 { /* Inline kernel#Int#- (var_left_height,var_right_height) */
5423 var15 = var_left_height - var_right_height;
5424 var13 = var15;
5425 goto RET_LABEL14;
5426 RET_LABEL14:(void)0;
5427 }
5428 var = var13;
5429 goto RET_LABEL;
5430 RET_LABEL:;
5431 return var;
5432 }
5433 /* method ropes#ConcatNode#balance_factor for (self: Object): Int */
5434 long VIRTUAL_ropes__ConcatNode__balance_factor(val* self) {
5435 long var /* : Int */;
5436 long var1 /* : Int */;
5437 var1 = ropes__ConcatNode__balance_factor(self);
5438 var = var1;
5439 RET_LABEL:;
5440 return var;
5441 }
5442 /* method ropes#ConcatNode#init for (self: ConcatNode) */
5443 void ropes__ConcatNode__init(val* self) {
5444 ((void (*)(val*))(self->class->vft[COLOR_ropes__RopeNode__init]))(self) /* init on <self:ConcatNode>*/;
5445 RET_LABEL:;
5446 }
5447 /* method ropes#ConcatNode#init for (self: Object) */
5448 void VIRTUAL_ropes__ConcatNode__init(val* self) {
5449 ropes__ConcatNode__init(self);
5450 RET_LABEL:;
5451 }
5452 /* method ropes#LeafNode#init for (self: LeafNode, AbstractString) */
5453 void ropes__LeafNode__init(val* self, val* p0) {
5454 val* var_val /* var val: AbstractString */;
5455 val* var /* : String */;
5456 long var1 /* : Int */;
5457 var_val = p0;
5458 ((void (*)(val*))(self->class->vft[COLOR_ropes__RopeNode__init]))(self) /* init on <self:LeafNode>*/;
5459 var = ((val* (*)(val*))(var_val->class->vft[COLOR_string__Object__to_s]))(var_val) /* to_s on <var_val:AbstractString>*/;
5460 self->attrs[COLOR_ropes__LeafNode___value].val = var; /* _value on <self:LeafNode> */
5461 var1 = ((long (*)(val*))(var_val->class->vft[COLOR_abstract_collection__Collection__length]))(var_val) /* length on <var_val:AbstractString>*/;
5462 ((void (*)(val*, long))(self->class->vft[COLOR_ropes__RopeNode__length_61d]))(self, var1) /* length= on <self:LeafNode>*/;
5463 RET_LABEL:;
5464 }
5465 /* method ropes#LeafNode#init for (self: Object, AbstractString) */
5466 void VIRTUAL_ropes__LeafNode__init(val* self, val* p0) {
5467 ropes__LeafNode__init(self, p0);
5468 RET_LABEL:;
5469 }
5470 /* method ropes#LeafNode#value for (self: LeafNode): String */
5471 val* ropes__LeafNode__value(val* self) {
5472 val* var /* : String */;
5473 val* var1 /* : String */;
5474 var1 = self->attrs[COLOR_ropes__LeafNode___value].val; /* _value on <self:LeafNode> */
5475 if (var1 == NULL) {
5476 fprintf(stderr, "Runtime error: %s", "Uninitialized attribute _value");
5477 fprintf(stderr, " (%s:%d)\n", "lib/standard/ropes.nit", 1064);
5478 show_backtrace(1);
5479 }
5480 var = var1;
5481 goto RET_LABEL;
5482 RET_LABEL:;
5483 return var;
5484 }
5485 /* method ropes#LeafNode#value for (self: Object): String */
5486 val* VIRTUAL_ropes__LeafNode__value(val* self) {
5487 val* var /* : String */;
5488 val* var1 /* : String */;
5489 var1 = ropes__LeafNode__value(self);
5490 var = var1;
5491 RET_LABEL:;
5492 return var;
5493 }
5494 /* method ropes#LeafNode#value= for (self: LeafNode, String) */
5495 void ropes__LeafNode__value_61d(val* self, val* p0) {
5496 val* var_val /* var val: String */;
5497 var_val = p0;
5498 self->attrs[COLOR_ropes__LeafNode___value].val = var_val; /* _value on <self:LeafNode> */
5499 RET_LABEL:;
5500 }
5501 /* method ropes#LeafNode#value= for (self: Object, String) */
5502 void VIRTUAL_ropes__LeafNode__value_61d(val* self, val* p0) {
5503 ropes__LeafNode__value_61d(self, p0);
5504 RET_LABEL:;
5505 }
5506 /* method ropes#String#== for (self: String, nullable Object): Bool */
5507 short int ropes__String___61d_61d(val* self, val* p0) {
5508 short int var /* : Bool */;
5509 val* var_other /* var other: nullable Object */;
5510 short int var1 /* : Bool */;
5511 int cltype;
5512 int idtype;
5513 short int var2 /* : Bool */;
5514 short int var3 /* : Bool */;
5515 var_other = p0;
5516 /* <var_other:nullable Object> isa Rope */
5517 cltype = type_ropes__Rope.color;
5518 idtype = type_ropes__Rope.id;
5519 if(var_other == NULL) {
5520 var1 = 0;
5521 } else {
5522 if(cltype >= var_other->type->table_size) {
5523 var1 = 0;
5524 } else {
5525 var1 = var_other->type->type_table[cltype] == idtype;
5526 }
5527 }
5528 if (var1){
5529 var2 = ((short int (*)(val*, val*))(var_other->class->vft[COLOR_kernel__Object___61d_61d]))(var_other, self) /* == on <var_other:nullable Object(Rope)>*/;
5530 var = var2;
5531 goto RET_LABEL;
5532 } else {
5533 var3 = ((short int (*)(val*, val*))(self->class->vft[COLOR_ropes__String___61d_61d]))(self, p0) /* == on <self:String>*/;
5534 var = var3;
5535 goto RET_LABEL;
5536 }
5537 RET_LABEL:;
5538 return var;
5539 }
5540 /* method ropes#String#== for (self: Object, nullable Object): Bool */
5541 short int VIRTUAL_ropes__String___61d_61d(val* self, val* p0) {
5542 short int var /* : Bool */;
5543 short int var1 /* : Bool */;
5544 var1 = ropes__String___61d_61d(self, p0);
5545 var = var1;
5546 RET_LABEL:;
5547 return var;
5548 }
5549 /* method ropes#Buffer#== for (self: Buffer, nullable Object): Bool */
5550 short int ropes__Buffer___61d_61d(val* self, val* p0) {
5551 short int var /* : Bool */;
5552 val* var_other /* var other: nullable Object */;
5553 short int var1 /* : Bool */;
5554 int cltype;
5555 int idtype;
5556 short int var2 /* : Bool */;
5557 short int var3 /* : Bool */;
5558 var_other = p0;
5559 /* <var_other:nullable Object> isa Rope */
5560 cltype = type_ropes__Rope.color;
5561 idtype = type_ropes__Rope.id;
5562 if(var_other == NULL) {
5563 var1 = 0;
5564 } else {
5565 if(cltype >= var_other->type->table_size) {
5566 var1 = 0;
5567 } else {
5568 var1 = var_other->type->type_table[cltype] == idtype;
5569 }
5570 }
5571 if (var1){
5572 var2 = ((short int (*)(val*, val*))(var_other->class->vft[COLOR_kernel__Object___61d_61d]))(var_other, self) /* == on <var_other:nullable Object(Rope)>*/;
5573 var = var2;
5574 goto RET_LABEL;
5575 } else {
5576 var3 = ((short int (*)(val*, val*))(self->class->vft[COLOR_ropes__Buffer___61d_61d]))(self, p0) /* == on <self:Buffer>*/;
5577 var = var3;
5578 goto RET_LABEL;
5579 }
5580 RET_LABEL:;
5581 return var;
5582 }
5583 /* method ropes#Buffer#== for (self: Object, nullable Object): Bool */
5584 short int VIRTUAL_ropes__Buffer___61d_61d(val* self, val* p0) {
5585 short int var /* : Bool */;
5586 short int var1 /* : Bool */;
5587 var1 = ropes__Buffer___61d_61d(self, p0);
5588 var = var1;
5589 RET_LABEL:;
5590 return var;
5591 }