01379a3f454777d4cac823206b9555c858272c58
[nit.git] / c_src / virtualtype._sep.c
1 /* This C file is generated by NIT to compile module virtualtype. */
2 #include "virtualtype._sep.h"
3 val_t virtualtype___MMGlobalProperty___is_virtual_type(val_t self) {
4 struct trace_t trace = {NULL, LOCATE_virtualtype___MMGlobalProperty___is_virtual_type, 24};
5 val_t variable0;
6 trace.prev = tracehead; tracehead = &trace;
7 variable0 = ((abstractmetamodel___MMGlobalProperty___intro_t)CALL( self,COLOR_abstractmetamodel___MMGlobalProperty___intro))( self) /*MMGlobalProperty::intro*/;
8 variable0 = TAG_Bool((variable0==NIT_NULL) || VAL_ISA(variable0, COLOR_MMTypeProperty, ID_MMTypeProperty)) /*cast MMTypeProperty*/;
9 goto return_label0;
10 return_label0: while(false);
11 tracehead = trace.prev;
12 return variable0;
13 }
14 val_t virtualtype___MMTypeProperty___inherit_to(val_t self, val_t param0) {
15 struct trace_t trace = {NULL, LOCATE_virtualtype___MMTypeProperty___inherit_to, 31};
16 val_t variable0;
17 val_t variable1;
18 trace.prev = tracehead; tracehead = &trace;
19 variable0 = param0;
20 variable1 = NEW_virtualtype___MMImplicitType___init( self, variable0 /*t*/); /*new MMImplicitType*/
21 goto return_label1;
22 return_label1: while(false);
23 tracehead = trace.prev;
24 return variable1;
25 }
26 val_t virtualtype___MMTypeProperty___stype(val_t self) {
27 struct trace_t trace = {NULL, LOCATE_virtualtype___MMTypeProperty___stype, 39};
28 val_t variable0;
29 val_t variable1;
30 trace.prev = tracehead; tracehead = &trace;
31 variable0 = ((static_type___MMLocalProperty___signature_t)CALL( self,COLOR_static_type___MMLocalProperty___signature))( self) /*MMTypeProperty::signature*/;
32 variable0 = TAG_Bool((variable0 == NIT_NULL /*null*/) || ((variable0 != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL(variable0,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN(variable0, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL(variable0,COLOR_kernel___Object_____eqeq))(variable0, NIT_NULL /*null*/) /*MMSignature::==*/)))));
33 if (UNTAG_Bool(variable0)) { /*if*/
34 variable0 = NIT_NULL /*null*/;
35 goto return_label2;
36 }
37 variable1 = ATTR_virtualtype___MMTypeProperty____stype_cache( self) /*MMTypeProperty::_stype_cache*/;
38 variable0 = variable1;
39 variable1 = TAG_Bool(( variable0 /*r*/ == NIT_NULL /*null*/) || (( variable0 /*r*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable0 /*r*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable0 /*r*/, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable0 /*r*/,COLOR_kernel___Object_____eqeq))( variable0 /*r*/, NIT_NULL /*null*/) /*MMVirtualType::==*/)))));
40 if (UNTAG_Bool(variable1)) { /*if*/
41 variable1 = NEW_virtualtype___MMVirtualType___init( self); /*new MMVirtualType*/
42 variable0 = variable1 /*r=*/;
43 ATTR_virtualtype___MMTypeProperty____stype_cache( self) /*MMTypeProperty::_stype_cache*/ = variable0 /*r*/;
44 }
45 variable0 = variable0 /*r*/;
46 goto return_label2;
47 return_label2: while(false);
48 tracehead = trace.prev;
49 return variable0;
50 }
51 val_t virtualtype___MMType___select_virtual_type(val_t self, val_t param0) {
52 struct trace_t trace = {NULL, LOCATE_virtualtype___MMType___select_virtual_type, 55};
53 val_t variable0;
54 val_t variable1;
55 val_t variable2;
56 trace.prev = tracehead; tracehead = &trace;
57 variable0 = param0;
58 variable1 = ((static_type___MMType___local_class_t)CALL( self,COLOR_static_type___MMType___local_class))( self) /*MMType::local_class*/;
59 variable1 = TAG_Bool(!UNTAG_Bool(TAG_Bool((variable1 == NIT_NULL /*null*/) || ((variable1 != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL(variable1,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN(variable1, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL(variable1,COLOR_kernel___Object_____eqeq))(variable1, NIT_NULL /*null*/) /*MMLocalClass::==*/)))))));
60 if (!UNTAG_Bool(variable1)) { fprintf(stderr, "Assert%s failed (%s: %d)\n", "", LOCATE_virtualtype___MMType___select_virtual_type, 58); nit_exit(1);}
61 variable1 = TAG_Bool(!UNTAG_Bool(TAG_Bool(( variable0 /*name*/ == NIT_NULL /*null*/) || (( variable0 /*name*/ != NIT_NULL) && ((((kernel___Object_____eqeq_t)CALL( variable0 /*name*/,COLOR_kernel___Object_____eqeq))==kernel___Object_____eqeq)?(IS_EQUAL_NN( variable0 /*name*/, NIT_NULL /*null*/)):(UNTAG_Bool(((kernel___Object_____eqeq_t)CALL( variable0 /*name*/,COLOR_kernel___Object_____eqeq))( variable0 /*name*/, NIT_NULL /*null*/) /*Symbol::==*/)))))));
62 if (!UNTAG_Bool(variable1)) { fprintf(stderr, "Assert%s failed (%s: %d)\n", "", LOCATE_virtualtype___MMType___select_virtual_type, 59); nit_exit(1);}
63 variable2 = ((static_type___MMType___local_class_t)CALL( self,COLOR_static_type___MMType___local_class))( self) /*MMType::local_class*/;
64 variable2 = ((virtualtype___MMLocalClass___virtual_type_t)CALL(variable2,COLOR_virtualtype___MMLocalClass___virtual_type))(variable2, variable0 /*name*/) /*MMLocalClass::virtual_type*/;
65 variable2 = ((static_type___MMType___select_property_t)CALL( self,COLOR_static_type___MMType___select_property))( self, variable2) /*MMType::select_property*/;
66 variable1 = variable2;
67 variable2 = TAG_Bool(( variable1 /*res*/==NIT_NULL) || VAL_ISA( variable1 /*res*/, COLOR_MMTypeProperty, ID_MMTypeProperty)) /*cast MMTypeProperty*/;
68 if (!UNTAG_Bool(variable2)) { fprintf(stderr, "Assert%s failed (%s: %d)\n", "", LOCATE_virtualtype___MMType___select_virtual_type, 61); nit_exit(1);}
69 variable1 = variable1 /*res*/;
70 goto return_label3;
71 return_label3: while(false);
72 tracehead = trace.prev;
73 return variable1;
74 }
75 val_t virtualtype___MMVirtualType___property(val_t self) {
76 struct trace_t trace = {NULL, LOCATE_virtualtype___MMVirtualType___property, 68};
77 trace.prev = tracehead; tracehead = &trace;
78 tracehead = trace.prev;
79 return ATTR_virtualtype___MMVirtualType____property( self) /*MMVirtualType::_property*/;
80 }
81 void virtualtype___MMVirtualType___init(val_t self, val_t param0, int* init_table) {
82 struct trace_t trace = {NULL, LOCATE_virtualtype___MMVirtualType___init, 71};
83 val_t variable0;
84 val_t variable1;
85 val_t variable2;
86 trace.prev = tracehead; tracehead = &trace;
87 variable0 = param0;
88 if (init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_MMVirtualType].i]) return;
89 variable1 = ((abstractmetamodel___MMLocalProperty___name_t)CALL( variable0 /*p*/,COLOR_abstractmetamodel___MMLocalProperty___name))( variable0 /*p*/) /*MMTypeProperty::name*/;
90 variable2 = ((static_type___MMLocalProperty___signature_t)CALL( variable0 /*p*/,COLOR_static_type___MMLocalProperty___signature))( variable0 /*p*/) /*MMTypeProperty::signature*/;
91 variable2 = ((static_type___MMSignature___return_type_t)CALL(variable2,COLOR_static_type___MMSignature___return_type))(variable2) /*MMSignature::return_type*/;
92 ((type_formal___MMTypeFormal___init_t)CALL( self,COLOR_type_formal___MMTypeFormal___init))( self, variable1, variable2, init_table /*YYY*/) /*MMTypeFormal::init*/;
93 ATTR_virtualtype___MMVirtualType____property( self) /*MMVirtualType::_property*/ = variable0 /*p*/;
94 init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_MMVirtualType].i] = 1;
95 tracehead = trace.prev;
96 return;
97 }
98 val_t virtualtype___MMVirtualType___for_module(val_t self, val_t param0) {
99 struct trace_t trace = {NULL, LOCATE_virtualtype___MMVirtualType___for_module, 77};
100 val_t variable0;
101 val_t variable1;
102 val_t variable2;
103 trace.prev = tracehead; tracehead = &trace;
104 variable0 = param0;
105 variable2 = ATTR_virtualtype___MMVirtualType____property( self) /*MMVirtualType::_property*/;
106 variable2 = ((static_type___MMLocalProperty___signature_t)CALL(variable2,COLOR_static_type___MMLocalProperty___signature))(variable2) /*MMTypeProperty::signature*/;
107 variable2 = ((static_type___MMSignature___recv_t)CALL(variable2,COLOR_static_type___MMSignature___recv))(variable2) /*MMSignature::recv*/;
108 variable2 = ((static_type___MMType___for_module_t)CALL(variable2,COLOR_static_type___MMType___for_module))(variable2, variable0 /*mod*/) /*MMType::for_module*/;
109 variable1 = variable2;
110 variable2 = ((virtualtype___MMVirtualType___adapt_to_t)CALL( self,COLOR_static_type___MMType___adapt_to))( self, variable1 /*recv*/) /*MMVirtualType::adapt_to*/;
111 variable1 = variable2;
112 goto return_label5;
113 return_label5: while(false);
114 tracehead = trace.prev;
115 return variable1;
116 }
117 val_t virtualtype___MMVirtualType___not_for_self(val_t self) {
118 struct trace_t trace = {NULL, LOCATE_virtualtype___MMVirtualType___not_for_self, 83};
119 val_t variable0;
120 trace.prev = tracehead; tracehead = &trace;
121 variable0 = ((type_formal___MMTypeFormal___bound_t)CALL( self,COLOR_type_formal___MMTypeFormal___bound))( self) /*MMVirtualType::bound*/;
122 variable0 = ((static_type___MMType___not_for_self_t)CALL(variable0,COLOR_static_type___MMType___not_for_self))(variable0) /*MMType::not_for_self*/;
123 goto return_label6;
124 return_label6: while(false);
125 tracehead = trace.prev;
126 return variable0;
127 }
128 val_t virtualtype___MMVirtualType___adapt_to(val_t self, val_t param0) {
129 struct trace_t trace = {NULL, LOCATE_virtualtype___MMVirtualType___adapt_to, 88};
130 val_t variable0;
131 val_t variable1;
132 val_t variable2;
133 trace.prev = tracehead; tracehead = &trace;
134 variable0 = param0;
135 variable2 = ATTR_virtualtype___MMVirtualType____property( self) /*MMVirtualType::_property*/;
136 variable2 = ((abstractmetamodel___MMLocalProperty___global_t)CALL(variable2,COLOR_abstractmetamodel___MMLocalProperty___global))(variable2) /*MMTypeProperty::global*/;
137 variable2 = ((static_type___MMType___select_property_t)CALL( variable0 /*recv*/,COLOR_static_type___MMType___select_property))( variable0 /*recv*/, variable2) /*MMType::select_property*/;
138 variable1 = variable2;
139 variable2 = TAG_Bool(( variable1 /*prop*/==NIT_NULL) || VAL_ISA( variable1 /*prop*/, COLOR_MMTypeProperty, ID_MMTypeProperty)) /*cast MMTypeProperty*/;
140 if (!UNTAG_Bool(variable2)) { fprintf(stderr, "Assert%s failed (%s: %d)\n", "", LOCATE_virtualtype___MMVirtualType___adapt_to, 92); nit_exit(1);}
141 variable2 = ((virtualtype___MMTypeProperty___stype_t)CALL( variable1 /*prop*/,COLOR_virtualtype___MMTypeProperty___stype))( variable1 /*prop*/) /*MMTypeProperty::stype*/;
142 variable1 = variable2;
143 goto return_label7;
144 return_label7: while(false);
145 tracehead = trace.prev;
146 return variable1;
147 }
148 val_t virtualtype___MMLocalClass___virtual_type(val_t self, val_t param0) {
149 struct trace_t trace = {NULL, LOCATE_virtualtype___MMLocalClass___virtual_type, 98};
150 val_t variable0;
151 val_t variable1;
152 val_t variable2;
153 trace.prev = tracehead; tracehead = &trace;
154 variable0 = param0;
155 variable2 = ((abstractmetamodel___MMLocalClass___get_property_by_name_t)CALL( self,COLOR_abstractmetamodel___MMLocalClass___get_property_by_name))( self, variable0 /*s*/) /*MMLocalClass::get_property_by_name*/;
156 variable1 = variable2;
157 variable2 = ((virtualtype___MMGlobalProperty___is_virtual_type_t)CALL( variable1 /*prop*/,COLOR_virtualtype___MMGlobalProperty___is_virtual_type))( variable1 /*prop*/) /*MMGlobalProperty::is_virtual_type*/;
158 if (UNTAG_Bool(variable2)) { /*if*/
159 variable1 = variable1 /*prop*/;
160 goto return_label8;
161 }
162 variable1 = NIT_NULL /*null*/;
163 goto return_label8;
164 return_label8: while(false);
165 tracehead = trace.prev;
166 return variable1;
167 }
168 void virtualtype___MMImplicitType___init(val_t self, val_t param0, val_t param1, int* init_table) {
169 struct trace_t trace = {NULL, LOCATE_virtualtype___MMImplicitType___init, 111};
170 val_t variable0;
171 val_t variable1;
172 trace.prev = tracehead; tracehead = &trace;
173 variable0 = param0;
174 variable1 = param1;
175 if (init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_MMImplicitType].i]) return;
176 ((inheritance___MMImplicitProperty___init_t)CALL( self,COLOR_inheritance___MMImplicitProperty___init))( self, param0, param1, init_table /*YYY*/) /*MMImplicitProperty::init*/;
177 init_table[VAL2OBJ( self)->vft[INIT_TABLE_POS_MMImplicitType].i] = 1;
178 tracehead = trace.prev;
179 return;
180 }