| 269 | } |
| 270 | |
| 271 | txFlag fxCheckModuleOptions(txMachine* the, txSlot* options) |
| 272 | { |
| 273 | txFlag moduleFlag = XS_NO_FLAG; |
| 274 | #if mxECMAScript2025 |
| 275 | if (!mxIsUndefined(options)) { |
| 276 | txSlot* with; |
| 277 | if (!mxIsReference(options)) |
| 278 | mxTypeError("options: not an object"); |
| 279 | mxPushSlot(options); |
| 280 | mxGetID(mxID(_with)); |
| 281 | with = the->stack; |
| 282 | if (!mxIsUndefined(with)) { |
| 283 | txSlot* key; |
| 284 | txSlot* property; |
| 285 | txSlot* value; |
| 286 | txInteger count = 0; |
| 287 | if (!mxIsReference(with)) |
| 288 | mxTypeError("options.with: not an object"); |
| 289 | key = fxNewInstance(the); |
| 290 | mxBehaviorOwnKeys(the, with->value.reference, XS_EACH_NAME_FLAG, key); |
| 291 | mxTemporary(property); |
| 292 | while ((key = key->next)) { |
| 293 | if (mxBehaviorGetOwnProperty(the, with->value.reference, key->value.at.id, key->value.at.index, property) && !(property->flag & XS_DONT_ENUM_FLAG)) { |
| 294 | mxPushSlot(with); |
| 295 | mxGetAll(key->value.at.id, key->value.at.index); |
| 296 | value = the->stack; |
| 297 | count++; |
| 298 | if ((value->kind != XS_STRING_KIND) && (value->kind != XS_STRING_X_KIND)) { |
| 299 | mxPop(); |
| 300 | break; |
| 301 | } |
| 302 | if ((key->value.at.id == mxID(_type)) && (!c_strcmp(value->value.string, "json"))) { |
| 303 | count--; |
| 304 | moduleFlag |= XS_JSON_MODULE_FLAG; |
| 305 | } |
| 306 | mxPop(); |
| 307 | } |
| 308 | } |
| 309 | mxPop(); |
| 310 | mxPop(); |
| 311 | if (count > 0) |
| 312 | mxTypeError("options.with: invalid attributes"); |
| 313 | } |
| 314 | mxPop(); |
| 315 | } |
| 316 | #endif |
| 317 | return moduleFlag; |
| 318 | } |
| 319 | |
| 320 | void fxCompleteModule(txMachine* the, txSlot* module, txSlot* exception) |
| 321 | { |
no test coverage detected