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

Function fxNewArgumentsStrictInstance

xs/sources/xsArguments.c:179–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179txSlot* fxNewArgumentsStrictInstance(txMachine* the, txIndex count)
180{
181 txSlot* instance;
182 txSlot* array;
183 txSlot* property;
184 txSlot* function;
185 txIndex index;
186 txSlot* address;
187 txIndex length = (txIndex)mxArgc;
188 instance = fxNewObjectInstance(the);
189 instance->flag |= XS_EXOTIC_FLAG;
190 array = instance->next = fxNewSlot(the);
191 array->flag = XS_INTERNAL_FLAG;
192 array->ID = XS_ARGUMENTS_STRICT_BEHAVIOR;
193 array->kind = XS_ARRAY_KIND;
194 array->value.array.length = 0;
195 array->value.array.address = C_NULL;
196 property = fxNextNumberProperty(the, array, length, mxID(_length), XS_DONT_ENUM_FLAG);
197 property = fxNextSlotProperty(the, property, &mxArrayIteratorFunction, mxID(_Symbol_iterator), XS_DONT_ENUM_FLAG);
198 function = mxThrowTypeErrorFunction.value.reference;
199 property = property->next = fxNewSlot(the);
200 property->flag = XS_DONT_DELETE_FLAG | XS_DONT_ENUM_FLAG;
201 property->ID = mxID(_callee);
202 property->kind = XS_ACCESSOR_KIND;
203 property->value.accessor.getter = function;
204 property->value.accessor.setter = function;
205 fxSetIndexSize(the, array, length, XS_CHUNK);
206 index = 0;
207 address = array->value.array.address;
208 while (index < length) {
209 property = mxArgv(index);
210 *((txIndex*)address) = index;
211 address->ID = XS_NO_ID;
212 address->kind = property->kind;
213 address->value = property->value;
214 index++;
215 address++;
216 }
217 return instance;
218}
219
220void fxThrowTypeError(txMachine* the)
221{

Callers

nothing calls this directly

Calls 5

fxNewObjectInstanceFunction · 0.85
fxNewSlotFunction · 0.85
fxNextNumberPropertyFunction · 0.85
fxNextSlotPropertyFunction · 0.85
fxSetIndexSizeFunction · 0.85

Tested by

no test coverage detected