Skip to content

Commit ea48160

Browse files
authored
Simplify -jsD command line flag handling. NFC (#25685)
1 parent 975f97d commit ea48160

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

tools/cmdline.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ def parse_args(newargs): # noqa: C901, PLR0912, PLR0915
227227
To revalidate these numbers, run `ruff check --select=C901,PLR091`.
228228
"""
229229
options = EmccOptions()
230-
user_js_defines = []
231230
should_exit = False
232231
skip = False
233232

@@ -588,7 +587,8 @@ def consume_arg_file():
588587
value = '1'
589588
if key in settings.keys():
590589
exit_with_error(f'{arg}: cannot change built-in settings values with a -jsD directive. Pass -s{key}={value} instead!')
591-
user_js_defines += [(key, value)]
590+
# Apply user -jsD settings
591+
settings[key] = value
592592
newargs[i] = ''
593593
elif check_flag('-shared'):
594594
options.shared = True
@@ -642,7 +642,7 @@ def consume_arg_file():
642642
sys.exit(0)
643643

644644
newargs = [a for a in newargs if a]
645-
return options, user_js_defines, newargs
645+
return options, newargs
646646

647647

648648
def expand_byte_size_suffixes(value):
@@ -854,7 +854,7 @@ def parse_arguments(args):
854854
newargs[i] += newargs[i + 1]
855855
newargs[i + 1] = ''
856856

857-
options, user_js_defines, newargs = parse_args(newargs)
857+
options, newargs = parse_args(newargs)
858858

859859
if options.post_link or options.oformat == OFormat.BARE:
860860
diagnostics.warning('experimental', '--oformat=bare/--post-link are experimental and subject to change.')
@@ -871,10 +871,6 @@ def parse_arguments(args):
871871
if strict_cmdline:
872872
settings.STRICT = int(strict_cmdline)
873873

874-
# Apply user -jsD settings
875-
for s in user_js_defines:
876-
settings[s[0]] = s[1]
877-
878874
# Apply -s settings in newargs here (after optimization levels, so they can override them)
879875
apply_user_settings()
880876

0 commit comments

Comments
 (0)