Skip to content

Unused ignore arguments usage in outer scope #12032

Description

@Austaras

Describe the bug

A long-standing issue(that nobody cares) revealed by Codex.

Input code

function run(f) {
    f()
}

function foo(b) {
    run(() => {
        b = 2
    })

    console.log(arguments[0])
}

foo(1)

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false
    },
    "target": "es2015",
    "loose": false,
    "minify": {
      "compress": {
        "defaults": true
      }
    }
  },
  "module": {
    "type": "es6"
  },
  "minify": false,
  "isModule": true
}

Link to the code that reproduces this issue

https://play.swc.rs/?version=1.15.43&code=H4sIAAAAAAAAA0srzUsuyczPUygqzdNI01So5lIAgjQNTa5aLq40mGRafr5GEkwSpFJDU8HWDsoHgSQFWwUjMK9WkwtMJ%2BfnFefnpOrl5KdrJBall%2Bam5pUURxvEQgwGmmeoCQCs42gffAAAAA%3D%3D&config=H4sIAAAAAAAAA02PQQrDIBBF9zmFzLqLttAueoceQsxYLBrFGaEScvdqokk24rzvn%2F%2BdByHgSwpeYi7XMgQZCeM%2BF0J5YvkrBDgHJBVNYLh0lalKWlrCFS2bAizjB7m6kO7X26M5wHpP2B2NOTMZnc%2BZyrsQkejECh1Ry2S5Uo4Jm7AM%2FVyzwfkxWTx%2BVFtvPZ5wPOqRew8w9O7OdfvyB8dntFUdAQAA

SWC Info output

No response

Expected behavior

log 2

Actual behavior

log 1

Version

latest

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions