@@ -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 ;
@@ -2811,6 +2812,11 @@ void SetupProcessObject(Environment* env,
28112812 READONLY_PROPERTY (process, " _print_eval" , True (env->isolate ()));
28122813 }
28132814
2815+ // -c, --check
2816+ if (syntax_check_only) {
2817+ READONLY_PROPERTY (process, " _syntax_check_only" , True (env->isolate ()));
2818+ }
2819+
28142820 // -i, --interactive
28152821 if (force_repl) {
28162822 READONLY_PROPERTY (process, " _forceRepl" , True (env->isolate ()));
@@ -3067,6 +3073,7 @@ static void PrintHelp() {
30673073 " -v, --version print Node.js version\n "
30683074 " -e, --eval script evaluate script\n "
30693075 " -p, --print evaluate script and print result\n "
3076+ " -c, --check syntax check script without executing\n "
30703077 " -i, --interactive always enter the REPL even if stdin\n "
30713078 " does not appear to be a terminal\n "
30723079 " -r, --require module to preload (option can be repeated)\n "
@@ -3196,6 +3203,8 @@ static void ParseArgs(int* argc,
31963203 }
31973204 args_consumed += 1 ;
31983205 local_preload_modules[preload_module_count++] = module ;
3206+ } else if (strcmp (arg, " --check" ) == 0 || strcmp (arg, " -c" ) == 0 ) {
3207+ syntax_check_only = true ;
31993208 } else if (strcmp (arg, " --interactive" ) == 0 || strcmp (arg, " -i" ) == 0 ) {
32003209 force_repl = true ;
32013210 } else if (strcmp (arg, " --no-deprecation" ) == 0 ) {
0 commit comments