| 597 | } |
| 598 | |
| 599 | ConstantValue eval(EvalContext& context, const Args& args, SourceRange, |
| 600 | const CallExpression::SystemCallInfo&) const final { |
| 601 | auto lval = args[0]->evalLValue(context); |
| 602 | if (!lval) |
| 603 | return nullptr; |
| 604 | |
| 605 | if (args.size() > 1) { |
| 606 | auto index = args[1]->eval(context); |
| 607 | if (!index) |
| 608 | return nullptr; |
| 609 | |
| 610 | auto target = lval.resolve(); |
| 611 | if (target && target->isMap()) { |
| 612 | // Try to erase the element -- no warning if it doesn't exist. |
| 613 | target->map()->erase(index); |
| 614 | } |
| 615 | } |
| 616 | else { |
| 617 | // No argument means we should empty the array. |
| 618 | lval.store(args[0]->type->getDefaultValue()); |
| 619 | } |
| 620 | return NullConstant; |
| 621 | } |
| 622 | }; |
| 623 | |
| 624 | class AssocArrayExistsMethod : public SystemSubroutine { |
nothing calls this directly
no test coverage detected