txSlot* fxNewSymbolInstance(txMachine* the) { txSlot* instance; txSlot* property; instance = fxNewObjectInstance(the); property = fxNextSymbolProperty(the, instance, XS_NO_ID, XS_NO_ID, XS_INTERNAL_FLAG | XS_GET_ONLY); return instance; }
txSlot* fxNewSymbolInstance(txMachine* the) { txSlot* instance; txSlot* property; instance = fxNewObjectInstance(the); instance->flag |= XS_VALUE_FLAG; property = fxNextSymbolProperty(the, instance, XS_NO_ID, XS_NO_ID, XS_GET_ONLY); return instance; }
void fxBuildSymbol(txMachine* the) { static const txHostFunctionBuilder gx_Symbol_prototype_builders[] = { { fx_Symbol_prototype_toString, 0, _toString }, { fx_Symbol_prototype_valueOf, 0, _valueOf }, { C_NULL, 0, 0 }, }; static const txHostFunctionBuilder gx_Symbol_builders[] = { { fx_Symbol_for, 1, _for }, { fx_Symbol_keyFor, 1, _keyFor }, { C_NULL, 0, 0 }, }; const txHostFunctionBuilder* builder; txSlot* slot; mxPush(mxObjectPrototype); slot = fxLastProperty(the, fxNewSymbolInstance(the)); for (builder = gx_Symbol_prototype_builders; builder->callback; builder++) slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG); slot = fxNextStringProperty(the, slot, "Symbol", mxID(_Symbol_toStringTag), XS_DONT_ENUM_FLAG | XS_DONT_SET_FLAG); mxSymbolPrototype = *the->stack; slot = fxLastProperty(the, fxNewHostConstructorGlobal(the, fx_Symbol, 0, mxID(_Symbol), XS_GET_ONLY)); for (builder = gx_Symbol_builders; builder->callback; builder++) slot = fxNextHostFunctionProperty(the, slot, builder->callback, builder->length, mxID(builder->id), XS_DONT_ENUM_FLAG); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_hasInstance), mxID(_hasInstance), XS_GET_ONLY); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_isConcatSpreadable), mxID(_isConcatSpreadable), XS_GET_ONLY); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_iterator), mxID(_iterator), XS_GET_ONLY); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_match), mxID(_match), XS_GET_ONLY); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_replace), mxID(_replace), XS_GET_ONLY); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_search), mxID(_search), XS_GET_ONLY); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_species), mxID(_species), XS_GET_ONLY); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_split), mxID(_split), XS_GET_ONLY); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_toPrimitive), mxID(_toPrimitive), XS_GET_ONLY); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_toStringTag), mxID(_toStringTag), XS_GET_ONLY); slot = fxNextSymbolProperty(the, slot, mxID(_Symbol_unscopables), mxID(_unscopables), XS_GET_ONLY); the->stack++; }