Skip to content

Commit 69a8fcd

Browse files
committed
fixup! src: allow to negate boolean CLI flags
1 parent 785cbb2 commit 69a8fcd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/node_options-inl.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ auto OptionsParser<Options>::Convert(
188188
return OptionInfo{original.type,
189189
Convert(original.field, get_child),
190190
original.env_setting,
191-
original.help_text};
191+
original.help_text,
192+
original.default_is_true};
192193
}
193194

194195
template <typename Options>
@@ -402,6 +403,13 @@ void OptionsParser<Options>::Parse(
402403
}
403404

404405
const OptionInfo& info = it->second;
406+
407+
// Some V8 options can be negated and they are validated by V8 later.
408+
if (is_negation && info.type != kBoolean && info.type != kV8Option) {
409+
errors->push_back(NegationImpliesBooleanError(arg));
410+
break;
411+
}
412+
405413
std::string value;
406414
if (info.type != kBoolean && info.type != kNoOp && info.type != kV8Option) {
407415
if (equals_index != std::string::npos) {
@@ -428,11 +436,6 @@ void OptionsParser<Options>::Parse(
428436
}
429437
}
430438

431-
// Some V8 options can be negated and they are validated by V8 later.
432-
if (is_negation && info.type != kBoolean && info.type != kV8Option) {
433-
errors->push_back(NegationImpliesBooleanError(arg));
434-
}
435-
436439
switch (info.type) {
437440
case kBoolean:
438441
*Lookup<bool>(info.field, options) = !is_negation;

0 commit comments

Comments
 (0)