1 #include "cached.sep.0.h"
2 /* method cached#ToolContext#cached_phase for (self: ToolContext): Phase */
3 val
* cached__ToolContext__cached_phase(val
* self
) {
4 val
* var
/* : Phase */;
5 val
* var1
/* : Phase */;
6 var1
= self
->attrs
[COLOR_cached__ToolContext___64dcached_phase
].val
; /* @cached_phase on <self:ToolContext> */
8 fprintf(stderr
, "Runtime error: %s", "Uninitialized attribute @cached_phase");
9 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 26);
16 /* method cached#ToolContext#cached_phase for (self: Object): Phase */
17 val
* VIRTUAL_cached__ToolContext__cached_phase(val
* self
) {
18 val
* var
/* : Phase */;
19 val
* var1
/* : Phase */;
20 var1
= cached__ToolContext__cached_phase(self
);
25 /* method cached#ToolContext#cached_phase= for (self: ToolContext, Phase) */
26 void cached__ToolContext__cached_phase_61d(val
* self
, val
* p0
) {
27 self
->attrs
[COLOR_cached__ToolContext___64dcached_phase
].val
= p0
; /* @cached_phase on <self:ToolContext> */
30 /* method cached#ToolContext#cached_phase= for (self: Object, Phase) */
31 void VIRTUAL_cached__ToolContext__cached_phase_61d(val
* self
, val
* p0
) {
32 cached__ToolContext__cached_phase_61d(self
, p0
);
35 /* method cached#CachedPhase#init for (self: CachedPhase, ToolContext, nullable Collection[Phase]) */
36 void cached__CachedPhase__init(val
* self
, val
* p0
, val
* p1
) {
37 val
* var_toolcontext
/* var toolcontext: ToolContext */;
38 val
* var_depends
/* var depends: nullable Collection[Phase] */;
39 val
* var
/* : POSet[Phase] */;
40 val
* var1
/* : Phase */;
43 ((void (*)(val
*, val
*, val
*))(self
->class->vft
[COLOR_phase__Phase__init
]))(self
, p0
, p1
) /* init on <self:CachedPhase>*/;
44 var
= ((val
* (*)(val
*))(var_toolcontext
->class->vft
[COLOR_phase__ToolContext__phases
]))(var_toolcontext
) /* phases on <var_toolcontext:ToolContext>*/;
45 var1
= ((val
* (*)(val
*))(var_toolcontext
->class->vft
[COLOR_simple_misc_analysis__ToolContext__simple_misc_analysis_phase
]))(var_toolcontext
) /* simple_misc_analysis_phase on <var_toolcontext:ToolContext>*/;
46 ((void (*)(val
*, val
*, val
*))(var
->class->vft
[COLOR_poset__POSet__add_edge
]))(var
, var1
, self
) /* add_edge on <var:POSet[Phase]>*/;
49 /* method cached#CachedPhase#init for (self: Object, ToolContext, nullable Collection[Phase]) */
50 void VIRTUAL_cached__CachedPhase__init(val
* self
, val
* p0
, val
* p1
) {
51 cached__CachedPhase__init(self
, p0
, p1
);
54 /* method cached#CachedPhase#process_annotated_node for (self: CachedPhase, ANode, AAnnotation) */
55 void cached__CachedPhase__process_annotated_node(val
* self
, val
* p0
, val
* p1
) {
56 val
* var_npropdef
/* var npropdef: ANode */;
57 val
* var_nat
/* var nat: AAnnotation */;
58 val
* var
/* : AAtid */;
59 val
* var1
/* : Token */;
60 val
* var2
/* : String */;
62 val
* var3
/* : String */;
63 char* var4
/* : NativeString */;
64 long var5
/* : Int */;
65 val
* var6
/* : String */;
66 short int var7
/* : Bool */;
67 val
* var8
/* : ToolContext */;
68 val
* var9
/* : ModelBuilder */;
69 val
* var_modelbuilder
/* var modelbuilder: ModelBuilder */;
70 short int var10
/* : Bool */;
73 short int var11
/* : Bool */;
74 static val
* varonce12
;
75 val
* var13
/* : String */;
76 char* var14
/* : NativeString */;
77 long var15
/* : Int */;
78 val
* var16
/* : String */;
79 val
* var17
/* : nullable MPropDef */;
80 val
* var_mpropdef
/* var mpropdef: MMethodDef */;
81 val
* var18
/* : nullable MSignature */;
82 val
* var19
/* : nullable MType */;
83 val
* var_mtype
/* var mtype: nullable MType */;
84 val
* var20
/* : null */;
85 short int var21
/* : Bool */;
86 static val
* varonce22
;
87 val
* var23
/* : String */;
88 char* var24
/* : NativeString */;
89 long var25
/* : Int */;
90 val
* var26
/* : String */;
91 val
* var27
/* : nullable ASignature */;
92 val
* var28
/* : ANodes[AParam] */;
93 short int var29
/* : Bool */;
94 short int var30
/* : Bool */;
95 static val
* varonce31
;
96 val
* var32
/* : String */;
97 char* var33
/* : NativeString */;
98 long var34
/* : Int */;
99 val
* var35
/* : String */;
100 val
* var36
/* : Location */;
101 val
* var_location
/* var location: Location */;
102 val
* var37
/* : MProperty */;
103 val
* var38
/* : String */;
104 val
* var_name
/* var name: String */;
105 val
* var39
/* : nullable ANode */;
106 short int var40
/* : Bool */;
109 const char* var_class_name
;
110 val
* var_nclassdef
/* var nclassdef: AStdClassdef */;
111 val
* var43
/* : nullable MClassDef */;
112 val
* var_mclassdef
/* var mclassdef: MClassDef */;
113 val
* var44
/* : MAttributeDef */;
114 val
* var45
/* : MAttribute */;
115 val
* var46
/* : Array[Object] */;
116 long var47
/* : Int */;
117 val
* var_
/* var : Array[Object] */;
118 static val
* varonce48
;
119 val
* var49
/* : String */;
120 char* var50
/* : NativeString */;
121 long var51
/* : Int */;
122 val
* var52
/* : String */;
123 static val
* varonce53
;
124 val
* var54
/* : String */;
125 char* var55
/* : NativeString */;
126 long var56
/* : Int */;
127 val
* var57
/* : String */;
128 val
* var58
/* : String */;
129 val
* var59
/* : MVisibility */;
130 val
* var_cache_mpropdef
/* var cache_mpropdef: MAttributeDef */;
131 val
* var60
/* : MType */;
132 val
* var61
/* : MAttributeDef */;
133 val
* var62
/* : MAttribute */;
134 val
* var63
/* : Array[Object] */;
135 long var64
/* : Int */;
136 val
* var_65
/* var : Array[Object] */;
137 static val
* varonce66
;
138 val
* var67
/* : String */;
139 char* var68
/* : NativeString */;
140 long var69
/* : Int */;
141 val
* var70
/* : String */;
142 static val
* varonce71
;
143 val
* var72
/* : String */;
144 char* var73
/* : NativeString */;
145 long var74
/* : Int */;
146 val
* var75
/* : String */;
147 val
* var76
/* : String */;
148 val
* var77
/* : MVisibility */;
149 val
* var_is_cached_mpropdef
/* var is_cached_mpropdef: MAttributeDef */;
150 val
* var78
/* : MModule */;
151 static val
* varonce79
;
152 val
* var80
/* : String */;
153 char* var81
/* : NativeString */;
154 long var82
/* : Int */;
155 val
* var83
/* : String */;
156 val
* var84
/* : MClass */;
157 val
* var85
/* : MClassType */;
158 val
* var86
/* : ToolContext */;
159 static val
* varonce87
;
160 val
* var88
/* : String */;
161 char* var89
/* : NativeString */;
162 long var90
/* : Int */;
163 val
* var91
/* : String */;
164 val
* var92
/* : APropdef */;
165 short int var93
/* : Bool */;
168 const char* var_class_name96
;
169 val
* var_is_cached_npropdef
/* var is_cached_npropdef: AAttrPropdef */;
170 val
* var97
/* : MMethodDef */;
171 val
* var98
/* : MMethod */;
172 val
* var99
/* : Array[Object] */;
173 long var100
/* : Int */;
174 val
* var_101
/* var : Array[Object] */;
175 static val
* varonce102
;
176 val
* var103
/* : String */;
177 char* var104
/* : NativeString */;
178 long var105
/* : Int */;
179 val
* var106
/* : String */;
180 static val
* varonce107
;
181 val
* var108
/* : String */;
182 char* var109
/* : NativeString */;
183 long var110
/* : Int */;
184 val
* var111
/* : String */;
185 val
* var112
/* : String */;
186 val
* var113
/* : MVisibility */;
187 val
* var_real_mpropdef
/* var real_mpropdef: MMethodDef */;
188 val
* var114
/* : nullable MSignature */;
189 val
* var115
/* : ToolContext */;
190 static val
* varonce116
;
191 val
* var117
/* : String */;
192 char* var118
/* : NativeString */;
193 long var119
/* : Int */;
194 val
* var120
/* : String */;
195 val
* var121
/* : APropdef */;
196 short int var122
/* : Bool */;
199 const char* var_class_name125
;
200 val
* var_real_npropdef
/* var real_npropdef: AConcreteMethPropdef */;
201 val
* var126
/* : nullable AExpr */;
202 val
* var_real_body
/* var real_body: AExpr */;
203 val
* var127
/* : ToolContext */;
204 static val
* varonce128
;
205 val
* var129
/* : String */;
206 char* var130
/* : NativeString */;
207 long var131
/* : Int */;
208 val
* var132
/* : String */;
209 val
* var133
/* : AExpr */;
210 val
* var_proxy_body
/* var proxy_body: AExpr */;
211 static val
* varonce134
;
212 val
* var135
/* : String */;
213 char* var136
/* : NativeString */;
214 long var137
/* : Int */;
215 val
* var138
/* : String */;
216 val
* var139
/* : Array[Token] */;
217 val
* var140
/* : nullable Object */;
218 val
* var141
/* : MProperty */;
219 val
* var142
/* : String */;
220 static val
* varonce143
;
221 val
* var144
/* : String */;
222 char* var145
/* : NativeString */;
223 long var146
/* : Int */;
224 val
* var147
/* : String */;
225 val
* var148
/* : Array[Token] */;
226 val
* var149
/* : nullable Object */;
227 val
* var150
/* : MProperty */;
228 val
* var151
/* : String */;
229 static val
* varonce152
;
230 val
* var153
/* : String */;
231 char* var154
/* : NativeString */;
232 long var155
/* : Int */;
233 val
* var156
/* : String */;
234 val
* var157
/* : Array[Token] */;
235 val
* var158
/* : nullable Object */;
236 val
* var159
/* : MProperty */;
237 val
* var160
/* : String */;
238 static val
* varonce161
;
239 val
* var162
/* : String */;
240 char* var163
/* : NativeString */;
241 long var164
/* : Int */;
242 val
* var165
/* : String */;
243 val
* var166
/* : Array[Token] */;
244 val
* var167
/* : nullable Object */;
245 val
* var168
/* : MProperty */;
246 val
* var169
/* : String */;
247 static val
* varonce170
;
248 val
* var171
/* : String */;
249 char* var172
/* : NativeString */;
250 long var173
/* : Int */;
251 val
* var174
/* : String */;
252 val
* var175
/* : Array[Token] */;
253 val
* var176
/* : nullable Object */;
254 val
* var177
/* : MProperty */;
255 val
* var178
/* : String */;
256 val
* var179
/* : nullable AExpr */;
259 var
= ((val
* (*)(val
*))(var_nat
->class->vft
[COLOR_parser_nodes__AAnnotation__n_atid
]))(var_nat
) /* n_atid on <var_nat:AAnnotation>*/;
260 var1
= ((val
* (*)(val
*))(var
->class->vft
[COLOR_parser_nodes__AAtid__n_id
]))(var
) /* n_id on <var:AAtid>*/;
261 var2
= ((val
* (*)(val
*))(var1
->class->vft
[COLOR_parser_nodes__Token__text
]))(var1
) /* text on <var1:Token>*/;
267 var6
= string__NativeString__to_s_with_length(var4
, var5
);
271 var7
= ((short int (*)(val
*, val
*))(var2
->class->vft
[COLOR_kernel__Object___33d_61d
]))(var2
, var3
) /* != on <var2:String>*/;
276 var8
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
277 var9
= ((val
* (*)(val
*))(var8
->class->vft
[COLOR_modelbuilder__ToolContext__modelbuilder
]))(var8
) /* modelbuilder on <var8:ToolContext>*/;
278 var_modelbuilder
= var9
;
279 /* <var_npropdef:ANode> isa AConcreteMethPropdef */
280 cltype
= type_parser_nodes__AConcreteMethPropdef
.color
;
281 idtype
= type_parser_nodes__AConcreteMethPropdef
.id
;
282 if(cltype
>= var_npropdef
->type
->table_size
) {
285 var10
= var_npropdef
->type
->type_table
[cltype
] == idtype
;
292 var14
= "Syntax error: only a function can be cached.";
294 var16
= string__NativeString__to_s_with_length(var14
, var15
);
298 ((void (*)(val
*, val
*, val
*))(var_modelbuilder
->class->vft
[COLOR_modelbuilder__ModelBuilder__error
]))(var_modelbuilder
, var_npropdef
, var13
) /* error on <var_modelbuilder:ModelBuilder>*/;
302 var17
= ((val
* (*)(val
*))(var_npropdef
->class->vft
[COLOR_modelize_property__APropdef__mpropdef
]))(var_npropdef
) /* mpropdef on <var_npropdef:ANode(AConcreteMethPropdef)>*/;
304 fprintf(stderr
, "Runtime error: %s", "Cast failed");
305 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 54);
308 var_mpropdef
= var17
;
309 var18
= ((val
* (*)(val
*))(var_mpropdef
->class->vft
[COLOR_model__MMethodDef__msignature
]))(var_mpropdef
) /* msignature on <var_mpropdef:MMethodDef>*/;
311 fprintf(stderr
, "Runtime error: %s", "Receiver is null");
312 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 56);
315 var19
= ((val
* (*)(val
*))(var18
->class->vft
[COLOR_model__MSignature__return_mtype
]))(var18
) /* return_mtype on <var18:nullable MSignature>*/;
319 if (var_mtype
== NULL
) {
320 var21
= 1; /* is null */
322 var21
= 0; /* arg is null but recv is not */
328 var24
= "Syntax error: only a function can be cached.";
330 var26
= string__NativeString__to_s_with_length(var24
, var25
);
334 ((void (*)(val
*, val
*, val
*))(var_modelbuilder
->class->vft
[COLOR_modelbuilder__ModelBuilder__error
]))(var_modelbuilder
, var_npropdef
, var23
) /* error on <var_modelbuilder:ModelBuilder>*/;
338 var27
= ((val
* (*)(val
*))(var_npropdef
->class->vft
[COLOR_parser_nodes__AMethPropdef__n_signature
]))(var_npropdef
) /* n_signature on <var_npropdef:ANode(AConcreteMethPropdef)>*/;
340 fprintf(stderr
, "Runtime error: %s", "Receiver is null");
341 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 62);
344 var28
= ((val
* (*)(val
*))(var27
->class->vft
[COLOR_parser_nodes__ASignature__n_params
]))(var27
) /* n_params on <var27:nullable ASignature>*/;
346 var29
= ((short int (*)(val
*))(var28
->class->vft
[COLOR_abstract_collection__Collection__is_empty
]))(var28
) /* is_empty on <var28:ANodes[AParam]>*/;
352 var33
= "Syntax error: only a function without arguments can be cached.";
354 var35
= string__NativeString__to_s_with_length(var33
, var34
);
358 ((void (*)(val
*, val
*, val
*))(var_modelbuilder
->class->vft
[COLOR_modelbuilder__ModelBuilder__error
]))(var_modelbuilder
, var_npropdef
, var32
) /* error on <var_modelbuilder:ModelBuilder>*/;
362 var36
= ((val
* (*)(val
*))(var_npropdef
->class->vft
[COLOR_parser_nodes__ANode__location
]))(var_npropdef
) /* location on <var_npropdef:ANode(AConcreteMethPropdef)>*/;
363 var_location
= var36
;
364 var37
= ((val
* (*)(val
*))(var_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_mpropdef
) /* mproperty on <var_mpropdef:MMethodDef>*/;
365 var38
= ((val
* (*)(val
*))(var37
->class->vft
[COLOR_model__MProperty__name
]))(var37
) /* name on <var37:MProperty(MMethod)>*/;
367 var39
= ((val
* (*)(val
*))(var_npropdef
->class->vft
[COLOR_parser_nodes__ANode__parent
]))(var_npropdef
) /* parent on <var_npropdef:ANode(AConcreteMethPropdef)>*/;
368 /* <var39:nullable ANode> isa AStdClassdef */
369 cltype41
= type_parser_nodes__AStdClassdef
.color
;
370 idtype42
= type_parser_nodes__AStdClassdef
.id
;
374 if(cltype41
>= var39
->type
->table_size
) {
377 var40
= var39
->type
->type_table
[cltype41
] == idtype42
;
381 var_class_name
= var39
== NULL ?
"null" : var39
->type
->name
;
382 fprintf(stderr
, "Runtime error: Cast failed. Expected `%s`, got `%s`", "AStdClassdef", var_class_name
);
383 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 71);
386 var_nclassdef
= var39
;
387 var43
= ((val
* (*)(val
*))(var_nclassdef
->class->vft
[COLOR_modelize_class__AClassdef__mclassdef
]))(var_nclassdef
) /* mclassdef on <var_nclassdef:AStdClassdef>*/;
389 fprintf(stderr
, "Runtime error: %s", "Cast failed");
390 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 72);
393 var_mclassdef
= var43
;
394 var44
= NEW_model__MAttributeDef(&type_model__MAttributeDef
);
395 var45
= NEW_model__MAttribute(&type_model__MAttribute
);
396 var46
= NEW_array__Array(&type_array__Arraykernel__Object
);
398 ((void (*)(val
*, long))(var46
->class->vft
[COLOR_array__Array__with_capacity
]))(var46
, var47
) /* with_capacity on <var46:Array[Object]>*/;
405 var52
= string__NativeString__to_s_with_length(var50
, var51
);
409 ((void (*)(val
*, val
*))(var_
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_
, var49
) /* add on <var_:Array[Object]>*/;
410 ((void (*)(val
*, val
*))(var_
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_
, var_name
) /* add on <var_:Array[Object]>*/;
416 var57
= string__NativeString__to_s_with_length(var55
, var56
);
420 ((void (*)(val
*, val
*))(var_
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_
, var54
) /* add on <var_:Array[Object]>*/;
421 var58
= ((val
* (*)(val
*))(var_
->class->vft
[COLOR_string__Object__to_s
]))(var_
) /* to_s on <var_:Array[Object]>*/;
422 var59
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_model_base__Object__private_visibility
]))(self
) /* private_visibility on <self:CachedPhase>*/;
423 ((void (*)(val
*, val
*, val
*, val
*))(var45
->class->vft
[COLOR_model__MAttribute__init
]))(var45
, var_mclassdef
, var58
, var59
) /* init on <var45:MAttribute>*/;
424 ((void (*)(val
*, val
*, val
*, val
*))(var44
->class->vft
[COLOR_model__MAttributeDef__init
]))(var44
, var_mclassdef
, var45
, var_location
) /* init on <var44:MAttributeDef>*/;
425 var_cache_mpropdef
= var44
;
426 var60
= ((val
* (*)(val
*))(var_mtype
->class->vft
[COLOR_model__MType__as_nullable
]))(var_mtype
) /* as_nullable on <var_mtype:nullable MType(MType)>*/;
427 ((void (*)(val
*, val
*))(var_cache_mpropdef
->class->vft
[COLOR_model__MAttributeDef__static_mtype_61d
]))(var_cache_mpropdef
, var60
) /* static_mtype= on <var_cache_mpropdef:MAttributeDef>*/;
428 var61
= NEW_model__MAttributeDef(&type_model__MAttributeDef
);
429 var62
= NEW_model__MAttribute(&type_model__MAttribute
);
430 var63
= NEW_array__Array(&type_array__Arraykernel__Object
);
432 ((void (*)(val
*, long))(var63
->class->vft
[COLOR_array__Array__with_capacity
]))(var63
, var64
) /* with_capacity on <var63:Array[Object]>*/;
439 var70
= string__NativeString__to_s_with_length(var68
, var69
);
443 ((void (*)(val
*, val
*))(var_65
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_65
, var67
) /* add on <var_65:Array[Object]>*/;
444 ((void (*)(val
*, val
*))(var_65
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_65
, var_name
) /* add on <var_65:Array[Object]>*/;
448 var73
= "<is_cached>";
450 var75
= string__NativeString__to_s_with_length(var73
, var74
);
454 ((void (*)(val
*, val
*))(var_65
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_65
, var72
) /* add on <var_65:Array[Object]>*/;
455 var76
= ((val
* (*)(val
*))(var_65
->class->vft
[COLOR_string__Object__to_s
]))(var_65
) /* to_s on <var_65:Array[Object]>*/;
456 var77
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_model_base__Object__private_visibility
]))(self
) /* private_visibility on <self:CachedPhase>*/;
457 ((void (*)(val
*, val
*, val
*, val
*))(var62
->class->vft
[COLOR_model__MAttribute__init
]))(var62
, var_mclassdef
, var76
, var77
) /* init on <var62:MAttribute>*/;
458 ((void (*)(val
*, val
*, val
*, val
*))(var61
->class->vft
[COLOR_model__MAttributeDef__init
]))(var61
, var_mclassdef
, var62
, var_location
) /* init on <var61:MAttributeDef>*/;
459 var_is_cached_mpropdef
= var61
;
460 var78
= ((val
* (*)(val
*))(var_mclassdef
->class->vft
[COLOR_model__MClassDef__mmodule
]))(var_mclassdef
) /* mmodule on <var_mclassdef:MClassDef>*/;
466 var83
= string__NativeString__to_s_with_length(var81
, var82
);
470 var84
= ((val
* (*)(val
*, val
*))(var78
->class->vft
[COLOR_model__MModule__get_primitive_class
]))(var78
, var80
) /* get_primitive_class on <var78:MModule>*/;
471 var85
= ((val
* (*)(val
*))(var84
->class->vft
[COLOR_model__MClass__mclass_type
]))(var84
) /* mclass_type on <var84:MClass>*/;
472 ((void (*)(val
*, val
*))(var_is_cached_mpropdef
->class->vft
[COLOR_model__MAttributeDef__static_mtype_61d
]))(var_is_cached_mpropdef
, var85
) /* static_mtype= on <var_is_cached_mpropdef:MAttributeDef>*/;
473 var86
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
477 var89
= "var is_cached = false";
479 var91
= string__NativeString__to_s_with_length(var89
, var90
);
483 var92
= ((val
* (*)(val
*, val
*))(var86
->class->vft
[COLOR_parser_util__ToolContext__parse_propdef
]))(var86
, var88
) /* parse_propdef on <var86:ToolContext>*/;
484 /* <var92:APropdef> isa AAttrPropdef */
485 cltype94
= type_parser_nodes__AAttrPropdef
.color
;
486 idtype95
= type_parser_nodes__AAttrPropdef
.id
;
487 if(cltype94
>= var92
->type
->table_size
) {
490 var93
= var92
->type
->type_table
[cltype94
] == idtype95
;
493 var_class_name96
= var92
== NULL ?
"null" : var92
->type
->name
;
494 fprintf(stderr
, "Runtime error: Cast failed. Expected `%s`, got `%s`", "AAttrPropdef", var_class_name96
);
495 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 83);
498 var_is_cached_npropdef
= var92
;
499 ((void (*)(val
*, val
*, val
*))(self
->class->vft
[COLOR_cached__CachedPhase__associate_propdef
]))(self
, var_is_cached_mpropdef
, var_is_cached_npropdef
) /* associate_propdef on <self:CachedPhase>*/;
500 var97
= NEW_model__MMethodDef(&type_model__MMethodDef
);
501 var98
= NEW_model__MMethod(&type_model__MMethod
);
502 var99
= NEW_array__Array(&type_array__Arraykernel__Object
);
504 ((void (*)(val
*, long))(var99
->class->vft
[COLOR_array__Array__with_capacity
]))(var99
, var100
) /* with_capacity on <var99:Array[Object]>*/;
511 var106
= string__NativeString__to_s_with_length(var104
, var105
);
515 ((void (*)(val
*, val
*))(var_101
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_101
, var103
) /* add on <var_101:Array[Object]>*/;
516 ((void (*)(val
*, val
*))(var_101
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_101
, var_name
) /* add on <var_101:Array[Object]>*/;
522 var111
= string__NativeString__to_s_with_length(var109
, var110
);
526 ((void (*)(val
*, val
*))(var_101
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_101
, var108
) /* add on <var_101:Array[Object]>*/;
527 var112
= ((val
* (*)(val
*))(var_101
->class->vft
[COLOR_string__Object__to_s
]))(var_101
) /* to_s on <var_101:Array[Object]>*/;
528 var113
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_model_base__Object__private_visibility
]))(self
) /* private_visibility on <self:CachedPhase>*/;
529 ((void (*)(val
*, val
*, val
*, val
*))(var98
->class->vft
[COLOR_model__MMethod__init
]))(var98
, var_mclassdef
, var112
, var113
) /* init on <var98:MMethod>*/;
530 ((void (*)(val
*, val
*, val
*, val
*))(var97
->class->vft
[COLOR_model__MMethodDef__init
]))(var97
, var_mclassdef
, var98
, var_location
) /* init on <var97:MMethodDef>*/;
531 var_real_mpropdef
= var97
;
532 var114
= ((val
* (*)(val
*))(var_mpropdef
->class->vft
[COLOR_model__MMethodDef__msignature
]))(var_mpropdef
) /* msignature on <var_mpropdef:MMethodDef>*/;
533 ((void (*)(val
*, val
*))(var_real_mpropdef
->class->vft
[COLOR_model__MMethodDef__msignature_61d
]))(var_real_mpropdef
, var114
) /* msignature= on <var_real_mpropdef:MMethodDef>*/;
534 var115
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
538 var118
= "fun real do end";
540 var120
= string__NativeString__to_s_with_length(var118
, var119
);
544 var121
= ((val
* (*)(val
*, val
*))(var115
->class->vft
[COLOR_parser_util__ToolContext__parse_propdef
]))(var115
, var117
) /* parse_propdef on <var115:ToolContext>*/;
545 /* <var121:APropdef> isa AConcreteMethPropdef */
546 cltype123
= type_parser_nodes__AConcreteMethPropdef
.color
;
547 idtype124
= type_parser_nodes__AConcreteMethPropdef
.id
;
548 if(cltype123
>= var121
->type
->table_size
) {
551 var122
= var121
->type
->type_table
[cltype123
] == idtype124
;
554 var_class_name125
= var121
== NULL ?
"null" : var121
->type
->name
;
555 fprintf(stderr
, "Runtime error: Cast failed. Expected `%s`, got `%s`", "AConcreteMethPropdef", var_class_name125
);
556 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 90);
559 var_real_npropdef
= var121
;
560 ((void (*)(val
*, val
*, val
*))(self
->class->vft
[COLOR_cached__CachedPhase__associate_propdef
]))(self
, var_real_mpropdef
, var_real_npropdef
) /* associate_propdef on <self:CachedPhase>*/;
561 var126
= ((val
* (*)(val
*))(var_npropdef
->class->vft
[COLOR_parser_nodes__AConcreteMethPropdef__n_block
]))(var_npropdef
) /* n_block on <var_npropdef:ANode(AConcreteMethPropdef)>*/;
562 if (var126
== NULL
) {
563 fprintf(stderr
, "Runtime error: %s", "Cast failed");
564 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 95);
567 var_real_body
= var126
;
568 var127
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
572 var130
= "if self._is_cached then return self._cache.as(not null)\nvar res = call_real\nself._cache_write = res\nself._is_cached_write = true\nreturn res";
574 var132
= string__NativeString__to_s_with_length(var130
, var131
);
578 var133
= ((val
* (*)(val
*, val
*))(var127
->class->vft
[COLOR_parser_util__ToolContext__parse_stmts
]))(var127
, var129
) /* parse_stmts on <var127:ToolContext>*/;
579 var_proxy_body
= var133
;
580 ((void (*)(val
*, val
*))(var_real_body
->class->vft
[COLOR_parser_nodes__ANode__replace_with
]))(var_real_body
, var_proxy_body
) /* replace_with on <var_real_body:AExpr>*/;
584 var136
= "_is_cached";
586 var138
= string__NativeString__to_s_with_length(var136
, var137
);
590 var139
= ((val
* (*)(val
*, val
*))(var_proxy_body
->class->vft
[COLOR_parser_util__ANode__collect_tokens_by_text
]))(var_proxy_body
, var135
) /* collect_tokens_by_text on <var_proxy_body:AExpr>*/;
591 var140
= ((val
* (*)(val
*))(var139
->class->vft
[COLOR_abstract_collection__Collection__first
]))(var139
) /* first on <var139:Array[Token]>*/;
592 var141
= ((val
* (*)(val
*))(var_is_cached_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_is_cached_mpropdef
) /* mproperty on <var_is_cached_mpropdef:MAttributeDef>*/;
593 var142
= ((val
* (*)(val
*))(var141
->class->vft
[COLOR_model__MProperty__name
]))(var141
) /* name on <var141:MProperty(MAttribute)>*/;
594 ((void (*)(val
*, val
*))(var140
->class->vft
[COLOR_parser_nodes__Token__text_61d
]))(var140
, var142
) /* text= on <var140:nullable Object(Token)>*/;
598 var145
= "_is_cached_write";
600 var147
= string__NativeString__to_s_with_length(var145
, var146
);
604 var148
= ((val
* (*)(val
*, val
*))(var_proxy_body
->class->vft
[COLOR_parser_util__ANode__collect_tokens_by_text
]))(var_proxy_body
, var144
) /* collect_tokens_by_text on <var_proxy_body:AExpr>*/;
605 var149
= ((val
* (*)(val
*))(var148
->class->vft
[COLOR_abstract_collection__Collection__first
]))(var148
) /* first on <var148:Array[Token]>*/;
606 var150
= ((val
* (*)(val
*))(var_is_cached_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_is_cached_mpropdef
) /* mproperty on <var_is_cached_mpropdef:MAttributeDef>*/;
607 var151
= ((val
* (*)(val
*))(var150
->class->vft
[COLOR_model__MProperty__name
]))(var150
) /* name on <var150:MProperty(MAttribute)>*/;
608 ((void (*)(val
*, val
*))(var149
->class->vft
[COLOR_parser_nodes__Token__text_61d
]))(var149
, var151
) /* text= on <var149:nullable Object(Token)>*/;
614 var156
= string__NativeString__to_s_with_length(var154
, var155
);
618 var157
= ((val
* (*)(val
*, val
*))(var_proxy_body
->class->vft
[COLOR_parser_util__ANode__collect_tokens_by_text
]))(var_proxy_body
, var153
) /* collect_tokens_by_text on <var_proxy_body:AExpr>*/;
619 var158
= ((val
* (*)(val
*))(var157
->class->vft
[COLOR_abstract_collection__Collection__first
]))(var157
) /* first on <var157:Array[Token]>*/;
620 var159
= ((val
* (*)(val
*))(var_cache_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_cache_mpropdef
) /* mproperty on <var_cache_mpropdef:MAttributeDef>*/;
621 var160
= ((val
* (*)(val
*))(var159
->class->vft
[COLOR_model__MProperty__name
]))(var159
) /* name on <var159:MProperty(MAttribute)>*/;
622 ((void (*)(val
*, val
*))(var158
->class->vft
[COLOR_parser_nodes__Token__text_61d
]))(var158
, var160
) /* text= on <var158:nullable Object(Token)>*/;
626 var163
= "_cache_write";
628 var165
= string__NativeString__to_s_with_length(var163
, var164
);
632 var166
= ((val
* (*)(val
*, val
*))(var_proxy_body
->class->vft
[COLOR_parser_util__ANode__collect_tokens_by_text
]))(var_proxy_body
, var162
) /* collect_tokens_by_text on <var_proxy_body:AExpr>*/;
633 var167
= ((val
* (*)(val
*))(var166
->class->vft
[COLOR_abstract_collection__Collection__first
]))(var166
) /* first on <var166:Array[Token]>*/;
634 var168
= ((val
* (*)(val
*))(var_cache_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_cache_mpropdef
) /* mproperty on <var_cache_mpropdef:MAttributeDef>*/;
635 var169
= ((val
* (*)(val
*))(var168
->class->vft
[COLOR_model__MProperty__name
]))(var168
) /* name on <var168:MProperty(MAttribute)>*/;
636 ((void (*)(val
*, val
*))(var167
->class->vft
[COLOR_parser_nodes__Token__text_61d
]))(var167
, var169
) /* text= on <var167:nullable Object(Token)>*/;
640 var172
= "call_real";
642 var174
= string__NativeString__to_s_with_length(var172
, var173
);
646 var175
= ((val
* (*)(val
*, val
*))(var_proxy_body
->class->vft
[COLOR_parser_util__ANode__collect_tokens_by_text
]))(var_proxy_body
, var171
) /* collect_tokens_by_text on <var_proxy_body:AExpr>*/;
647 var176
= ((val
* (*)(val
*))(var175
->class->vft
[COLOR_abstract_collection__Collection__first
]))(var175
) /* first on <var175:Array[Token]>*/;
648 var177
= ((val
* (*)(val
*))(var_real_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_real_mpropdef
) /* mproperty on <var_real_mpropdef:MMethodDef>*/;
649 var178
= ((val
* (*)(val
*))(var177
->class->vft
[COLOR_model__MProperty__name
]))(var177
) /* name on <var177:MProperty(MMethod)>*/;
650 ((void (*)(val
*, val
*))(var176
->class->vft
[COLOR_parser_nodes__Token__text_61d
]))(var176
, var178
) /* text= on <var176:nullable Object(Token)>*/;
651 var179
= ((val
* (*)(val
*))(var_real_npropdef
->class->vft
[COLOR_parser_nodes__AConcreteMethPropdef__n_block
]))(var_real_npropdef
) /* n_block on <var_real_npropdef:AConcreteMethPropdef>*/;
652 if (var179
== NULL
) {
653 fprintf(stderr
, "Runtime error: %s", "Receiver is null");
654 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 115);
657 ((void (*)(val
*, val
*))(var179
->class->vft
[COLOR_parser_nodes__ANode__replace_with
]))(var179
, var_real_body
) /* replace_with on <var179:nullable AExpr>*/;
661 /* method cached#CachedPhase#process_annotated_node for (self: Object, ANode, AAnnotation) */
662 void VIRTUAL_cached__CachedPhase__process_annotated_node(val
* self
, val
* p0
, val
* p1
) {
663 cached__CachedPhase__process_annotated_node(self
, p0
, p1
);
666 /* method cached#CachedPhase#associate_propdef for (self: CachedPhase, MPropDef, APropdef) */
667 void cached__CachedPhase__associate_propdef(val
* self
, val
* p0
, val
* p1
) {
668 val
* var_m
/* var m: MPropDef */;
669 val
* var_n
/* var n: APropdef */;
670 val
* var
/* : nullable MPropDef */;
671 val
* var1
/* : null */;
672 short int var2
/* : Bool */;
673 val
* var3
/* : ToolContext */;
674 val
* var4
/* : ModelBuilder */;
675 val
* var5
/* : HashMap[MPropDef, APropdef] */;
676 short int var6
/* : Bool */;
677 short int var7
/* : Bool */;
678 val
* var8
/* : ToolContext */;
679 val
* var9
/* : ModelBuilder */;
680 val
* var10
/* : HashMap[MPropDef, APropdef] */;
681 val
* var11
/* : MClassDef */;
682 val
* var_mclassdef
/* var mclassdef: MClassDef */;
683 val
* var12
/* : ToolContext */;
684 val
* var13
/* : ModelBuilder */;
685 val
* var14
/* : HashMap[MClassDef, AClassdef] */;
686 val
* var15
/* : nullable Object */;
687 val
* var_nclassdef
/* var nclassdef: AClassdef */;
688 val
* var16
/* : nullable MClassDef */;
689 short int var17
/* : Bool */;
690 val
* var18
/* : ANodes[APropdef] */;
691 short int var19
/* : Bool */;
692 short int var20
/* : Bool */;
693 val
* var21
/* : ANodes[APropdef] */;
696 var
= ((val
* (*)(val
*))(var_n
->class->vft
[COLOR_modelize_property__APropdef__mpropdef
]))(var_n
) /* mpropdef on <var_n:APropdef>*/;
699 var2
= 1; /* is null */
701 var2
= 0; /* arg is null but recv is not */
704 fprintf(stderr
, "Runtime error: %s", "Assert failed");
705 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 128);
708 ((void (*)(val
*, val
*))(var_n
->class->vft
[COLOR_modelize_property__APropdef__mpropdef_61d
]))(var_n
, var_m
) /* mpropdef= on <var_n:APropdef>*/;
709 var3
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
710 var4
= ((val
* (*)(val
*))(var3
->class->vft
[COLOR_modelbuilder__ToolContext__modelbuilder
]))(var3
) /* modelbuilder on <var3:ToolContext>*/;
711 var5
= ((val
* (*)(val
*))(var4
->class->vft
[COLOR_modelize_property__ModelBuilder__mpropdef2npropdef
]))(var4
) /* mpropdef2npropdef on <var4:ModelBuilder>*/;
712 var6
= ((short int (*)(val
*, val
*))(var5
->class->vft
[COLOR_abstract_collection__MapRead__has_key
]))(var5
, var_m
) /* has_key on <var5:HashMap[MPropDef, APropdef]>*/;
715 fprintf(stderr
, "Runtime error: %s", "Assert failed");
716 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 132);
719 var8
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
720 var9
= ((val
* (*)(val
*))(var8
->class->vft
[COLOR_modelbuilder__ToolContext__modelbuilder
]))(var8
) /* modelbuilder on <var8:ToolContext>*/;
721 var10
= ((val
* (*)(val
*))(var9
->class->vft
[COLOR_modelize_property__ModelBuilder__mpropdef2npropdef
]))(var9
) /* mpropdef2npropdef on <var9:ModelBuilder>*/;
722 ((void (*)(val
*, val
*, val
*))(var10
->class->vft
[COLOR_abstract_collection__Map___91d_93d_61d
]))(var10
, var_m
, var_n
) /* []= on <var10:HashMap[MPropDef, APropdef]>*/;
723 var11
= ((val
* (*)(val
*))(var_m
->class->vft
[COLOR_model__MPropDef__mclassdef
]))(var_m
) /* mclassdef on <var_m:MPropDef>*/;
724 var_mclassdef
= var11
;
725 var12
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
726 var13
= ((val
* (*)(val
*))(var12
->class->vft
[COLOR_modelbuilder__ToolContext__modelbuilder
]))(var12
) /* modelbuilder on <var12:ToolContext>*/;
727 var14
= ((val
* (*)(val
*))(var13
->class->vft
[COLOR_modelize_class__ModelBuilder__mclassdef2nclassdef
]))(var13
) /* mclassdef2nclassdef on <var13:ModelBuilder>*/;
728 var15
= ((val
* (*)(val
*, val
*))(var14
->class->vft
[COLOR_abstract_collection__MapRead___91d_93d
]))(var14
, var_mclassdef
) /* [] on <var14:HashMap[MClassDef, AClassdef]>*/;
729 var_nclassdef
= var15
;
730 var16
= ((val
* (*)(val
*))(var_nclassdef
->class->vft
[COLOR_modelize_class__AClassdef__mclassdef
]))(var_nclassdef
) /* mclassdef on <var_nclassdef:AClassdef>*/;
732 var17
= 0; /* <var_mclassdef:MClassDef> cannot be null */
734 var17
= ((short int (*)(val
*, val
*))(var16
->class->vft
[COLOR_kernel__Object___61d_61d
]))(var16
, var_mclassdef
) /* == on <var16:nullable MClassDef>*/;
737 fprintf(stderr
, "Runtime error: %s", "Assert failed");
738 fprintf(stderr
, " (%s:%d)\n", "src/cached.nit", 138);
741 var18
= ((val
* (*)(val
*))(var_nclassdef
->class->vft
[COLOR_parser_nodes__AClassdef__n_propdefs
]))(var_nclassdef
) /* n_propdefs on <var_nclassdef:AClassdef>*/;
742 var19
= ((short int (*)(val
*, val
*))(var18
->class->vft
[COLOR_abstract_collection__Collection__has
]))(var18
, var_n
) /* has on <var18:ANodes[APropdef]>*/;
745 var21
= ((val
* (*)(val
*))(var_nclassdef
->class->vft
[COLOR_parser_nodes__AClassdef__n_propdefs
]))(var_nclassdef
) /* n_propdefs on <var_nclassdef:AClassdef>*/;
746 ((void (*)(val
*, val
*))(var21
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var21
, var_n
) /* add on <var21:ANodes[APropdef]>*/;
751 /* method cached#CachedPhase#associate_propdef for (self: Object, MPropDef, APropdef) */
752 void VIRTUAL_cached__CachedPhase__associate_propdef(val
* self
, val
* p0
, val
* p1
) {
753 cached__CachedPhase__associate_propdef(self
, p0
, p1
);