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

Method runObject

src/hx/cppia/ArrayVirtual.cpp:246–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244 }
245
246 hx::Object *runObject(CppiaCtx *ctx) HXCPP_OVERRIDE
247 {
248 if (FUNC==afPush || FUNC==afContains || FUNC==afRemove || FUNC==afIndexOf || FUNC==afLastIndexOf)
249 return Dynamic(runInt(ctx)).mPtr;
250
251 if (FUNC==afRemove)
252 return Dynamic((bool)runInt(ctx)).mPtr;
253
254 if (FUNC==afJoin || FUNC==afToString)
255 return Dynamic(runString(ctx)).mPtr;
256
257 if (FUNC==afSort || FUNC==afInsert || FUNC==afUnshift || FUNC==af__SetSizeExact || FUNC==afBlit)
258 {
259 runVoid(ctx);
260 return 0;
261 }
262
263
264 ArrayAnyImpl *thisVal = (ArrayAnyImpl *)thisExpr->runObject(ctx);
265 BCR_CHECK;
266 CPPIA_CHECK(thisVal);
267
268 if (FUNC==af__get)
269 {
270 int idx = args[0]->runInt(ctx);
271 BCR_CHECK;
272 return thisVal->__GetItem(idx).mPtr;
273 }
274 if (FUNC==af__set)
275 {
276 int i = args[0]->runInt(ctx);
277 BCR_CHECK;
278 if (OP==aoSet)
279 {
280 Dynamic val = args[1]->runObject(ctx);
281 BCR_CHECK;
282 return thisVal->__SetItem(i, val).mPtr;
283 }
284
285 Dynamic orig = thisVal->__GetItem(i);
286 CPPIA_CHECK(orig.mPtr);
287
288 Dynamic val = args[1]->runObject(ctx);
289 BCR_CHECK;
290 switch(OP)
291 {
292 case aoSet: break;
293
294 case aoAdd:
295 val = orig + val;
296 break;
297 case aoMult:
298 val = orig * val;
299 break;
300 case aoDiv:
301 val = orig / val;
302 break;
303 case aoSub:

Callers 3

runIntMethod · 0.45
runStringMethod · 0.45
runVoidMethod · 0.45

Calls 6

UShrFunction · 0.85
DynamicClass · 0.50
runIntMethod · 0.45
__GetItemMethod · 0.45
__SetItemMethod · 0.45
__ToIntMethod · 0.45

Tested by

no test coverage detected