File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 66#include < algorithm>
77#include < cstdlib>
88#include < ranges>
9+ #include < unordered_map>
910#include " node_options.h"
1011#include " util.h"
1112
@@ -334,6 +335,8 @@ void OptionsParser<Options>::Parse(
334335 if (v8_args->empty ())
335336 v8_args->push_back (args.program_name ());
336337
338+ std::unordered_map<std::string, bool > default_field_map = {};
339+
337340 while (!args.empty () && errors->empty ()) {
338341 if (args.first ().size () <= 1 || args.first ()[0 ] != ' -' ) break ;
339342
@@ -428,8 +431,13 @@ void OptionsParser<Options>::Parse(
428431 v8_args->push_back (value.name );
429432 } else {
430433 bool target_value = value.target_value ;
434+ if (!default_field_map.contains (value.name )) {
435+ default_field_map[value.name ] =
436+ *value.target_field
437+ ->template Lookup <bool >(options);
438+ }
431439 if (is_negation && value.type == kBoolean ) {
432- target_value = ! value.target_value ;
440+ target_value = default_field_map[ value.name ] ;
433441 }
434442 *value.target_field ->template Lookup <bool >(
435443 options) = target_value;
You can’t perform that action at this time.
0 commit comments