| 408 | |
| 409 | template<typename ELEM, int FUNC, typename CREMENT> |
| 410 | struct ArrayBuiltin : public ArrayBuiltinBase |
| 411 | { |
| 412 | bool unsafe; |
| 413 | |
| 414 | ArrayBuiltin(CppiaExpr *inSrc, CppiaExpr *inThisExpr, Expressions &ioExpressions, bool inUnsafe) |
| 415 | : ArrayBuiltinBase(inSrc,inThisExpr,ioExpressions) |
| 416 | { |
| 417 | unsafe = inUnsafe; |
| 418 | } |
| 419 | const char *getName() HXCPP_OVERRIDE { return gArrayFuncNames[FUNC]; } |
| 420 | |
| 421 | ExprType getType() HXCPP_OVERRIDE |
| 422 | { |
| 423 | switch(FUNC) |
| 424 | { |
| 425 | case af__get: |
| 426 | case af__set: |
| 427 | case af__crement: |
| 428 | return (ExprType)ExprTypeOf<ELEM>::value; |
| 429 | |
| 430 | case afPop: |
| 431 | //case afUnshift: |
| 432 | if (ExprTypeOf<ELEM>::value==(int)etString) |
| 433 | return etString; |
| 434 | return etObject; |
| 435 | |
| 436 | case afJoin: |
| 437 | case afToString: |
| 438 | return etString; |
| 439 | |
| 440 | case afSort: |
| 441 | case afInsert: |
| 442 | case afUnshift: |
| 443 | case af__SetSizeExact: |
| 444 | case afResize: |
| 445 | return etVoid; |
| 446 | |
| 447 | case afPush: |
| 448 | case afContains: |
| 449 | case afRemove: |
| 450 | case afIndexOf: |
| 451 | case afLastIndexOf: |
| 452 | return etInt; |
| 453 | |
| 454 | default: |
| 455 | return etObject; |
| 456 | } |
| 457 | |
| 458 | return etObject; |
| 459 | } |
| 460 | |
| 461 | |
| 462 | int runInt(CppiaCtx *ctx) HXCPP_OVERRIDE |
| 463 | { |
| 464 | if (FUNC==afPush) |
| 465 | { |
| 466 | Array_obj<ELEM> *thisVal = (Array_obj<ELEM>*)thisExpr->runObject(ctx); |
| 467 | BCR_CHECK; |
nothing calls this directly
no outgoing calls
no test coverage detected