Skip to content

Commit b04d84e

Browse files
QuickJS: use JS_AddIntrinsicBigInt() if it is detected.
1 parent 1d36e23 commit b04d84e

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

auto/quickjs

+23
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,29 @@ if [ $NJS_TRY_QUICKJS = YES ]; then
137137

138138
. auto/feature
139139

140+
njs_feature="QuickJS JS_AddIntrinsicBigInt()"
141+
njs_feature_name=NJS_HAVE_QUICKJS_ADD_INTRINSIC_BIG_INT
142+
njs_feature_test="#if defined(__GNUC__) && (__GNUC__ >= 8)
143+
#pragma GCC diagnostic push
144+
#pragma GCC diagnostic ignored \"-Wcast-function-type\"
145+
#endif
146+
147+
#include <quickjs.h>
148+
149+
int main() {
150+
JSRuntime *rt;
151+
JSContext *ctx;
152+
153+
rt = JS_NewRuntime();
154+
ctx = JS_NewContextRaw(rt);
155+
JS_AddIntrinsicBigInt(ctx);
156+
JS_FreeContext(ctx);
157+
JS_FreeRuntime(rt);
158+
return 0;
159+
}"
160+
161+
. auto/feature
162+
140163
njs_feature="QuickJS version"
141164
njs_feature_name=NJS_QUICKJS_VERSION
142165
njs_feature_run=value

src/qjs.c

+2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ qjs_new_context(JSRuntime *rt, qjs_module_t **addons)
165165
JS_AddIntrinsicMapSet(ctx);
166166
JS_AddIntrinsicTypedArrays(ctx);
167167
JS_AddIntrinsicPromise(ctx);
168+
#ifdef NJS_HAVE_QUICKJS_ADD_INTRINSIC_BIG_INT
168169
JS_AddIntrinsicBigInt(ctx);
170+
#endif
169171
JS_AddIntrinsicEval(ctx);
170172

171173
for (module = qjs_modules; *module != NULL; module++) {

0 commit comments

Comments
 (0)