Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trivial global setter function not inlined #1505

Open
dead-claudia opened this issue Mar 16, 2024 · 0 comments
Open

Trivial global setter function not inlined #1505

dead-claudia opened this issue Mar 16, 2024 · 0 comments

Comments

@dead-claudia
Copy link

dead-claudia commented Mar 16, 2024

Bug report or Feature request? Feature request

Version (complete output of terser -V or specific git commit) Whatever's the version on https://try.terser.org

Complete CLI command or minify() options used --module --compress --mangle (the default parameters on https://try.terser.org)

terser input

var context

function getContext() {
  return context
}

function setContext(c) {
  context = c
}

export function useContext() {
    var prevContext = getContext()

    /*@__INLINE__*/setContext(foo)

    try {
        operation()
    } finally {
        setContext(prevContext)
    }
}

terser output or error

var o;function n(n){o=n}export function useContext(){var t,r=o;t=foo,o=t;try{operation()}finally{n(r)}}

Expected result

var o;export function useContext(){var t,r=o;t=foo,o=t;try{operation()}finally{o=r}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants