MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / ArrayBuiltinAny

Class ArrayBuiltinAny

src/hx/cppia/ArrayVirtual.cpp:157–887  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155
156template<int FUNC,int OP>
157struct ArrayBuiltinAny : public ArrayBuiltinBase
158{
159
160
161
162 ArrayBuiltinAny(CppiaExpr *inSrc, CppiaExpr *inThisExpr, Expressions &ioExpressions)
163 : ArrayBuiltinBase(inSrc,inThisExpr,ioExpressions)
164 {
165 }
166 const char *getName() HXCPP_OVERRIDE { return gArrayFuncNames[FUNC]; }
167
168 int runInt(CppiaCtx *ctx) HXCPP_OVERRIDE
169 {
170 if (FUNC==afPush)
171 {
172 ArrayAnyImpl *thisVal = (ArrayAnyImpl *)thisExpr->runObject(ctx);
173 BCR_CHECK;
174 hx::Object * val = args[0]->runObject(ctx);
175 BCR_CHECK;
176 return thisVal->CALL(push)(Dynamic(val));
177 }
178 if (FUNC==afContains)
179 {
180 ArrayAnyImpl *thisVal = (ArrayAnyImpl *)thisExpr->runObject(ctx);
181 BCR_CHECK;
182 hx::Object * val = args[0]->runObject(ctx);
183 BCR_CHECK;
184 return thisVal->CALL(contains)(val);
185 }
186 if (FUNC==afRemove)
187 {
188 ArrayAnyImpl *thisVal = (ArrayAnyImpl *)thisExpr->runObject(ctx);
189 BCR_CHECK;
190 hx::Object * val = args[0]->runObject(ctx);
191 BCR_CHECK;
192 return thisVal->CALL(remove)(val);
193 }
194 if (FUNC==afIndexOf)
195 {
196 ArrayAnyImpl *thisVal = (ArrayAnyImpl *)thisExpr->runObject(ctx);
197 BCR_CHECK;
198 Dynamic a0 = args[0]->runObject(ctx);
199 BCR_CHECK;
200 hx::Object *a1 = args[1]->runObject(ctx);
201 BCR_CHECK;
202 return thisVal->CALL(indexOf)( a0, a1 );
203 }
204 if (FUNC==afLastIndexOf)
205 {
206 ArrayAnyImpl *thisVal = (ArrayAnyImpl *)thisExpr->runObject(ctx);
207 BCR_CHECK;
208 Dynamic a0 = args[0]->runObject(ctx);
209 BCR_CHECK;
210 hx::Object *a1 = args[1]->runObject(ctx);
211 BCR_CHECK;
212 return thisVal->CALL(lastIndexOf)( a0, a1 );
213 }
214

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected