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

Function fxTypedArrayDefineOwnProperty

xs/sources/xsDataView.c:1239–1287  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1237}
1238
1239txBoolean fxTypedArrayDefineOwnProperty(txMachine* the, txSlot* instance, txID id, txIndex index, txSlot* slot, txFlag mask)
1240{
1241 if ((!id) || fxIsCanonicalIndex(the, id)) {
1242 txSlot* dispatch = instance->next;
1243 txSlot* view = dispatch->next;
1244 txSlot* buffer = view->next;
1245 txU2 shift = dispatch->value.typedArray.dispatch->shift;
1246 txSlot* arrayBuffer = buffer->value.reference->next;
1247 txIndex length = fxGetDataViewSize(the, view, buffer) >> shift;
1248 if (id || (index >= length))
1249 return 0;
1250 if (arrayBuffer->flag & XS_DONT_SET_FLAG) {
1251 if ((mask & XS_DONT_DELETE_FLAG) && !(slot->flag & XS_DONT_DELETE_FLAG))
1252 return 0;
1253 if ((mask & XS_DONT_ENUM_FLAG) && (slot->flag & XS_DONT_ENUM_FLAG))
1254 return 0;
1255 if (mask & XS_ACCESSOR_FLAG)
1256 return 0;
1257 if ((mask & XS_DONT_SET_FLAG) && !(slot->flag & XS_DONT_SET_FLAG))
1258 return 0;
1259 if (slot->kind != XS_UNINITIALIZED_KIND) {
1260 txSlot* property;
1261 txBoolean result = 1;
1262 mxTemporary(property);
1263 (*dispatch->value.typedArray.dispatch->getter)(the, arrayBuffer, view->value.dataView.offset + (index << shift), property, EndianNative);
1264 result = fxIsSameValue(the, property, slot, 0);
1265 mxPop();
1266 return result;
1267 }
1268 return 1;
1269 }
1270 if ((mask & XS_DONT_DELETE_FLAG) && (slot->flag & XS_DONT_DELETE_FLAG))
1271 return 0;
1272 if ((mask & XS_DONT_ENUM_FLAG) && (slot->flag & XS_DONT_ENUM_FLAG))
1273 return 0;
1274 if (mask & XS_ACCESSOR_FLAG)
1275 return 0;
1276 if ((mask & XS_DONT_SET_FLAG) && (slot->flag & XS_DONT_SET_FLAG))
1277 return 0;
1278 if (slot->kind != XS_UNINITIALIZED_KIND) {
1279 dispatch->value.typedArray.dispatch->coerce(the, slot);
1280 length = fxGetDataViewSize(the, view, buffer) >> shift;
1281 if (index < length)
1282 (*dispatch->value.typedArray.dispatch->setter)(the, arrayBuffer, view->value.dataView.offset + (index << shift), slot, EndianNative);
1283 }
1284 return 1;
1285 }
1286 return fxOrdinaryDefineOwnProperty(the, instance, id, index, slot, mask);
1287}
1288
1289txBoolean fxTypedArrayDeleteProperty(txMachine* the, txSlot* instance, txID id, txIndex index)
1290{

Callers

nothing calls this directly

Calls 4

fxIsCanonicalIndexFunction · 0.85
fxGetDataViewSizeFunction · 0.85
fxIsSameValueFunction · 0.85

Tested by

no test coverage detected