@@ -121,6 +121,7 @@ using v8::Value;
121121
122122static bool print_eval = false ;
123123static bool force_repl = false ;
124+ static bool syntax_check_only = false ;
124125static bool trace_deprecation = false ;
125126static bool throw_deprecation = false ;
126127static bool abort_on_uncaught_exception = false ;
@@ -2823,6 +2824,11 @@ void SetupProcessObject(Environment* env,
28232824 READONLY_PROPERTY (process, " _print_eval" , True (env->isolate ()));
28242825 }
28252826
2827+ // -c, --check
2828+ if (syntax_check_only) {
2829+ READONLY_PROPERTY (process, " _syntax_check_only" , True (env->isolate ()));
2830+ }
2831+
28262832 // -i, --interactive
28272833 if (force_repl) {
28282834 READONLY_PROPERTY (process, " _forceRepl" , True (env->isolate ()));
@@ -3079,6 +3085,7 @@ static void PrintHelp() {
30793085 " -v, --version print Node.js version\n "
30803086 " -e, --eval script evaluate script\n "
30813087 " -p, --print evaluate script and print result\n "
3088+ " -c, --check syntax check script without executing\n "
30823089 " -i, --interactive always enter the REPL even if stdin\n "
30833090 " does not appear to be a terminal\n "
30843091 " -r, --require module to preload (option can be repeated)\n "
@@ -3208,6 +3215,8 @@ static void ParseArgs(int* argc,
32083215 }
32093216 args_consumed += 1 ;
32103217 local_preload_modules[preload_module_count++] = module ;
3218+ } else if (strcmp (arg, " --check" ) == 0 || strcmp (arg, " -c" ) == 0 ) {
3219+ syntax_check_only = true ;
32113220 } else if (strcmp (arg, " --interactive" ) == 0 || strcmp (arg, " -i" ) == 0 ) {
32123221 force_repl = true ;
32133222 } else if (strcmp (arg, " --no-deprecation" ) == 0 ) {
0 commit comments