Skip to content

Replace this in function expressions in object properties #257

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

SarahIsWeird
Copy link
Contributor

Fixes #256.

hsm minify game-scripts-tests/this_in_lambda_object.ts:

(Please note the gazillion lets are unrelated to this and also happened before. Opening a new issue for that)

function({ expect }) {
  let _0r9s8yrtnh2_THIS_
  let _0qaqlusuq93_THIS_
  let _09o8urfmvr2_THIS_
  let _0msk5ver1n0_THIS_
  let _12xk01szpo4_THIS_
  let _0rlmat2fi08_THIS_
  let myObject =
    (_0rlmat2fi08_THIS_ =
    _12xk01szpo4_THIS_ =
    _0msk5ver1n0_THIS_ =
    _09o8urfmvr2_THIS_ =
    _0qaqlusuq93_THIS_ =
    _0r9s8yrtnh2_THIS_ =
      {
        a: 0,
        b() {
          _0rlmat2fi08_THIS_.a++
          return _0rlmat2fi08_THIS_.a
        },
        c: function (value = _12xk01szpo4_THIS_.a) {
          _0msk5ver1n0_THIS_.a = value + 1
        },
        d: function ({ value = _09o8urfmvr2_THIS_.a }) {
          _0qaqlusuq93_THIS_.a = value + 1
        },
        f() {
          return _0r9s8yrtnh2_THIS_.a
        }
      })
  expect(myObject.a).toBe(0)
  myObject.b()
  expect(myObject.a).toBe(1)
  myObject.c()
  expect(myObject.a).toBe(2)
  myObject.d({})
  expect(myObject.a).toBe(3)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

this keyword in functions in objects are converted to undefined
1 participant