MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxTestEntry

Function fxTestEntry

xs/sources/xsMapSet.c:1342–1376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1340}
1341
1342txBoolean fxTestEntry(txMachine* the, txSlot* a, txSlot* b)
1343{
1344 txBoolean result = 0;
1345 if (a->kind == b->kind) {
1346 if ((XS_UNDEFINED_KIND == a->kind) || (XS_NULL_KIND == a->kind))
1347 result = 1;
1348 else if (XS_BOOLEAN_KIND == a->kind)
1349 result = a->value.boolean == b->value.boolean;
1350 else if (XS_INTEGER_KIND == a->kind)
1351 result = a->value.integer == b->value.integer;
1352 else if (XS_NUMBER_KIND == a->kind)
1353 result = ((c_isnan(a->value.number) && c_isnan(b->value.number)) || (a->value.number == b->value.number));
1354 else if ((XS_STRING_KIND == a->kind) || (XS_STRING_X_KIND == a->kind))
1355 result = c_strcmp(a->value.string, b->value.string) == 0;
1356 else if (XS_SYMBOL_KIND == a->kind)
1357 result = a->value.symbol == b->value.symbol;
1358 else if ((XS_BIGINT_KIND == a->kind) || (XS_BIGINT_X_KIND == a->kind))
1359 result = gxTypeBigInt.compare(the, 0, 1, 0, a, b);
1360 else if (XS_REFERENCE_KIND == a->kind)
1361 result = a->value.reference == b->value.reference;
1362 }
1363 else if ((XS_INTEGER_KIND == a->kind) && (XS_NUMBER_KIND == b->kind))
1364 result = (!c_isnan(b->value.number)) && ((txNumber)(a->value.integer) == b->value.number);
1365 else if ((XS_NUMBER_KIND == a->kind) && (XS_INTEGER_KIND == b->kind))
1366 result = (!c_isnan(a->value.number)) && (a->value.number == (txNumber)(b->value.integer));
1367 else if ((XS_STRING_KIND == a->kind) && (XS_STRING_X_KIND == b->kind))
1368 result = c_strcmp(a->value.string, b->value.string) == 0;
1369 else if ((XS_STRING_X_KIND == a->kind) && (XS_STRING_KIND == b->kind))
1370 result = c_strcmp(a->value.string, b->value.string) == 0;
1371 else if ((XS_BIGINT_KIND == a->kind) && (XS_BIGINT_X_KIND == b->kind))
1372 result = gxTypeBigInt.compare(the, 0, 1, 0, a, b);
1373 else if ((XS_BIGINT_X_KIND == a->kind) && (XS_BIGINT_KIND == b->kind))
1374 result = gxTypeBigInt.compare(the, 0, 1, 0, a, b);
1375 return result;
1376}
1377
1378txSlot* fxCanBeHeldWeakly(txMachine* the, txSlot* slot)
1379{

Callers 3

fxDeleteEntryFunction · 0.85
fxGetEntryFunction · 0.85
fxSetEntryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected