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

Function fx_deepEqualInstances

modules/base/deepEqual/deepEqual.c:205–543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

203}
204
205txBoolean fx_deepEqualInstances(txMachine* the, txSlot* limit, txBoolean strict)
206{
207 txSlot** leftAddress;
208 const txBehavior* leftBehavior;
209 txSlot* leftAt;
210 txSlot* leftBase;
211 txIndex leftCount;
212 txSlot* leftInstance;
213 txSlot* leftProperty;
214 txBoolean leftResult;
215 txSize leftSize;
216 txSlot** rightAddress;
217 const txBehavior* rightBehavior;
218 txSlot* rightAt;
219 txSlot* rightBase;
220 txIndex rightCount;
221 txSlot* rightInstance;
222 txSlot* rightProperty;
223 txBoolean rightResult;
224 txSize rightSize;
225 txFlag flag = XS_EACH_NAME_FLAG;
226
227 // circular references
228 leftAt = the->stack + 1;
229 leftBase = leftAt + 2;
230 leftCount = 1;
231 while (leftBase < limit) {
232 if (leftBase->kind == XS_REFERENCE_KIND) {
233 leftCount++;
234 if (fxIsSameReference(the, leftAt, leftBase))
235 break;
236 }
237 leftBase += 2;
238 }
239 rightAt = the->stack;
240 rightBase = rightAt + 2;
241 rightCount = 1;
242 while (rightBase < limit) {
243 if (rightBase->kind == XS_REFERENCE_KIND) {
244 rightCount++;
245 if (fxIsSameReference(the, rightAt, rightBase))
246 break;
247 }
248 rightBase += 2;
249 }
250 if (leftBase < limit) {
251 if (rightBase < limit)
252 return (leftCount == rightCount) ? 1 : 0;
253 return 0;
254 }
255 else if (rightBase < limit)
256 return 0;
257
258 // aliases
259 leftInstance = leftAt->value.reference;
260 if (leftInstance->ID) {
261 txSlot* alias = the->aliasArray[leftInstance->ID];
262 if (alias)

Callers 1

fx_deepEqualSlotsFunction · 0.85

Calls 6

fxIsSameReferenceFunction · 0.85
fx_deepEqualPropertiesFunction · 0.85
fxGetDataViewSizeFunction · 0.85
fx_deepEqualEntriesFunction · 0.85
fxNewInstanceFunction · 0.85
fx_deepEqualSlotsFunction · 0.85

Tested by

no test coverage detected