From a02b62131242a65c4040f9b81c3a92b1d93b5d3a Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 20 Jan 2019 17:43:53 -0500 Subject: [PATCH] report: simplify option checking Also update the code for house style. PR-URL: https://github.com/nodejs/node/pull/25597 Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann Reviewed-By: Denys Otrishko --- src/node_options.cc | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/node_options.cc b/src/node_options.cc index 736edb5d4425ae..7aed3fbcff4bbe 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -36,29 +36,45 @@ void PerProcessOptions::CheckOptions(std::vector* errors) { void PerIsolateOptions::CheckOptions(std::vector* errors) { per_env->CheckOptions(errors); #ifdef NODE_REPORT - if (!report_directory.empty() && !per_env->experimental_report) + if (per_env->experimental_report) + return; + + if (!report_directory.empty()) { errors->push_back("--diagnostic-report-directory option is valid only when " "--experimental-report is set"); - if (!report_filename.empty() && !per_env->experimental_report) + } + + if (!report_filename.empty()) { errors->push_back("--diagnostic-report-filename option is valid only when " "--experimental-report is set"); - if (!report_signal.empty() && !per_env->experimental_report) + } + + if (!report_signal.empty()) { errors->push_back("--diagnostic-report-signal option is valid only when " "--experimental-report is set"); - if (report_on_fatalerror && !per_env->experimental_report) + } + + if (report_on_fatalerror) { errors->push_back( "--diagnostic-report-on-fatalerror option is valid only when " "--experimental-report is set"); - if (report_on_signal && !per_env->experimental_report) + } + + if (report_on_signal) { errors->push_back("--diagnostic-report-on-signal option is valid only when " "--experimental-report is set"); - if (report_uncaught_exception && !per_env->experimental_report) + } + + if (report_uncaught_exception) { errors->push_back( "--diagnostic-report-uncaught-exception option is valid only when " "--experimental-report is set"); - if (report_verbose && !per_env->experimental_report) + } + + if (report_verbose) { errors->push_back("--diagnostic-report-verbose option is valid only when " "--experimental-report is set"); + } #endif // NODE_REPORT }