Skip to content

Commit 796175c

Browse files
Jake ChampionJakeChampion
authored andcommitted
allow use of ThrowIfNotConstructing from other files by adding it to the header file
we plan to move the built-ins into their own files and they will require access to this functions
1 parent 6640811 commit 796175c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

c-dependencies/js-compute-runtime/js-compute-builtins.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -180,15 +180,6 @@ uint8_t *value_to_buffer(JSContext *cx, HandleValue val, const char *val_desc, s
180180
return data;
181181
}
182182

183-
inline bool ThrowIfNotConstructing(JSContext *cx, const CallArgs &args, const char *builtinName) {
184-
if (args.isConstructing()) {
185-
return true;
186-
}
187-
188-
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BUILTIN_CTOR_NO_NEW, builtinName);
189-
return false;
190-
}
191-
192183
bool RejectPromiseWithPendingError(JSContext *cx, HandleObject promise) {
193184
RootedValue exn(cx);
194185
if (!JS_IsExceptionPending(cx) || !JS_GetPendingException(cx, &exn)) {

c-dependencies/js-compute-runtime/js-compute-builtins.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ inline bool ReturnPromiseRejectedWithPendingError(JSContext *cx, const JS::CallA
4545
return true;
4646
}
4747

48+
inline bool ThrowIfNotConstructing(JSContext *cx, const JS::CallArgs &args,
49+
const char *builtinName) {
50+
if (args.isConstructing()) {
51+
return true;
52+
}
53+
54+
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BUILTIN_CTOR_NO_NEW, builtinName);
55+
return false;
56+
}
4857
bool hasWizeningFinished();
4958
bool isWizening();
5059
void markWizeningAsFinished();

0 commit comments

Comments
 (0)