Skip to content

Commit

Permalink
[link.py] Remove unnecessary use of state.js_target. NFC (emscripten-…
Browse files Browse the repository at this point in the history
…core#23315)

The state object in emcc.py is not declared with a js_target member, and
its use is it really not needed.
  • Loading branch information
sbc100 authored Jan 6, 2025
1 parent 2396d3e commit a927b40
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -1919,19 +1919,19 @@ def phase_post_link(options, state, in_wasm, wasm_target, target, js_syms, base_
settings.TARGET_BASENAME = unsuffixed_basename(target)

if options.oformat in (OFormat.JS, OFormat.MJS):
state.js_target = target
js_target = target
else:
state.js_target = get_secondary_target(target, '.js')
js_target = get_secondary_target(target, '.js')

settings.TARGET_JS_NAME = os.path.basename(state.js_target)
settings.TARGET_JS_NAME = os.path.basename(js_target)

metadata = phase_emscript(in_wasm, wasm_target, js_syms, base_metadata)

if settings.EMBIND_AOT:
phase_embind_aot(wasm_target, js_syms, linker_inputs)

if options.emit_tsd:
phase_emit_tsd(options, wasm_target, state.js_target, js_syms, metadata, linker_inputs)
phase_emit_tsd(options, wasm_target, js_target, js_syms, metadata, linker_inputs)

if options.js_transform:
phase_source_transforms(options)
Expand All @@ -1940,7 +1940,7 @@ def phase_post_link(options, state, in_wasm, wasm_target, target, js_syms, base_

# If we are not emitting any JS then we are all done now
if options.oformat != OFormat.WASM:
phase_final_emitting(options, state, target, wasm_target)
phase_final_emitting(options, state, target, js_target, wasm_target)


@ToolchainProfiler.profile_block('emscript')
Expand Down Expand Up @@ -2108,7 +2108,7 @@ def create_worker_file(input_file, target_dir, output_file, options):


@ToolchainProfiler.profile_block('final emitting')
def phase_final_emitting(options, state, target, wasm_target):
def phase_final_emitting(options, state, target, js_target, wasm_target):
global final_js

if shared.SKIP_SUBPROCS:
Expand Down Expand Up @@ -2164,8 +2164,6 @@ def phase_final_emitting(options, state, target, wasm_target):

js_manipulation.handle_license(final_js)

js_target = state.js_target

# The JS is now final. Move it to its final location
move_file(final_js, js_target)

Expand Down

0 comments on commit a927b40

Please sign in to comment.