| 183 | } |
| 184 | |
| 185 | static bool ArrayAny(const Function::Ptr& function) |
| 186 | { |
| 187 | ScriptFrame *vframe = ScriptFrame::GetCurrentFrame(); |
| 188 | Array::Ptr self = static_cast<Array::Ptr>(vframe->Self); |
| 189 | REQUIRE_NOT_NULL(self); |
| 190 | REQUIRE_NOT_NULL(function); |
| 191 | |
| 192 | if (vframe->Sandboxed && !function->IsSideEffectFree()) |
| 193 | BOOST_THROW_EXCEPTION(ScriptError("Filter function must be side-effect free.")); |
| 194 | |
| 195 | ObjectLock olock(self); |
| 196 | for (const Value& item : self) { |
| 197 | if (function->Invoke({ item })) |
| 198 | return true; |
| 199 | } |
| 200 | |
| 201 | return false; |
| 202 | } |
| 203 | |
| 204 | static bool ArrayAll(const Function::Ptr& function) |
| 205 | { |
nothing calls this directly
no test coverage detected