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

Function fxBuildError

xs/sources/xsError.c:72–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70};
71
72void fxBuildError(txMachine* the)
73{
74 txSlot* slot;
75 txSlot* prototype;
76 txSlot* instance;
77#if mxExplicitResourceManagement
78 txSlot* property;
79#endif
80
81 mxPush(mxObjectPrototype);
82 slot = fxLastProperty(the, fxNewObjectInstance(the));
83 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Error_toString), 0, mxID(_toString), XS_DONT_ENUM_FLAG);
84 slot = fxNextStringXProperty(the, slot, (txString)gxErrorNames[XS_UNKNOWN_ERROR], mxID(_name), XS_DONT_ENUM_FLAG);
85 slot = fxNextStringXProperty(the, slot, "", mxID(_message), XS_DONT_ENUM_FLAG);
86 slot = fxNextHostAccessorProperty(the, slot, mxCallback(fx_Error_prototype_get_stack), mxCallback(fx_Error_prototype_set_stack), mxID(_stack), XS_DONT_ENUM_FLAG);
87 mxErrorPrototype = *the->stack;
88 prototype = fxBuildHostConstructor(the, mxCallback(fx_Error), 1, mxID(_Error));
89 mxErrorConstructor = *the->stack;
90#if mxErrorIsError
91 slot = fxLastProperty(the, prototype);
92 slot = fxNextHostFunctionProperty(the, slot, mxCallback(fx_Error_isError), 1, mxID(_isError), XS_DONT_ENUM_FLAG);
93#endif
94 mxPop();
95 mxPush(mxErrorPrototype);
96 slot = fxLastProperty(the, fxNewObjectInstance(the));
97 slot = fxNextStringXProperty(the, slot, (txString)gxErrorNames[XS_AGGREGATE_ERROR], mxID(_name), XS_DONT_ENUM_FLAG);
98 slot = fxNextStringXProperty(the, slot, "", mxID(_message), XS_DONT_ENUM_FLAG);
99 mxAggregateErrorPrototype = *the->stack;
100 instance = fxBuildHostConstructor(the, mxCallback(fx_AggregateError), 2, mxID(_AggregateError));
101 instance->value.instance.prototype = prototype;
102 mxAggregateErrorConstructor = *the->stack;
103 mxPop();
104 mxPush(mxErrorPrototype);
105 slot = fxLastProperty(the, fxNewObjectInstance(the));
106 slot = fxNextStringXProperty(the, slot, (txString)gxErrorNames[XS_EVAL_ERROR], mxID(_name), XS_DONT_ENUM_FLAG);
107 slot = fxNextStringXProperty(the, slot, "", mxID(_message), XS_DONT_ENUM_FLAG);
108 mxEvalErrorPrototype = *the->stack;
109 instance = fxBuildHostConstructor(the, mxCallback(fx_EvalError), 1, mxID(_EvalError));
110 instance->value.instance.prototype = prototype;
111 mxEvalErrorConstructor = *the->stack;
112 mxPop();
113 mxPush(mxErrorPrototype);
114 slot = fxLastProperty(the, fxNewObjectInstance(the));
115 slot = fxNextStringXProperty(the, slot, (txString)gxErrorNames[XS_RANGE_ERROR], mxID(_name), XS_DONT_ENUM_FLAG);
116 slot = fxNextStringXProperty(the, slot, "", mxID(_message), XS_DONT_ENUM_FLAG);
117 mxRangeErrorPrototype = *the->stack;
118 instance = fxBuildHostConstructor(the, mxCallback(fx_RangeError), 1, mxID(_RangeError));
119 instance->value.instance.prototype = prototype;
120 mxRangeErrorConstructor = *the->stack;
121 mxPop();
122 mxPush(mxErrorPrototype);
123 slot = fxLastProperty(the, fxNewObjectInstance(the));
124 slot = fxNextStringXProperty(the, slot, (txString)gxErrorNames[XS_REFERENCE_ERROR], mxID(_name), XS_DONT_ENUM_FLAG);
125 slot = fxNextStringXProperty(the, slot, "", mxID(_message), XS_DONT_ENUM_FLAG);
126 mxReferenceErrorPrototype = *the->stack;
127 instance = fxBuildHostConstructor(the, mxCallback(fx_ReferenceError), 1, mxID(_ReferenceError));
128 instance->value.instance.prototype = prototype;
129 mxReferenceErrorConstructor = *the->stack;

Callers 1

fxCreateMachineFunction · 0.85

Calls 7

fxLastPropertyFunction · 0.85
fxNewObjectInstanceFunction · 0.85
fxNextStringXPropertyFunction · 0.85
fxBuildHostConstructorFunction · 0.85
fxNextSlotPropertyFunction · 0.85

Tested by

no test coverage detected