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

Nested private class field does not get mangled properly #1067

Closed
TimvdLippe opened this issue Sep 9, 2021 · 0 comments · Fixed by #1068
Closed

Nested private class field does not get mangled properly #1067

TimvdLippe opened this issue Sep 9, 2021 · 0 comments · Fixed by #1068
Labels
bug mangle Issue in the mangler

Comments

@TimvdLippe
Copy link

Bug report or Feature request?

Bug

Version (complete output of terser -V or specific git commit)

5.7.2

Complete CLI command or minify() options used

// edit terser options
{
  module: true,
  compress: {},
  mangle: {
    properties: {
          regex: /^#\w+/,
        },
  },
  output: {},
  parse: {},
  rename: {},
}

terser input

"use strict";
class Foo {
    constructor(self) {
        this.#self = self;
    }
    #self;
    accessNestedPrivateField() {
        if (this.#self) {
            return this.#self.#self;
        }
        return "Not here";
    }
}
const one = new Foo();
const two = new Foo(one);
console.log(two.accessNestedPrivateField());

terser output or error

class e{constructor(e){this.#e=e}#e;accessNestedPrivateField(){return this.#e?this.#self.#e:"Not here"}}const s=new e,t=new e(s);console.log(t.accessNestedPrivateField());

Expected result

The this.#self.#e should be this.#e.#e instead.

@jridgewell jridgewell added bug mangle Issue in the mangler labels Sep 9, 2021
devtools-bot pushed a commit to ChromeDevTools/devtools-frontend that referenced this issue Sep 29, 2021
This pulls in the bugfix for mangling private class fields
reported in terser/terser#1067

DISABLE_THIRD_PARTY_CHECK=Fix rollup config
R=jacktfranklin@chromium.org

Bug: 1222126
Change-Id: I77a1ddc3697498829e595cead728479e81e7889c
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3158385
Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
Auto-Submit: Tim van der Lippe <tvanderlippe@chromium.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mangle Issue in the mangler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants