| 782 | |
| 783 | |
| 784 | ResultType Map::__Item(ResultToken &aResultToken, int aID, int aFlags, ExprTokenType *aParam[], int aParamCount) |
| 785 | { |
| 786 | if (!IS_INVOKE_SET) // Get or call. |
| 787 | { |
| 788 | if (!GetItem(aResultToken, *aParam[0])) |
| 789 | { |
| 790 | if (ParamIndexIsOmitted(1)) |
| 791 | { |
| 792 | auto result = Invoke(aResultToken, IT_GET, _T("Default"), ExprTokenType { this }, nullptr, 0); |
| 793 | if (result == INVOKE_NOT_HANDLED) |
| 794 | _o_throw(ERR_NO_KEY, ParamIndexToString(0, _f_number_buf), ErrorPrototype::Key); |
| 795 | return result; |
| 796 | } |
| 797 | // Otherwise, caller provided a default value. |
| 798 | aResultToken.CopyValueFrom(*aParam[1]); |
| 799 | } |
| 800 | if (aResultToken.symbol == SYM_OBJECT) |
| 801 | aResultToken.object->AddRef(); |
| 802 | return OK; |
| 803 | } |
| 804 | else |
| 805 | { |
| 806 | if (!SetItem(*aParam[1], *aParam[0])) |
| 807 | _o_throw_oom; |
| 808 | } |
| 809 | return OK; |
| 810 | } |
| 811 | |
| 812 | |
| 813 | ResultType Map::Set(ResultToken &aResultToken, int aID, int aFlags, ExprTokenType *aParam[], int aParamCount) |
nothing calls this directly
no test coverage detected