mirror of
https://github.com/bellard/quickjs.git
synced 2025-09-30 15:04:24 +03:00
- removed the 'use strip' extension
- removed the JS_EVAL_FLAG_STRIP eval flag and replaced it with JS_SetStripInfo() which has simpler semantics. - qjs: added the '-s' and '--strip-source' options - qjsc: added the '-s' and '--keep-source' options
This commit is contained in:
12
qjs.c
12
qjs.c
@@ -301,6 +301,8 @@ void help(void)
|
||||
" --memory-limit n limit the memory usage to 'n' bytes (SI suffixes allowed)\n"
|
||||
" --stack-size n limit the stack size to 'n' bytes (SI suffixes allowed)\n"
|
||||
" --no-unhandled-rejection ignore unhandled promise rejections\n"
|
||||
"-s strip all the debug info\n"
|
||||
" --strip-source strip the source code\n"
|
||||
"-q --quit just instantiate the interpreter and quit\n");
|
||||
exit(1);
|
||||
}
|
||||
@@ -322,6 +324,7 @@ int main(int argc, char **argv)
|
||||
size_t memory_limit = 0;
|
||||
char *include_list[32];
|
||||
int i, include_count = 0;
|
||||
int strip_flags = 0;
|
||||
size_t stack_size = 0;
|
||||
|
||||
/* cannot use getopt because we want to pass the command line to
|
||||
@@ -421,6 +424,14 @@ int main(int argc, char **argv)
|
||||
stack_size = get_suffixed_size(argv[optind++]);
|
||||
continue;
|
||||
}
|
||||
if (opt == 's') {
|
||||
strip_flags = JS_STRIP_DEBUG;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(longopt, "strip-source")) {
|
||||
strip_flags = JS_STRIP_SOURCE;
|
||||
continue;
|
||||
}
|
||||
if (opt) {
|
||||
fprintf(stderr, "qjs: unknown option '-%c'\n", opt);
|
||||
} else {
|
||||
@@ -444,6 +455,7 @@ int main(int argc, char **argv)
|
||||
JS_SetMemoryLimit(rt, memory_limit);
|
||||
if (stack_size != 0)
|
||||
JS_SetMaxStackSize(rt, stack_size);
|
||||
JS_SetStripInfo(rt, strip_flags);
|
||||
js_std_set_worker_new_context_func(JS_NewCustomContext);
|
||||
js_std_init_handlers(rt);
|
||||
ctx = JS_NewCustomContext(rt);
|
||||
|
Reference in New Issue
Block a user