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 (%s:%d)\n", "Uninitialized attribute @cached_phase", "src/cached.nit", 26);
15 /* method cached#ToolContext#cached_phase for (self: Object): Phase */
16 val
* VIRTUAL_cached__ToolContext__cached_phase(val
* self
) {
17 val
* var
/* : Phase */;
18 val
* var1
/* : Phase */;
19 var1
= cached__ToolContext__cached_phase(self
);
24 /* method cached#ToolContext#cached_phase= for (self: ToolContext, Phase) */
25 void cached__ToolContext__cached_phase_61d(val
* self
, val
* p0
) {
26 self
->attrs
[COLOR_cached__ToolContext___64dcached_phase
].val
= p0
; /* @cached_phase on <self:ToolContext> */
29 /* method cached#ToolContext#cached_phase= for (self: Object, Phase) */
30 void VIRTUAL_cached__ToolContext__cached_phase_61d(val
* self
, val
* p0
) {
31 cached__ToolContext__cached_phase_61d(self
, p0
);
34 /* method cached#CachedPhase#init for (self: CachedPhase, ToolContext, nullable Collection[Phase]) */
35 void cached__CachedPhase__init(val
* self
, val
* p0
, val
* p1
) {
36 val
* var_toolcontext
/* var toolcontext: ToolContext */;
37 val
* var_depends
/* var depends: nullable Collection[Phase] */;
38 val
* var
/* : POSet[Phase] */;
39 val
* var1
/* : Phase */;
42 ((void (*)(val
*, val
*, val
*))(self
->class->vft
[COLOR_phase__Phase__init
]))(self
, p0
, p1
) /* init on <self:CachedPhase>*/;
43 var
= ((val
* (*)(val
*))(var_toolcontext
->class->vft
[COLOR_phase__ToolContext__phases
]))(var_toolcontext
) /* phases on <var_toolcontext:ToolContext>*/;
44 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>*/;
45 ((void (*)(val
*, val
*, val
*))(var
->class->vft
[COLOR_poset__POSet__add_edge
]))(var
, var1
, self
) /* add_edge on <var:POSet[Phase]>*/;
48 /* method cached#CachedPhase#init for (self: Object, ToolContext, nullable Collection[Phase]) */
49 void VIRTUAL_cached__CachedPhase__init(val
* self
, val
* p0
, val
* p1
) {
50 cached__CachedPhase__init(self
, p0
, p1
);
53 /* method cached#CachedPhase#process_annotated_node for (self: CachedPhase, ANode, AAnnotation) */
54 void cached__CachedPhase__process_annotated_node(val
* self
, val
* p0
, val
* p1
) {
55 val
* var_npropdef
/* var npropdef: ANode */;
56 val
* var_nat
/* var nat: AAnnotation */;
57 val
* var
/* : AAtid */;
58 val
* var1
/* : Token */;
59 val
* var2
/* : String */;
61 val
* var3
/* : String */;
62 char* var4
/* : NativeString */;
63 long var5
/* : Int */;
64 val
* var6
/* : String */;
65 short int var7
/* : Bool */;
66 val
* var8
/* : ToolContext */;
67 val
* var9
/* : ModelBuilder */;
68 val
* var_modelbuilder
/* var modelbuilder: ModelBuilder */;
69 short int var10
/* : Bool */;
72 short int var11
/* : Bool */;
73 static val
* varonce12
;
74 val
* var13
/* : String */;
75 char* var14
/* : NativeString */;
76 long var15
/* : Int */;
77 val
* var16
/* : String */;
78 val
* var17
/* : nullable MPropDef */;
79 val
* var_mpropdef
/* var mpropdef: MMethodDef */;
80 val
* var18
/* : nullable MSignature */;
81 val
* var19
/* : nullable MType */;
82 val
* var_mtype
/* var mtype: nullable MType */;
83 val
* var20
/* : null */;
84 short int var21
/* : Bool */;
85 static val
* varonce22
;
86 val
* var23
/* : String */;
87 char* var24
/* : NativeString */;
88 long var25
/* : Int */;
89 val
* var26
/* : String */;
90 val
* var27
/* : nullable ASignature */;
91 val
* var28
/* : ANodes[AParam] */;
92 short int var29
/* : Bool */;
93 short int var30
/* : Bool */;
94 static val
* varonce31
;
95 val
* var32
/* : String */;
96 char* var33
/* : NativeString */;
97 long var34
/* : Int */;
98 val
* var35
/* : String */;
99 val
* var36
/* : Location */;
100 val
* var_location
/* var location: Location */;
101 val
* var37
/* : MProperty */;
102 val
* var38
/* : String */;
103 val
* var_name
/* var name: String */;
104 val
* var39
/* : nullable ANode */;
105 short int var40
/* : Bool */;
108 val
* var_nclassdef
/* var nclassdef: AStdClassdef */;
109 val
* var43
/* : nullable MClassDef */;
110 val
* var_mclassdef
/* var mclassdef: MClassDef */;
111 val
* var44
/* : MAttributeDef */;
112 val
* var45
/* : MAttribute */;
113 val
* var46
/* : Array[Object] */;
114 long var47
/* : Int */;
115 val
* var_
/* var : Array[Object] */;
116 static val
* varonce48
;
117 val
* var49
/* : String */;
118 char* var50
/* : NativeString */;
119 long var51
/* : Int */;
120 val
* var52
/* : String */;
121 static val
* varonce53
;
122 val
* var54
/* : String */;
123 char* var55
/* : NativeString */;
124 long var56
/* : Int */;
125 val
* var57
/* : String */;
126 val
* var58
/* : String */;
127 val
* var59
/* : MVisibility */;
128 val
* var_cache_mpropdef
/* var cache_mpropdef: MAttributeDef */;
129 val
* var60
/* : MType */;
130 val
* var61
/* : MAttributeDef */;
131 val
* var62
/* : MAttribute */;
132 val
* var63
/* : Array[Object] */;
133 long var64
/* : Int */;
134 val
* var_65
/* var : Array[Object] */;
135 static val
* varonce66
;
136 val
* var67
/* : String */;
137 char* var68
/* : NativeString */;
138 long var69
/* : Int */;
139 val
* var70
/* : String */;
140 static val
* varonce71
;
141 val
* var72
/* : String */;
142 char* var73
/* : NativeString */;
143 long var74
/* : Int */;
144 val
* var75
/* : String */;
145 val
* var76
/* : String */;
146 val
* var77
/* : MVisibility */;
147 val
* var_is_cached_mpropdef
/* var is_cached_mpropdef: MAttributeDef */;
148 val
* var78
/* : MModule */;
149 static val
* varonce79
;
150 val
* var80
/* : String */;
151 char* var81
/* : NativeString */;
152 long var82
/* : Int */;
153 val
* var83
/* : String */;
154 val
* var84
/* : MClass */;
155 val
* var85
/* : MClassType */;
156 val
* var86
/* : ToolContext */;
157 static val
* varonce87
;
158 val
* var88
/* : String */;
159 char* var89
/* : NativeString */;
160 long var90
/* : Int */;
161 val
* var91
/* : String */;
162 val
* var92
/* : APropdef */;
163 short int var93
/* : Bool */;
166 val
* var_is_cached_npropdef
/* var is_cached_npropdef: AAttrPropdef */;
167 val
* var96
/* : MMethodDef */;
168 val
* var97
/* : MMethod */;
169 val
* var98
/* : Array[Object] */;
170 long var99
/* : Int */;
171 val
* var_100
/* var : Array[Object] */;
172 static val
* varonce101
;
173 val
* var102
/* : String */;
174 char* var103
/* : NativeString */;
175 long var104
/* : Int */;
176 val
* var105
/* : String */;
177 static val
* varonce106
;
178 val
* var107
/* : String */;
179 char* var108
/* : NativeString */;
180 long var109
/* : Int */;
181 val
* var110
/* : String */;
182 val
* var111
/* : String */;
183 val
* var112
/* : MVisibility */;
184 val
* var_real_mpropdef
/* var real_mpropdef: MMethodDef */;
185 val
* var113
/* : nullable MSignature */;
186 val
* var114
/* : ToolContext */;
187 static val
* varonce115
;
188 val
* var116
/* : String */;
189 char* var117
/* : NativeString */;
190 long var118
/* : Int */;
191 val
* var119
/* : String */;
192 val
* var120
/* : APropdef */;
193 short int var121
/* : Bool */;
196 val
* var_real_npropdef
/* var real_npropdef: AConcreteMethPropdef */;
197 val
* var124
/* : nullable AExpr */;
198 val
* var_real_body
/* var real_body: AExpr */;
199 val
* var125
/* : ToolContext */;
200 static val
* varonce126
;
201 val
* var127
/* : String */;
202 char* var128
/* : NativeString */;
203 long var129
/* : Int */;
204 val
* var130
/* : String */;
205 val
* var131
/* : AExpr */;
206 val
* var_proxy_body
/* var proxy_body: AExpr */;
207 static val
* varonce132
;
208 val
* var133
/* : String */;
209 char* var134
/* : NativeString */;
210 long var135
/* : Int */;
211 val
* var136
/* : String */;
212 val
* var137
/* : Array[Token] */;
213 val
* var138
/* : nullable Object */;
214 val
* var139
/* : MProperty */;
215 val
* var140
/* : String */;
216 static val
* varonce141
;
217 val
* var142
/* : String */;
218 char* var143
/* : NativeString */;
219 long var144
/* : Int */;
220 val
* var145
/* : String */;
221 val
* var146
/* : Array[Token] */;
222 val
* var147
/* : nullable Object */;
223 val
* var148
/* : MProperty */;
224 val
* var149
/* : String */;
225 static val
* varonce150
;
226 val
* var151
/* : String */;
227 char* var152
/* : NativeString */;
228 long var153
/* : Int */;
229 val
* var154
/* : String */;
230 val
* var155
/* : Array[Token] */;
231 val
* var156
/* : nullable Object */;
232 val
* var157
/* : MProperty */;
233 val
* var158
/* : String */;
234 static val
* varonce159
;
235 val
* var160
/* : String */;
236 char* var161
/* : NativeString */;
237 long var162
/* : Int */;
238 val
* var163
/* : String */;
239 val
* var164
/* : Array[Token] */;
240 val
* var165
/* : nullable Object */;
241 val
* var166
/* : MProperty */;
242 val
* var167
/* : String */;
243 static val
* varonce168
;
244 val
* var169
/* : String */;
245 char* var170
/* : NativeString */;
246 long var171
/* : Int */;
247 val
* var172
/* : String */;
248 val
* var173
/* : Array[Token] */;
249 val
* var174
/* : nullable Object */;
250 val
* var175
/* : MProperty */;
251 val
* var176
/* : String */;
252 val
* var177
/* : nullable AExpr */;
255 var
= ((val
* (*)(val
*))(var_nat
->class->vft
[COLOR_parser_nodes__AAnnotation__n_atid
]))(var_nat
) /* n_atid on <var_nat:AAnnotation>*/;
256 var1
= ((val
* (*)(val
*))(var
->class->vft
[COLOR_parser_nodes__AAtid__n_id
]))(var
) /* n_id on <var:AAtid>*/;
257 var2
= ((val
* (*)(val
*))(var1
->class->vft
[COLOR_parser_nodes__Token__text
]))(var1
) /* text on <var1:Token>*/;
263 var6
= string__NativeString__to_s_with_length(var4
, var5
);
267 var7
= ((short int (*)(val
*, val
*))(var2
->class->vft
[COLOR_kernel__Object___33d_61d
]))(var2
, var3
) /* != on <var2:String>*/;
272 var8
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
273 var9
= ((val
* (*)(val
*))(var8
->class->vft
[COLOR_modelbuilder__ToolContext__modelbuilder
]))(var8
) /* modelbuilder on <var8:ToolContext>*/;
274 var_modelbuilder
= var9
;
275 /* <var_npropdef:ANode> isa AConcreteMethPropdef */
276 cltype
= type_parser_nodes__AConcreteMethPropdef
.color
;
277 idtype
= type_parser_nodes__AConcreteMethPropdef
.id
;
278 if(cltype
>= var_npropdef
->type
->table_size
) {
281 var10
= var_npropdef
->type
->type_table
[cltype
] == idtype
;
288 var14
= "Syntax error: only a function can be cached.";
290 var16
= string__NativeString__to_s_with_length(var14
, var15
);
294 ((void (*)(val
*, val
*, val
*))(var_modelbuilder
->class->vft
[COLOR_modelbuilder__ModelBuilder__error
]))(var_modelbuilder
, var_npropdef
, var13
) /* error on <var_modelbuilder:ModelBuilder>*/;
298 var17
= ((val
* (*)(val
*))(var_npropdef
->class->vft
[COLOR_modelize_property__APropdef__mpropdef
]))(var_npropdef
) /* mpropdef on <var_npropdef:ANode(AConcreteMethPropdef)>*/;
300 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Cast failed", "src/cached.nit", 54);
303 var_mpropdef
= var17
;
304 var18
= ((val
* (*)(val
*))(var_mpropdef
->class->vft
[COLOR_model__MMethodDef__msignature
]))(var_mpropdef
) /* msignature on <var_mpropdef:MMethodDef>*/;
306 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Reciever is null", "src/cached.nit", 56);
309 var19
= ((val
* (*)(val
*))(var18
->class->vft
[COLOR_model__MSignature__return_mtype
]))(var18
) /* return_mtype on <var18:nullable MSignature>*/;
313 if (var_mtype
== NULL
) {
314 var21
= 1; /* is null */
316 var21
= 0; /* arg is null but recv is not */
322 var24
= "Syntax error: only a function can be cached.";
324 var26
= string__NativeString__to_s_with_length(var24
, var25
);
328 ((void (*)(val
*, val
*, val
*))(var_modelbuilder
->class->vft
[COLOR_modelbuilder__ModelBuilder__error
]))(var_modelbuilder
, var_npropdef
, var23
) /* error on <var_modelbuilder:ModelBuilder>*/;
332 var27
= ((val
* (*)(val
*))(var_npropdef
->class->vft
[COLOR_parser_nodes__AMethPropdef__n_signature
]))(var_npropdef
) /* n_signature on <var_npropdef:ANode(AConcreteMethPropdef)>*/;
334 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Reciever is null", "src/cached.nit", 62);
337 var28
= ((val
* (*)(val
*))(var27
->class->vft
[COLOR_parser_nodes__ASignature__n_params
]))(var27
) /* n_params on <var27:nullable ASignature>*/;
339 var29
= ((short int (*)(val
*))(var28
->class->vft
[COLOR_abstract_collection__Collection__is_empty
]))(var28
) /* is_empty on <var28:ANodes[AParam]>*/;
345 var33
= "Syntax error: only a function without arguments can be cached.";
347 var35
= string__NativeString__to_s_with_length(var33
, var34
);
351 ((void (*)(val
*, val
*, val
*))(var_modelbuilder
->class->vft
[COLOR_modelbuilder__ModelBuilder__error
]))(var_modelbuilder
, var_npropdef
, var32
) /* error on <var_modelbuilder:ModelBuilder>*/;
355 var36
= ((val
* (*)(val
*))(var_npropdef
->class->vft
[COLOR_parser_nodes__ANode__location
]))(var_npropdef
) /* location on <var_npropdef:ANode(AConcreteMethPropdef)>*/;
356 var_location
= var36
;
357 var37
= ((val
* (*)(val
*))(var_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_mpropdef
) /* mproperty on <var_mpropdef:MMethodDef>*/;
358 var38
= ((val
* (*)(val
*))(var37
->class->vft
[COLOR_model__MProperty__name
]))(var37
) /* name on <var37:MProperty(MMethod)>*/;
360 var39
= ((val
* (*)(val
*))(var_npropdef
->class->vft
[COLOR_parser_nodes__ANode__parent
]))(var_npropdef
) /* parent on <var_npropdef:ANode(AConcreteMethPropdef)>*/;
361 /* <var39:nullable ANode> isa AStdClassdef */
362 cltype41
= type_parser_nodes__AStdClassdef
.color
;
363 idtype42
= type_parser_nodes__AStdClassdef
.id
;
367 if(cltype41
>= var39
->type
->table_size
) {
370 var40
= var39
->type
->type_table
[cltype41
] == idtype42
;
374 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Cast failed", "src/cached.nit", 71);
377 var_nclassdef
= var39
;
378 var43
= ((val
* (*)(val
*))(var_nclassdef
->class->vft
[COLOR_modelize_class__AClassdef__mclassdef
]))(var_nclassdef
) /* mclassdef on <var_nclassdef:AStdClassdef>*/;
380 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Cast failed", "src/cached.nit", 72);
383 var_mclassdef
= var43
;
384 var44
= NEW_model__MAttributeDef(&type_model__MAttributeDef
);
385 var45
= NEW_model__MAttribute(&type_model__MAttribute
);
386 var46
= NEW_array__Array(&type_array__Arraykernel__Object
);
388 ((void (*)(val
*, long))(var46
->class->vft
[COLOR_array__Array__with_capacity
]))(var46
, var47
) /* with_capacity on <var46:Array[Object]>*/;
389 CHECK_NEW_array__Array(var46
);
396 var52
= string__NativeString__to_s_with_length(var50
, var51
);
400 ((void (*)(val
*, val
*))(var_
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_
, var49
) /* add on <var_:Array[Object]>*/;
401 ((void (*)(val
*, val
*))(var_
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_
, var_name
) /* add on <var_:Array[Object]>*/;
407 var57
= string__NativeString__to_s_with_length(var55
, var56
);
411 ((void (*)(val
*, val
*))(var_
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_
, var54
) /* add on <var_:Array[Object]>*/;
412 var58
= ((val
* (*)(val
*))(var_
->class->vft
[COLOR_string__Object__to_s
]))(var_
) /* to_s on <var_:Array[Object]>*/;
413 var59
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_model_base__Object__private_visibility
]))(self
) /* private_visibility on <self:CachedPhase>*/;
414 ((void (*)(val
*, val
*, val
*, val
*))(var45
->class->vft
[COLOR_model__MAttribute__init
]))(var45
, var_mclassdef
, var58
, var59
) /* init on <var45:MAttribute>*/;
415 CHECK_NEW_model__MAttribute(var45
);
416 ((void (*)(val
*, val
*, val
*, val
*))(var44
->class->vft
[COLOR_model__MAttributeDef__init
]))(var44
, var_mclassdef
, var45
, var_location
) /* init on <var44:MAttributeDef>*/;
417 CHECK_NEW_model__MAttributeDef(var44
);
418 var_cache_mpropdef
= var44
;
419 var60
= ((val
* (*)(val
*))(var_mtype
->class->vft
[COLOR_model__MType__as_nullable
]))(var_mtype
) /* as_nullable on <var_mtype:nullable MType(MType)>*/;
420 ((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>*/;
421 var61
= NEW_model__MAttributeDef(&type_model__MAttributeDef
);
422 var62
= NEW_model__MAttribute(&type_model__MAttribute
);
423 var63
= NEW_array__Array(&type_array__Arraykernel__Object
);
425 ((void (*)(val
*, long))(var63
->class->vft
[COLOR_array__Array__with_capacity
]))(var63
, var64
) /* with_capacity on <var63:Array[Object]>*/;
426 CHECK_NEW_array__Array(var63
);
433 var70
= string__NativeString__to_s_with_length(var68
, var69
);
437 ((void (*)(val
*, val
*))(var_65
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_65
, var67
) /* add on <var_65:Array[Object]>*/;
438 ((void (*)(val
*, val
*))(var_65
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_65
, var_name
) /* add on <var_65:Array[Object]>*/;
442 var73
= "<is_cached>";
444 var75
= string__NativeString__to_s_with_length(var73
, var74
);
448 ((void (*)(val
*, val
*))(var_65
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_65
, var72
) /* add on <var_65:Array[Object]>*/;
449 var76
= ((val
* (*)(val
*))(var_65
->class->vft
[COLOR_string__Object__to_s
]))(var_65
) /* to_s on <var_65:Array[Object]>*/;
450 var77
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_model_base__Object__private_visibility
]))(self
) /* private_visibility on <self:CachedPhase>*/;
451 ((void (*)(val
*, val
*, val
*, val
*))(var62
->class->vft
[COLOR_model__MAttribute__init
]))(var62
, var_mclassdef
, var76
, var77
) /* init on <var62:MAttribute>*/;
452 CHECK_NEW_model__MAttribute(var62
);
453 ((void (*)(val
*, val
*, val
*, val
*))(var61
->class->vft
[COLOR_model__MAttributeDef__init
]))(var61
, var_mclassdef
, var62
, var_location
) /* init on <var61:MAttributeDef>*/;
454 CHECK_NEW_model__MAttributeDef(var61
);
455 var_is_cached_mpropdef
= var61
;
456 var78
= ((val
* (*)(val
*))(var_mclassdef
->class->vft
[COLOR_model__MClassDef__mmodule
]))(var_mclassdef
) /* mmodule on <var_mclassdef:MClassDef>*/;
462 var83
= string__NativeString__to_s_with_length(var81
, var82
);
466 var84
= ((val
* (*)(val
*, val
*))(var78
->class->vft
[COLOR_model__MModule__get_primitive_class
]))(var78
, var80
) /* get_primitive_class on <var78:MModule>*/;
467 var85
= ((val
* (*)(val
*))(var84
->class->vft
[COLOR_model__MClass__mclass_type
]))(var84
) /* mclass_type on <var84:MClass>*/;
468 ((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>*/;
469 var86
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
473 var89
= "var is_cached = false";
475 var91
= string__NativeString__to_s_with_length(var89
, var90
);
479 var92
= ((val
* (*)(val
*, val
*))(var86
->class->vft
[COLOR_parser_util__ToolContext__parse_propdef
]))(var86
, var88
) /* parse_propdef on <var86:ToolContext>*/;
480 /* <var92:APropdef> isa AAttrPropdef */
481 cltype94
= type_parser_nodes__AAttrPropdef
.color
;
482 idtype95
= type_parser_nodes__AAttrPropdef
.id
;
483 if(cltype94
>= var92
->type
->table_size
) {
486 var93
= var92
->type
->type_table
[cltype94
] == idtype95
;
489 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Cast failed", "src/cached.nit", 83);
492 var_is_cached_npropdef
= var92
;
493 ((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>*/;
494 var96
= NEW_model__MMethodDef(&type_model__MMethodDef
);
495 var97
= NEW_model__MMethod(&type_model__MMethod
);
496 var98
= NEW_array__Array(&type_array__Arraykernel__Object
);
498 ((void (*)(val
*, long))(var98
->class->vft
[COLOR_array__Array__with_capacity
]))(var98
, var99
) /* with_capacity on <var98:Array[Object]>*/;
499 CHECK_NEW_array__Array(var98
);
506 var105
= string__NativeString__to_s_with_length(var103
, var104
);
510 ((void (*)(val
*, val
*))(var_100
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_100
, var102
) /* add on <var_100:Array[Object]>*/;
511 ((void (*)(val
*, val
*))(var_100
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_100
, var_name
) /* add on <var_100:Array[Object]>*/;
517 var110
= string__NativeString__to_s_with_length(var108
, var109
);
521 ((void (*)(val
*, val
*))(var_100
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var_100
, var107
) /* add on <var_100:Array[Object]>*/;
522 var111
= ((val
* (*)(val
*))(var_100
->class->vft
[COLOR_string__Object__to_s
]))(var_100
) /* to_s on <var_100:Array[Object]>*/;
523 var112
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_model_base__Object__private_visibility
]))(self
) /* private_visibility on <self:CachedPhase>*/;
524 ((void (*)(val
*, val
*, val
*, val
*))(var97
->class->vft
[COLOR_model__MMethod__init
]))(var97
, var_mclassdef
, var111
, var112
) /* init on <var97:MMethod>*/;
525 CHECK_NEW_model__MMethod(var97
);
526 ((void (*)(val
*, val
*, val
*, val
*))(var96
->class->vft
[COLOR_model__MMethodDef__init
]))(var96
, var_mclassdef
, var97
, var_location
) /* init on <var96:MMethodDef>*/;
527 CHECK_NEW_model__MMethodDef(var96
);
528 var_real_mpropdef
= var96
;
529 var113
= ((val
* (*)(val
*))(var_mpropdef
->class->vft
[COLOR_model__MMethodDef__msignature
]))(var_mpropdef
) /* msignature on <var_mpropdef:MMethodDef>*/;
530 ((void (*)(val
*, val
*))(var_real_mpropdef
->class->vft
[COLOR_model__MMethodDef__msignature_61d
]))(var_real_mpropdef
, var113
) /* msignature= on <var_real_mpropdef:MMethodDef>*/;
531 var114
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
535 var117
= "fun real do end";
537 var119
= string__NativeString__to_s_with_length(var117
, var118
);
541 var120
= ((val
* (*)(val
*, val
*))(var114
->class->vft
[COLOR_parser_util__ToolContext__parse_propdef
]))(var114
, var116
) /* parse_propdef on <var114:ToolContext>*/;
542 /* <var120:APropdef> isa AConcreteMethPropdef */
543 cltype122
= type_parser_nodes__AConcreteMethPropdef
.color
;
544 idtype123
= type_parser_nodes__AConcreteMethPropdef
.id
;
545 if(cltype122
>= var120
->type
->table_size
) {
548 var121
= var120
->type
->type_table
[cltype122
] == idtype123
;
551 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Cast failed", "src/cached.nit", 90);
554 var_real_npropdef
= var120
;
555 ((void (*)(val
*, val
*, val
*))(self
->class->vft
[COLOR_cached__CachedPhase__associate_propdef
]))(self
, var_real_mpropdef
, var_real_npropdef
) /* associate_propdef on <self:CachedPhase>*/;
556 var124
= ((val
* (*)(val
*))(var_npropdef
->class->vft
[COLOR_parser_nodes__AConcreteMethPropdef__n_block
]))(var_npropdef
) /* n_block on <var_npropdef:ANode(AConcreteMethPropdef)>*/;
557 if (var124
== NULL
) {
558 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Cast failed", "src/cached.nit", 95);
561 var_real_body
= var124
;
562 var125
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
566 var128
= "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";
568 var130
= string__NativeString__to_s_with_length(var128
, var129
);
572 var131
= ((val
* (*)(val
*, val
*))(var125
->class->vft
[COLOR_parser_util__ToolContext__parse_stmts
]))(var125
, var127
) /* parse_stmts on <var125:ToolContext>*/;
573 var_proxy_body
= var131
;
574 ((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>*/;
578 var134
= "_is_cached";
580 var136
= string__NativeString__to_s_with_length(var134
, var135
);
584 var137
= ((val
* (*)(val
*, val
*))(var_proxy_body
->class->vft
[COLOR_parser_util__ANode__collect_tokens_by_text
]))(var_proxy_body
, var133
) /* collect_tokens_by_text on <var_proxy_body:AExpr>*/;
585 var138
= ((val
* (*)(val
*))(var137
->class->vft
[COLOR_abstract_collection__Collection__first
]))(var137
) /* first on <var137:Array[Token]>*/;
586 var139
= ((val
* (*)(val
*))(var_is_cached_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_is_cached_mpropdef
) /* mproperty on <var_is_cached_mpropdef:MAttributeDef>*/;
587 var140
= ((val
* (*)(val
*))(var139
->class->vft
[COLOR_model__MProperty__name
]))(var139
) /* name on <var139:MProperty(MAttribute)>*/;
588 ((void (*)(val
*, val
*))(var138
->class->vft
[COLOR_parser_nodes__Token__text_61d
]))(var138
, var140
) /* text= on <var138:nullable Object(Token)>*/;
592 var143
= "_is_cached_write";
594 var145
= string__NativeString__to_s_with_length(var143
, var144
);
598 var146
= ((val
* (*)(val
*, val
*))(var_proxy_body
->class->vft
[COLOR_parser_util__ANode__collect_tokens_by_text
]))(var_proxy_body
, var142
) /* collect_tokens_by_text on <var_proxy_body:AExpr>*/;
599 var147
= ((val
* (*)(val
*))(var146
->class->vft
[COLOR_abstract_collection__Collection__first
]))(var146
) /* first on <var146:Array[Token]>*/;
600 var148
= ((val
* (*)(val
*))(var_is_cached_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_is_cached_mpropdef
) /* mproperty on <var_is_cached_mpropdef:MAttributeDef>*/;
601 var149
= ((val
* (*)(val
*))(var148
->class->vft
[COLOR_model__MProperty__name
]))(var148
) /* name on <var148:MProperty(MAttribute)>*/;
602 ((void (*)(val
*, val
*))(var147
->class->vft
[COLOR_parser_nodes__Token__text_61d
]))(var147
, var149
) /* text= on <var147:nullable Object(Token)>*/;
608 var154
= string__NativeString__to_s_with_length(var152
, var153
);
612 var155
= ((val
* (*)(val
*, val
*))(var_proxy_body
->class->vft
[COLOR_parser_util__ANode__collect_tokens_by_text
]))(var_proxy_body
, var151
) /* collect_tokens_by_text on <var_proxy_body:AExpr>*/;
613 var156
= ((val
* (*)(val
*))(var155
->class->vft
[COLOR_abstract_collection__Collection__first
]))(var155
) /* first on <var155:Array[Token]>*/;
614 var157
= ((val
* (*)(val
*))(var_cache_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_cache_mpropdef
) /* mproperty on <var_cache_mpropdef:MAttributeDef>*/;
615 var158
= ((val
* (*)(val
*))(var157
->class->vft
[COLOR_model__MProperty__name
]))(var157
) /* name on <var157:MProperty(MAttribute)>*/;
616 ((void (*)(val
*, val
*))(var156
->class->vft
[COLOR_parser_nodes__Token__text_61d
]))(var156
, var158
) /* text= on <var156:nullable Object(Token)>*/;
620 var161
= "_cache_write";
622 var163
= string__NativeString__to_s_with_length(var161
, var162
);
626 var164
= ((val
* (*)(val
*, val
*))(var_proxy_body
->class->vft
[COLOR_parser_util__ANode__collect_tokens_by_text
]))(var_proxy_body
, var160
) /* collect_tokens_by_text on <var_proxy_body:AExpr>*/;
627 var165
= ((val
* (*)(val
*))(var164
->class->vft
[COLOR_abstract_collection__Collection__first
]))(var164
) /* first on <var164:Array[Token]>*/;
628 var166
= ((val
* (*)(val
*))(var_cache_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_cache_mpropdef
) /* mproperty on <var_cache_mpropdef:MAttributeDef>*/;
629 var167
= ((val
* (*)(val
*))(var166
->class->vft
[COLOR_model__MProperty__name
]))(var166
) /* name on <var166:MProperty(MAttribute)>*/;
630 ((void (*)(val
*, val
*))(var165
->class->vft
[COLOR_parser_nodes__Token__text_61d
]))(var165
, var167
) /* text= on <var165:nullable Object(Token)>*/;
634 var170
= "call_real";
636 var172
= string__NativeString__to_s_with_length(var170
, var171
);
640 var173
= ((val
* (*)(val
*, val
*))(var_proxy_body
->class->vft
[COLOR_parser_util__ANode__collect_tokens_by_text
]))(var_proxy_body
, var169
) /* collect_tokens_by_text on <var_proxy_body:AExpr>*/;
641 var174
= ((val
* (*)(val
*))(var173
->class->vft
[COLOR_abstract_collection__Collection__first
]))(var173
) /* first on <var173:Array[Token]>*/;
642 var175
= ((val
* (*)(val
*))(var_real_mpropdef
->class->vft
[COLOR_model__MPropDef__mproperty
]))(var_real_mpropdef
) /* mproperty on <var_real_mpropdef:MMethodDef>*/;
643 var176
= ((val
* (*)(val
*))(var175
->class->vft
[COLOR_model__MProperty__name
]))(var175
) /* name on <var175:MProperty(MMethod)>*/;
644 ((void (*)(val
*, val
*))(var174
->class->vft
[COLOR_parser_nodes__Token__text_61d
]))(var174
, var176
) /* text= on <var174:nullable Object(Token)>*/;
645 var177
= ((val
* (*)(val
*))(var_real_npropdef
->class->vft
[COLOR_parser_nodes__AConcreteMethPropdef__n_block
]))(var_real_npropdef
) /* n_block on <var_real_npropdef:AConcreteMethPropdef>*/;
646 if (var177
== NULL
) {
647 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Reciever is null", "src/cached.nit", 115);
650 ((void (*)(val
*, val
*))(var177
->class->vft
[COLOR_parser_nodes__ANode__replace_with
]))(var177
, var_real_body
) /* replace_with on <var177:nullable AExpr>*/;
654 /* method cached#CachedPhase#process_annotated_node for (self: Object, ANode, AAnnotation) */
655 void VIRTUAL_cached__CachedPhase__process_annotated_node(val
* self
, val
* p0
, val
* p1
) {
656 cached__CachedPhase__process_annotated_node(self
, p0
, p1
);
659 /* method cached#CachedPhase#associate_propdef for (self: CachedPhase, MPropDef, APropdef) */
660 void cached__CachedPhase__associate_propdef(val
* self
, val
* p0
, val
* p1
) {
661 val
* var_m
/* var m: MPropDef */;
662 val
* var_n
/* var n: APropdef */;
663 val
* var
/* : nullable MPropDef */;
664 val
* var1
/* : null */;
665 short int var2
/* : Bool */;
666 val
* var3
/* : ToolContext */;
667 val
* var4
/* : ModelBuilder */;
668 val
* var5
/* : HashMap[MPropDef, APropdef] */;
669 short int var6
/* : Bool */;
670 short int var7
/* : Bool */;
671 val
* var8
/* : ToolContext */;
672 val
* var9
/* : ModelBuilder */;
673 val
* var10
/* : HashMap[MPropDef, APropdef] */;
674 val
* var11
/* : MClassDef */;
675 val
* var_mclassdef
/* var mclassdef: MClassDef */;
676 val
* var12
/* : ToolContext */;
677 val
* var13
/* : ModelBuilder */;
678 val
* var14
/* : HashMap[MClassDef, AClassdef] */;
679 val
* var15
/* : nullable Object */;
680 val
* var_nclassdef
/* var nclassdef: AClassdef */;
681 val
* var16
/* : nullable MClassDef */;
682 short int var17
/* : Bool */;
683 val
* var18
/* : ANodes[APropdef] */;
684 short int var19
/* : Bool */;
685 short int var20
/* : Bool */;
686 val
* var21
/* : ANodes[APropdef] */;
689 var
= ((val
* (*)(val
*))(var_n
->class->vft
[COLOR_modelize_property__APropdef__mpropdef
]))(var_n
) /* mpropdef on <var_n:APropdef>*/;
692 var2
= 1; /* is null */
694 var2
= 0; /* arg is null but recv is not */
697 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Assert failed", "src/cached.nit", 128);
700 ((void (*)(val
*, val
*))(var_n
->class->vft
[COLOR_modelize_property__APropdef__mpropdef_61d
]))(var_n
, var_m
) /* mpropdef= on <var_n:APropdef>*/;
701 var3
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
702 var4
= ((val
* (*)(val
*))(var3
->class->vft
[COLOR_modelbuilder__ToolContext__modelbuilder
]))(var3
) /* modelbuilder on <var3:ToolContext>*/;
703 var5
= ((val
* (*)(val
*))(var4
->class->vft
[COLOR_modelize_property__ModelBuilder__mpropdef2npropdef
]))(var4
) /* mpropdef2npropdef on <var4:ModelBuilder>*/;
704 var6
= ((short int (*)(val
*, val
*))(var5
->class->vft
[COLOR_abstract_collection__MapRead__has_key
]))(var5
, var_m
) /* has_key on <var5:HashMap[MPropDef, APropdef]>*/;
707 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Assert failed", "src/cached.nit", 132);
710 var8
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
711 var9
= ((val
* (*)(val
*))(var8
->class->vft
[COLOR_modelbuilder__ToolContext__modelbuilder
]))(var8
) /* modelbuilder on <var8:ToolContext>*/;
712 var10
= ((val
* (*)(val
*))(var9
->class->vft
[COLOR_modelize_property__ModelBuilder__mpropdef2npropdef
]))(var9
) /* mpropdef2npropdef on <var9:ModelBuilder>*/;
713 ((void (*)(val
*, val
*, val
*))(var10
->class->vft
[COLOR_abstract_collection__Map___91d_93d_61d
]))(var10
, var_m
, var_n
) /* []= on <var10:HashMap[MPropDef, APropdef]>*/;
714 var11
= ((val
* (*)(val
*))(var_m
->class->vft
[COLOR_model__MPropDef__mclassdef
]))(var_m
) /* mclassdef on <var_m:MPropDef>*/;
715 var_mclassdef
= var11
;
716 var12
= ((val
* (*)(val
*))(self
->class->vft
[COLOR_phase__Phase__toolcontext
]))(self
) /* toolcontext on <self:CachedPhase>*/;
717 var13
= ((val
* (*)(val
*))(var12
->class->vft
[COLOR_modelbuilder__ToolContext__modelbuilder
]))(var12
) /* modelbuilder on <var12:ToolContext>*/;
718 var14
= ((val
* (*)(val
*))(var13
->class->vft
[COLOR_modelize_class__ModelBuilder__mclassdef2nclassdef
]))(var13
) /* mclassdef2nclassdef on <var13:ModelBuilder>*/;
719 var15
= ((val
* (*)(val
*, val
*))(var14
->class->vft
[COLOR_abstract_collection__MapRead___91d_93d
]))(var14
, var_mclassdef
) /* [] on <var14:HashMap[MClassDef, AClassdef]>*/;
720 var_nclassdef
= var15
;
721 var16
= ((val
* (*)(val
*))(var_nclassdef
->class->vft
[COLOR_modelize_class__AClassdef__mclassdef
]))(var_nclassdef
) /* mclassdef on <var_nclassdef:AClassdef>*/;
723 var17
= 0; /* <var_mclassdef:MClassDef> cannot be null */
725 var17
= ((short int (*)(val
*, val
*))(var16
->class->vft
[COLOR_kernel__Object___61d_61d
]))(var16
, var_mclassdef
) /* == on <var16:nullable MClassDef>*/;
728 fprintf(stderr
, "Runtime error: %s (%s:%d)\n", "Assert failed", "src/cached.nit", 138);
731 var18
= ((val
* (*)(val
*))(var_nclassdef
->class->vft
[COLOR_parser_nodes__AClassdef__n_propdefs
]))(var_nclassdef
) /* n_propdefs on <var_nclassdef:AClassdef>*/;
732 var19
= ((short int (*)(val
*, val
*))(var18
->class->vft
[COLOR_abstract_collection__Collection__has
]))(var18
, var_n
) /* has on <var18:ANodes[APropdef]>*/;
735 var21
= ((val
* (*)(val
*))(var_nclassdef
->class->vft
[COLOR_parser_nodes__AClassdef__n_propdefs
]))(var_nclassdef
) /* n_propdefs on <var_nclassdef:AClassdef>*/;
736 ((void (*)(val
*, val
*))(var21
->class->vft
[COLOR_abstract_collection__SimpleCollection__add
]))(var21
, var_n
) /* add on <var21:ANodes[APropdef]>*/;
741 /* method cached#CachedPhase#associate_propdef for (self: Object, MPropDef, APropdef) */
742 void VIRTUAL_cached__CachedPhase__associate_propdef(val
* self
, val
* p0
, val
* p1
) {
743 cached__CachedPhase__associate_propdef(self
, p0
, p1
);